开发者

Calling ant file through java code [duplicate]

开发者 https://www.devze.com 2023-03-14 22:17 出处:网络
This question already has answers here: Closed 10 years ago. Possible Duplicate: Is it possible to call Ant or NSIS scripts from Java code?
This question already has answers here: Closed 10 years ago.

Possible Duplicate:

Is it possible to call Ant or NSIS scripts from Java code?

I need to call an ant build in java code. I try to use Runtime class. I dont know how to give the ant build to the following code. I tried to assign the entire ant script to a string, it wont work. Any suggest开发者_如何学Goion

Process child = Runtime.getRuntime().exec("command");


This question should help you:

Is it possible to call Ant or NSIS scripts from Java code?

And this one has a good link in the accepted answer explaining running commands from java in general: Collect Linux command output


Try "cmd /c ant build", that should work.


Alternatively use Gant which is nothing else than using Groovy for scripting Ant scripts instead of using xml.
Groovy scripts compile to Java bytecode - pure Java.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号