Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Maven : find out the phaze/goal at build-time.

 
Gaurav Upadhyay
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Greetings.

I was trying to look for a way for Maven to know which goal/plugin was it invoked with. So when i say "mvn install", the build runs, but is there a way to find out at build time that "install" was the command given to maven?

Like we have "os.name" to find out the operating system used, "java.version" to find out which java version was used, Do we have some kind of a similar property to find out which goal/plugin was used? Or maybe any other mechanism to know that?
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34973
379
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't know if you can. If that was available, my guess would be on MavenProject - but I don't see it there. What are you trying to accomplish? What are you trying to differently based on the command line. Maybe there is a better way - or a more Maven way.
 
Peter Johnson
author
Bartender
Posts: 5856
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The thing is, you can specify multiple goals on the command line. Do you want to know about all of them, or only about the current one that Maven is working on (Maven tackles the goals one at a time)? I suspect there is no plugin that provides that info, but you could probably write one.
 
Gaurav Upadhyay
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
oh okay, thanks.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic