Omnipresent
Omnipresent

Reputation: 30404

how to run existing ant script from groovy

my build is a 3 step process. run ant to build. transfer war to server. touch reload file.

I have transfered last two steps in groovy, using antbuilder. However, I am not able to run my existing ant script using groovy.

Usually I run it using the following command in dos prompt:

ant -Dsystem=mysystem -DsomeotherOption=true

from groovy when I try to do

"ant -Dsystem=mysystem -DsomeotherOption=true".execute()

it gives an error saying ant is not a recognized command.

How can I utilize my existing ant script in groovy?

Upvotes: 3

Views: 2187

Answers (2)

stjohnroe
stjohnroe

Reputation: 3206

I found this while looking at a similar requirement, basically describes the process of using Ant's ProjectHelper and Project classes from Groovy. This way you do not need to translate the Ant build file to groovy style syntax.

Upvotes: 1

Sean A.O. Harney
Sean A.O. Harney

Reputation: 24497

Try and give the absolute path to the ant executable, e.g. C:\path\to\ant

You could also use Ant programmatically as shown in this User Guide: http://groovy.codehaus.org/Using+Ant+from+Groovy

Upvotes: 1

Related Questions