Changing ant build script arguments?

I currently have a build script set up that can compile my programs however I have multiple programs in my project and do not wish to have a new build script for each of them or a very bloated script with a lot of repeated targets for each program.

Here is the build.xml contents: http://paste2.org/_IHD6UmMk
Here is the build.properties contents: http://paste2.org/_dXBtvZgn


I want to be able to have multiple different run configurations in IntelliJ that can each have different values for "main.class" and "output.basename" in build.properties.

I did a little research and from what I can understand, in the console commands for ant I can use -Dmain.class=foo.class to pass different parameters but I can't figure out how to do that for run configurations in IntelliJ.



Any help would be appreciated since currently I'm having to manually change build.properties and it's slowing down my work.
Thanks

3 comments
Comment actions Permalink

It's not possible to configure this in IntelliJ IDEA. However, what you can do instead is have multiple files or targets for each of your programs that all delegate to your main build script. For example:

<target name="MyProgram1">
  <ant antfile="mainbuild.xml">     <property name="main.class" value="MyMainClass"/>     <property name="output.basename" value="..."/>   </ant>
</target>
0
Comment actions Permalink

Fantastic! That's exactly what I need.

How would I do this for running another target in the same file rather than a seperate one?

0
Comment actions Permalink

You can use the <antcall> task for this purpose.


0

Please sign in to leave a comment.