File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Ant, Maven and Other Build Tools and the fly likes Maven : find out the phaze/goal at build-time. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Bookmark "Maven : find out the phaze/goal at build-time." Watch "Maven : find out the phaze/goal at build-time." New topic
Author

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

Gaurav Upadhyay
Greenhorn

Joined: Oct 11, 2012
Posts: 10
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
internet detective
Marshal

Joined: May 26, 2003
Posts: 29275
    
140

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.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5779
    
    7

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.


JBoss In Action
Gaurav Upadhyay
Greenhorn

Joined: Oct 11, 2012
Posts: 10
oh okay, thanks.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Maven : find out the phaze/goal at build-time.
 
Similar Threads
Need help in Starting with Maven
Simple MAVEN questions
could not find goal 'download' in plugin org.apache.maven.plugins
Maven installation and using in project without Internet conncetion
Richfaces + Spring + Maven Setup help