This week's giveaway is in the EJB and other Java EE Technologies forum.
We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line!
See this thread for details.
The moose likes Ant, Maven and Other Build Tools and the fly likes passing the parameters and reading them in maven Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Bookmark "passing the parameters and reading them in maven" Watch "passing the parameters and reading them in maven" New topic
Author

passing the parameters and reading them in maven

John David
Greenhorn

Joined: Aug 17, 2006
Posts: 29
Respected Folks,

i need to send some parameters through command line and i have to read the parameters.depending on that value i have to read specific folder ...

could you please help me out


regards
David
Rodrigo Tomita
Ranch Hand

Joined: Apr 28, 2008
Posts: 70
Originally posted by John David:

i need to send some parameters through command line and i have to read the parameters.


Hi,

What exactly do you mean by "I have to read the parameters" ? Are you developing a maven plug-in? If so, I don't think you can read parameters from the command line.

However, you can accept parameters defined in your pom.xml descriptor. That is relatively simple, you can refer to the Maven site. Basically you just need to create an attribute and annotate it following some conventions.

Hope it helps.
John David
Greenhorn

Joined: Aug 17, 2006
Posts: 29
Hi Rodrigo Tomita
Thanks a lot for your reply. but im not going to create or write a plug in. but im trying to read the command ine parameter and based on that parameter i have to compile specific folders only and rest of them shoud be discarded...

could you please help me out in this issue..

Regards
David
Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5772
    
    7

You can use the -D option to pass a system property. To see all of the mvn options, enter: mvn -?

As far as using that information to determine which folders to compile, you are on your own. I would tackle something like that in Ant before I would even attempt it in Maven!


JBoss In Action
Rodrigo Tomita
Ranch Hand

Joined: Apr 28, 2008
Posts: 70
Originally posted by Peter Johnson:
As far as using that information to determine which folders to compile, you are on your own.


I'm sorry but I agree with Peter... The best I can think of is organizing your code in a multi-module project (a parent pom and several modules, one for each portion of your code you want to compile separately).

That way you could control what will be built either with minimum parent pom.xml manipulation or by building the child modules in a shell script.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: passing the parameters and reading them in maven
 
Similar Threads
Parameter and Argument !
URL parameters in Struts
Pass Lots of Parameters to Methods
Method Parameters
Context Parameters