Resolving issue: MNG-493

o Changed getExecutionsAsMap() in Plugin (within maven.mdo) to throw an IllegalStateException if two PluginExecutions are detected with the same id. This method should always be called during inheritance assembly...

o Changed PluginExecution's id field to have a defaultValue of 'default' within maven.mdo.

NOTE: It may be necessary to double-check the id-collision within MavenProjectBuilder, in case there is no inheritance of plugins...I'll add this, and follow this commit momentarily.



git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@191620 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
John Dennis Casey 2005-06-21 03:57:17 +00:00
parent b61ca41b76
commit bea9eca2f6
6 changed files with 65 additions and 0 deletions

View File

@ -130,3 +130,7 @@ it1003: A build with a simple test failure.
-------------------------------------------------------------------------------
it1005: A build with two mojo java sources that declare the same goal.
-------------------------------------------------------------------------------
it1006: Tests collision on default execution id. Should throw an
IllegalStateException, since the model is incorrect.
-------------------------------------------------------------------------------

View File

@ -0,0 +1,2 @@
target/test.txt
target/test2.txt

View File

@ -0,0 +1 @@
process-sources

View File

@ -0,0 +1,35 @@
<model>
<modelVersion>4.0.0</modelVersion>
<groupId>org.apache.maven.</groupId>
<artifactId>maven-it0025</artifactId>
<version>1.0-SNAPSHOT</version>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-core-it-plugin</artifactId>
<version>1.0-SNAPSHOT</version>
<executions>
<execution>
<configuration>
<pluginItem>test.txt</pluginItem>
</configuration>
<goals>
<goal>touch</goal>
</goals>
</execution>
<execution>
<configuration>
<pluginItem>test2.txt</pluginItem>
</configuration>
<goals>
<goal>touch</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</model>

View File

@ -0,0 +1,16 @@
package org.apache.maven.it0023;
public class Person
{
private String name;
public void setName( String name )
{
this.name = name;
}
public String getName()
{
return name;
}
}

View File

@ -2162,6 +2162,12 @@
for ( Iterator i = getExecutions().iterator(); i.hasNext(); )
{
PluginExecution exec = (PluginExecution) i.next();
if ( executionMap.containsKey( exec.getId() ) )
{
throw new IllegalStateException( "You cannot have two plugin executions with the same (or missing) <id/> elements.\nOffending execution\n\nId: \'" + exec.getId() + "\'\nPlugin:\'" + getKey() + "\'\n\n" );
}
executionMap.put( exec.getId(), exec );
}
}
@ -2219,6 +2225,7 @@
<version>4.0.0</version>
<required>true</required>
<type>String</type>
<defaultValue>default</defaultValue>
</field>
<field>
<name>phase</name>