I’m pretty sure this has been asked before but I can’t seem to find the correct answer after spending quite some time googling… 🙂
Anyway, in our build server, we have two (2) different versions of Grails and Java running; one is 1.3.3 with JDK 1.5 while the other is 1.3.6 with JDK 1.6. Now, when building/creating the WAR file for these 2 projects, we pretty much need to switch the environment variables for GRAILS_HOME and JAVA_HOME automatically via the ANT script… for which I am a total noob >.<
Consider:
...
<target name="clean">
...
</target>
<target name="war" depends="clean">
...
</target>
...
If I set the env’t variables at the time clean is being done, it will, of course, not be the same when war is run (I’ve tried using batch files and even if it worked, it was messy and not DRY… hence, I’m looking for alternatives).
Now, I’ve seen macrodef being tossed around a few forums but I can’t seem to get a clear sample on how to do it for this case. Any suggestions on what I can do or some pointers?
Any help would be appreciated.
Thanks much!
I have a similar use case and I’m also googling for the same. Till now I’ve got these, I will try these reaching office tomorrow.
Executing batch file.