• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

passing the parameters and reading them in maven

 
John David
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 70
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 5852
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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!
 
Rodrigo Tomita
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic