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?
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.
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.