• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

ANT: calling a target from another build file

 
Jeevan Reddy
Ranch Hand
Posts: 142
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I have two ANT build files say A and B.
I want to call one of B's targets from A. I am using <ant> task to do it. But during this I have to add a directory to B's path. How can I do it?

Please tell me how to do it.

Thanks,
Janardhan.

 
Peter Johnson
author
Bartender
Posts: 5852
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I must be missing something. For the <ant> task you set 'antfile' to "B" and 'dir' to the directory where 'B' is located. I am not sure what it is that you do not know how to do???
 
Jeevan Reddy
Ranch Hand
Posts: 142
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Peter Johnson wrote:I must be missing something. For the <ant> task you set 'antfile' to "B" and 'dir' to the directory where 'B' is located. I am not sure what it is that you do not know how to do???


Peter, you are correct. I only need to change the path parameter for "B".

Here is the problem, hope I can make clearer this time.

build file "A" takes java from the environment
build file "B" takes java from the environment

"A" should use java1.6 and "B" should use java1.5. Please tell how to achieve this.

 
Peter Johnson
author
Bartender
Posts: 5852
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
OK, that is a completly different question than what you asked originally.

You cannot use the <ant> task to do what you want to do. You will have to use the <exec> instead and run another copy of Ant. I recommend writing a script that invokes Ant with the other JVM and calling that script.

Or you can use the <java> task, though setting up the proper environment for Ant might be a pain (you will have to dig through the ant run script to see what all it does and mimic that).

But before you do any of that, tell me why you need to run script B with the 1.5 JVM.
 
Jeevan Reddy
Ranch Hand
Posts: 142
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think I will follow your first suggestion to write a script and invoke ant build file in that script.
 
Peter Johnson
author
Bartender
Posts: 5852
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please read this again and act on it:

But before you do any of that, tell me why you need to run script B with the 1.5 JVM.


Depending on your answer, I could save you a lot of time and effort, and simplify your build process too.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic