Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
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;
Expand Down Expand Up @@ -330,4 +331,17 @@ public void testBuildProperties()
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() );
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>org.example</groupId>
<artifactId>parent</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>pom</packaging>

<properties>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

<codehaus.group.id>org.codehaus.mojo</codehaus.group.id>
</properties>

<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>${codehaus.group.id}</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>3.2.0</version>
<executions>
<execution>
<id>add-source-config</id>
<phase>generate-sources</phase>
<goals>
<goal>add-source</goal>
</goals>
<configuration>
<sources>
<source>.</source>
</sources>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</pluginManagement>
</build>
</project>
22 changes: 22 additions & 0 deletions maven-core/src/test/projects/project-builder/MNG-6983/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>org.example</groupId>
<artifactId>parent</artifactId>
<version>0.0.1-SNAPSHOT</version>
<relativePath>./parent-pom.xml</relativePath>
</parent>

<artifactId>child</artifactId>
<packaging>jar</packaging>

<build>
<plugins>
<plugin>
<groupId>${codehaus.group.id}</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
8 changes: 1 addition & 7 deletions maven-model/src/main/mdo/maven.mdo
Original file line number Diff line number Diff line change
Expand Up @@ -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 <code>groupId:artifactId</code>
*/
public String getKey()
{
if ( key == null )
{
key = constructKey( groupId, artifactId );
}
return key;
return constructKey( groupId, artifactId );
}

/**
Expand Down