This week's book giveaway is in the Design forum.
We're giving away four copies of Building Microservices and have Sam Newman on-line!
See this thread for details.
The moose likes Ant, Maven and Other Build Tools and the fly likes passing commandline parameter to ant not working Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Building Microservices this week in the Design forum!
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Bookmark "passing commandline parameter to ant not working" Watch "passing commandline parameter to ant not working" New topic
Author

passing commandline parameter to ant not working

Padmanabh Sahasrabudhe
Ranch Hand

Joined: Mar 04, 2008
Posts: 53
I have following code to which I pass j.testcase parameter. Somehow the value I pass for j.testcase is not picked up by the target run. I pass the parameter as ant run -Dj.testcase=Test2. Any comments?

Jeanne Boyarsky
author & internet detective
Marshal

Joined: May 26, 2003
Posts: 32508
    
214

It works on my machine. -Dj.testcase=foo with the below code outputs "foo" and "match". Maybe you have a trailing space/period in your command line? Try adding an echo before the switch like I did to troubleshoot.



[OCA 8 book] [Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Other Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, TOGAF part 1 and part 2
 
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com
 
subject: passing commandline parameter to ant not working
 
It's not a secret anymore!