diff --git a/maven-core/src/test/java/org/apache/maven/project/ProjectBuilderTest.java b/maven-core/src/test/java/org/apache/maven/project/ProjectBuilderTest.java index 4833b00351..644f6d1eb8 100644 --- a/maven-core/src/test/java/org/apache/maven/project/ProjectBuilderTest.java +++ b/maven-core/src/test/java/org/apache/maven/project/ProjectBuilderTest.java @@ -34,6 +34,7 @@ import java.util.Properties; import org.apache.maven.AbstractCoreMavenComponentTestCase; import org.apache.maven.artifact.InvalidArtifactRTException; import org.apache.maven.execution.MavenSession; +import org.apache.maven.model.Plugin; import org.apache.maven.model.building.FileModelSource; import org.apache.maven.model.building.ModelBuildingRequest; import org.apache.maven.model.building.ModelSource; @@ -328,4 +329,17 @@ public class ProjectBuilderTest assertEquals( 1, project.getMailingLists().size() ); assertEquals( 1, project.getResources().size() ); } + + public void testPropertyInPluginManagementGroupId() + throws Exception + { + File pom = getProject( "MNG-6983" ); + + MavenSession session = createMavenSession( pom ); + MavenProject project = session.getCurrentProject(); + + for (Plugin buildPlugin : project.getBuildPlugins()) { + assertNotNull( "Missing version for build plugin " + buildPlugin.getKey(), buildPlugin.getVersion() ); + } + } } diff --git a/maven-core/src/test/projects/project-builder/MNG-6983/parent-pom.xml b/maven-core/src/test/projects/project-builder/MNG-6983/parent-pom.xml new file mode 100644 index 0000000000..3aed9678e5 --- /dev/null +++ b/maven-core/src/test/projects/project-builder/MNG-6983/parent-pom.xml @@ -0,0 +1,38 @@ + + 4.0.0 + + org.example + parent + 0.0.1-SNAPSHOT + pom + + + org.codehaus.mojo + + + + + + + ${codehaus.groupId} + build-helper-maven-plugin + 3.2.0 + + + add-source-config + generate-sources + + add-source + + + + . + + + + + + + + + diff --git a/maven-core/src/test/projects/project-builder/MNG-6983/pom.xml b/maven-core/src/test/projects/project-builder/MNG-6983/pom.xml new file mode 100644 index 0000000000..648f7fc9e9 --- /dev/null +++ b/maven-core/src/test/projects/project-builder/MNG-6983/pom.xml @@ -0,0 +1,22 @@ + + 4.0.0 + + + org.example + parent + 0.0.1-SNAPSHOT + ./parent-pom.xml + + + child + jar + + + + + ${codehaus.groupId} + build-helper-maven-plugin + + + + diff --git a/maven-model/src/main/mdo/maven.mdo b/maven-model/src/main/mdo/maven.mdo index 1f1f9d1864..7f439faa9f 100644 --- a/maven-model/src/main/mdo/maven.mdo +++ b/maven-model/src/main/mdo/maven.mdo @@ -2314,18 +2314,12 @@ return id.toString(); } - //TODO we shall reset key variable when groupId/artifactId change - private String key = null; /** * @return the key of the plugin, ie groupId:artifactId */ public String getKey() { - if ( key == null ) - { - key = constructKey( groupId, artifactId ); - } - return key; + return constructKey( groupId, artifactId ); } /**