maven 2 - How to get the name of goal in maven2's Mojo at runtime -
How do I get the name of the target that is currently executed in the execution method of mojo2? In short, I need the value of the fundamental property inside the method of Mojo.
public static string getGoalName PluginDescriptor plugin descriptor, string mosaicname) {string nameName = null; & Lt; MojoDescriptor & gt; MozodestrycriptList = PluginDescriptor.Gamojos (); (Mojo Descriptor Mojo Descriptor: Mojo Dyscriptor List) {if (mosaicScriptor.Get Implementation) .bab (MojoClassname)) {goalName = mojoDescriptor.getGoal (); break; }} Return nickname; } Here, PluginDescriptor can be obtained from PluginManager.getPluginDescriptorForPrefix ("prefix-for-your-plugin"). PluginManager is available as @component role = "org.apache.maven.plugin.PluginManager"
Comments
Post a Comment