We're a community of 1077K IT Pros here for help, advice, solutions, professional growth and fun. Join us!
1,076,520 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Start New Discussion Reply to this Discussion

Ant question: getting values from the command line

I'm not very well up on ant, trying to learn a few things about it this afternoon.

Is it possible to read in values from the command-line ant call? The scenario I have in mind is this: I want to make a generic build file that would have targets for the basics (init, compile, clean, make_jar). I'd like to be able to do something like:

ant jarfile "Hello.jar" "Hello"

and use "Hello.jar" as the name of the generated jar file and "Hello" as the name of the main class in the manifest.

I don't see any way to do this in the ant documentation - the <arg> tag doesn't seem like much help here - but maybe I'm missing something. I can see how I'd do it with a properties file, but not from the command like. Any ideas, or is this impossible in ant?


(obviously I could write a quick bit of perl to configure the generic build file for each project, but I want to see what I can do with ant itself)

2
Contributors
1
Reply
22 Hours
Discussion Span
2 Years Ago
Last Updated
2
Views
jon.kiparsky
Posting Virtuoso
1,849 posts since Jun 2010
Reputation Points: 383
Solved Threads: 187
Skill Endorsements: 3

If I understand correctly what you are after, pass relevant properties as command line arguments. For example, -Dsrc=Hello (details really depend on your ant file).

nezachem
Posting Shark
913 posts since Dec 2009
Reputation Points: 719
Solved Threads: 197
Skill Endorsements: 0

This article has been dead for over three months: Start a new discussion instead

Post: Markdown Syntax: Formatting Help
 
You
View similar articles that have also been tagged:
 
© 2013 DaniWeb® LLC
Page rendered in 0.0536 seconds using 2.66MB