I am working on a maven plugin. I seem to have a hard time figuring out, what would be a good way to get POM information from project in which you execute the MOJO ?
For
You can inject the current maven project into your mojo with a field declared like this:
/**
* @parameter default-value="${project}"
* @required
* @readonly
*/
MavenProject project;
The projects name is then available by simply calling project.getName()
.
To use this API, you need to add the maven-project
artifact as a dependency:
org.apache.maven
maven-project
2.0.6