Please note that I am AWARE of the fact that Maven2 is EOL, but I have no word on the choices made on the production side, so please stop telling me to switch to Maven3 as this is not answering this question in any ways.
Right now we are using Maven2 in our company, but for some reasons some of our components needs that we use Maven3.
The plugin I am working on is used by all the components (by being in the parent pom) and gives an error when run with the Maven3 components.
[ERROR] Failed to execute goal XXXX on project YYY: Unable to parse
configuration of mojo XXX for parameter project: Cannot find 'project' in class X.
"project" being declared as :
/**
* The Maven project.
*
* @since 2.0.2
* @parameter expression="${project}"
* @required
* @readonly
*/
private static MavenProject project;
And used as such (in Execute() ):
LOGGER.info("==> Running XXX plugin for projet='{}'.",
project.getArtifactId());
It was working like a charm in Maven2
As far as I understand, no parameters are given to the instance project of the object "MavenProject".
The question is why was the expression getting the right informations in the pom in Maven2 but not anymore in Maven3 ?
To add more informations and be more precise, here is the inherited profile from the super pom :
<profile>
<id>profileID</id>
<build>
<plugins>
<plugin>
<groupId>com.XXX</groupId>
<artifactId>maven-XXX-plugin</artifactId>
<executions>
<execution>
<phase>test-compile</phase>
<goals>
<goal>modelmanager</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
To me, this is not the root of any issue as nothing but phases and goals are provided here, but I still provide it for better understanding.
If that can help, there is no versions specified in the pom for the maven plugin "plugin".
The execution is done as such :
mvn [clean] [a phase] -PprofileID