FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


Ant Build





mike_phi
Hi there I am using Apache Ant to build a Java project, and need a bit of help with regard to being able to use "if" statements from within the build.xml file.

Basically I have defined a few targets of which one of the targets does not get executed unless I pass in an argument, the argument passing from the command line works well using the <arg line= " -a "....

but the problem is I have other targets defined which are required to be compile even for the <arg line= " -a ".... compile option . and these other targeds have explicit <exclude> and <include> definitions and I want to chose to <exclude> a few of the <include> if the -a option is passed in



eg


<target name= A>
bla
bla
<include> drictry_c/*.java </include>
...

<target name = B dependon = A>

bla
bla
<arg line=" -a ">
...


what I would liek to do is have target A run as normal and include directory_c durin for normal invokation

$: ant A

and when I invoke ant with

$: ant -a B

(since it depends on A I want Ant to use Target A's definitions but instead of including it should exclude directory_c ) in cases tagret B or any other target is called with arg "-a"

any Ant Guru's willing to help me out

cheers
MrBlueSky
I think the easiest way is to add an extra task which is the same as A, but without the include(s):

Quote:

<target name= A>
...
<include> drictry_c/*.java </include>
...
<task1>
<task2>
</target>

<target name= C>
<task1>
<task2>
</target>

<target name = B dependon = C>
...
<arg line=" -a ">
...
</target>
mike_phi
Thanx for the responce, I figured that might be the path I would have to take, I gusee it will do for now untill i figure out a more elegant way.

cheers
Related topics
RSS and Ant alternatives doubts
If you Build it - They will come ...
want to build an ecommerce site
Is it possible, can you build your own laptop from scratch ?
Microsoft plans to build more Unix features into future vers
what do you do when your bored
Build Web Hosting Server Help!
Build your own NBA dream team
Trying to build a newsticker in FLASH
New Windows Vista Test Build Expected Next Week
Mexican president again attacks U.S. plans to build border f
Interesting Science Questions:
Macromedia Flash
If I were to build a computer...
Reply to topic    Frihost Forum Index -> Computers -> Software

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.