This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes Ant, Maven and Other Build Tools and the fly likes ant calling a target that depends on its parent target Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Bookmark "ant calling a target that depends on its parent target" Watch "ant calling a target that depends on its parent target" New topic
Author

ant calling a target that depends on its parent target

Micale Raj
Ranch Hand

Joined: Jul 01, 2009
Posts: 30

Hi All,

I want to do following task with ant


Here, my main target is target2 and it must call target1. But target1 should be able to run alone and it has some dependency on main target ( target1).
How to do this kind of task ?

Thanks !
Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5823
    
    7

I don't understand what you are asking for. The antcall you have will run the task1 target, but before it does that it will run the layout target. Are you saying that you don't want layout to run? Also, your text uses different names than your example build.xml, so that makes it even more confusing.


JBoss In Action
Micale Raj
Ranch Hand

Joined: Jul 01, 2009
Posts: 30

Peter Johnson wrote:I don't understand what you are asking for. The antcall you have will run the task1 target, but before it does that it will run the layout target. Are you saying that you don't want layout to run? Also, your text uses different names than your example build.xml, so that makes it even more confusing.


Sorry for the confusing text, It's like this,
In my project there's target called "layout".This "layout" task build the project. Everybody run that target to build the project. Now I have to add another target,
let's say it name is "test" and it must be run after "layout" task. Now "test" target has been put as antcall in the "layout" task.
The "test" target must be able to run alone, but before that project must be build ( calling "layout"). How could I achieve this kind of behavior.

Thanks for your reply.
Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5823
    
    7

This is what I would do. I would rename the existing "layout" target to "old-layout" (or perhaps something more descriptive) and then create a new target called "layout" that depends on the "old-layout" and which runs the unit tests.
Micale Raj
Ranch Hand

Joined: Jul 01, 2009
Posts: 30

Thank your very much for your reply . I think I can do the same as you suggested. Thanks for taking time to reply such a confusing problem
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: ant calling a target that depends on its parent target