1,105,344 Community Members

Ant question: getting values from the command line

Member Avatar
jon.kiparsky
Posting Virtuoso
1,837 posts since Jun 2010
Reputation Points: 326 [?]
Q&As Helped to Solve: 192 [?]
Skill Endorsements: 6 [?]
 
0
 

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)

Member Avatar
nezachem
Practically a Posting Shark
896 posts since Dec 2009
Reputation Points: 616 [?]
Q&As Helped to Solve: 197 [?]
Skill Endorsements: 0 [?]
 
0
 

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).

You
This article has been dead for over three months: Start a new discussion instead
Post:
Start New Discussion
View similar articles that have also been tagged: