Is it possible to call Ant or NSIS scripts programmatically from Java code at runtime? If so, how?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You can call ant scripts from Java code.
See this article (scroll down to the “Running Ant via Java” section) and this article:
Update
I tried with the following ant file , it did not “tell” anything (no console output), but it worked: the file was indeed moved
And when I try it again (when there is no
test.txtto move(it is already moved)), I got anjava.io.FileNotFoundException.I think this is what you would expect when you run something from Java.
If you want the console output of the ant tasks, you might want to add a Logger as a build listener.
From @Perception’s answer below.