This week's book giveaway is in the Mac OS forum.
We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line!
See this thread for details.
The moose likes Ant, Maven and Other Build Tools and the fly likes forcing build to run a target Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Bookmark "forcing build to run a target" Watch "forcing build to run a target" New topic
Author

forcing build to run a target

jay vas
Ranch Hand

Joined: Aug 30, 2005
Posts: 407
Hi guys,

How can I force ant to run a build target ? i.e.

i have a target called "compile-xyz"

and my current build tag sais :

<target name="build" depends="clean, resolve, compile, test, jar"/>

.....

can I simply add <target name="build" depends="clean, resolve, compile, test, jar,compile-xyz"/>

to the tag ? I assume not...

.....

Also, in general, I tend to have trouble with ant. I noticed the documentation is quite vast --- but that is not always a good sign. If anyone has a "practical" guide to ant which they believe is appropriate , let me know !

Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5836
    
    7

I don't understand the question. You can tell ant to run any target that you want. If you have a target called compile-xyz, then you can do:

ant target-xyz

If you want to do "build" and "compile-xyz" then you can run:

ant build compile-xyz

As far as docs go, try Ant in Action (http://www.manning.com/loughran/). I have the previous edition and it was worth every penny.


JBoss In Action
jay vas
Ranch Hand

Joined: Aug 30, 2005
Posts: 407
If I have target A that depends on target "b", how can I force target A to run target B?

In my case, my target A is literally : <target name="build" depends="clean, resolve, compile, test, jar"/>
I want target A to "do more".... How do I extend the target ?
Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5836
    
    7

Now I understand. Just add the additional target to the "depends" list, just like you mentioned in your original post (where you added compile-xyz to depends).
 
GeeCON Prague 2014
 
subject: forcing build to run a target