-1

I need to automatize spring roo tasks from an ant build.xml. Is it somehow possible? Maybe there is an ant task lib for the job?

Using ant instead of maven/gradle/... isn't my decision and I can't do anything with it.

Calling the roo shell with an exec task is only a last resort, I want a solution to that I don't need to step out from the jvm of the ant process.

peterh
  • 11,875
  • 18
  • 85
  • 108
  • To the googlers of the future: In the absence of valid answers, the question remains open indefinitely. If you have an answer, I wait you with my upvoting/accepting capability. – peterh Sep 23 '14 at 15:08

2 Answers2

1

Roo Shell executes over OSGi environment and requires it to run (uses OSGi dependency injections to get component in runtime). So, as Ant runs as simple java application, no way to run Roo shell as an Ant Task but use ant exec task (as you already comment).

Sorry.

jmvivo
  • 2,653
  • 1
  • 16
  • 20
  • Ok, but the roo.sh (roo.bat) _has_ a way to somehow invoke roo. It simply uses a java -jar call to do the task. Why were ant unable to do the same, even if it needed to start an osgi environment for the job? – peterh Sep 11 '14 at 09:13
  • What roo.sh does is to run Apache Felix that loads all Roo components like the commands you said. – eruiz Sep 11 '14 at 14:19
  • @eruiz Maybe it were then enough to start felix from ant? Isn't there a felix/ant integration? – peterh Sep 11 '14 at 18:10
  • @eruiz Ok, but if a single java command _can_ call felix, which calls the osgi components and start spring roo, _why_ is the same impossible from ant? – peterh Sep 15 '14 at 07:52
  • I'm not sure what you mean ... Ant is what is, take a look to user guide to know more about Ant targets. – eruiz Sep 15 '14 at 13:30
1

The project generated with Roo is as any other Maven project, so you may use a exec task. Something like this:

<target name="mvn-install">
    <exec executable="mvn">
        <arg value="clean" />
        <arg value="install" />
    </exec>
</target>
eruiz
  • 1,963
  • 1
  • 14
  • 22
  • Thank you, but maybe you didn't read my last sentence: "Calling the roo shell with an exec task is only a last resort, I want a solution to that I don't need to step out from the jvm of the ant process." You also didn't understand, that I want to call roo operations ("entity", "perform", etc) and not maven operations. If it weren't an answer to my question, you got a downvote and a "not an answer" flag. – peterh Sep 11 '14 at 13:46
  • So, jmvivo is right, you cannot call Roo Shell commands from Ant, Maven, ... all Roo commands are OSGi components so you need the OSGi container running to execute them. – eruiz Sep 11 '14 at 14:18
  • Yes, and the roo.sh starts this osgi container, and exactly this is which I have to do as an ant "java" task... – peterh Sep 12 '14 at 12:33