mirror of https://github.com/apache/maven.git
Resolving: MNG-1022...Adding TestProfileInjector to avoid injecting profiles for tests, and still guard against NPEs when profiles exist.
git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@291751 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
945af48359
commit
b1c59f6d19
|
@ -23,6 +23,7 @@ import org.apache.maven.project.AbstractMavenProjectTestCase;
|
|||
import org.codehaus.plexus.util.xml.Xpp3Dom;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
|
@ -53,11 +54,21 @@ public class CanonicalProjectBuilderTest
|
|||
|
||||
// Plugin0 [plexus]
|
||||
|
||||
Plugin plugin = (Plugin) plugins.get( 0 );
|
||||
String key = "org.apache.maven.plugins:maven-plexus-plugin";
|
||||
|
||||
assertEquals( "org.apache.maven.plugins", plugin.getGroupId() );
|
||||
Plugin plugin = null;
|
||||
for ( Iterator it = plugins.iterator(); it.hasNext(); )
|
||||
{
|
||||
Plugin check = (Plugin) it.next();
|
||||
|
||||
assertEquals( "maven-plexus-plugin", plugin.getArtifactId() );
|
||||
if ( key.equals( check.getKey() ) )
|
||||
{
|
||||
plugin = check;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
assertNotNull( plugin );
|
||||
|
||||
assertEquals( "1.0", plugin.getVersion() );
|
||||
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
package org.apache.maven.project.injection;
|
||||
|
||||
import org.apache.maven.model.Model;
|
||||
import org.apache.maven.model.Profile;
|
||||
|
||||
public class TestProfileInjector
|
||||
implements ProfileInjector
|
||||
{
|
||||
|
||||
public void inject( Profile profile, Model model )
|
||||
{
|
||||
// do nothing.
|
||||
}
|
||||
|
||||
}
|
|
@ -14,6 +14,11 @@
|
|||
</requirements>
|
||||
</component>
|
||||
-->
|
||||
<component>
|
||||
<role>org.apache.maven.project.injection.ProfileInjector</role>
|
||||
<role-hint>test</role-hint>
|
||||
<implementation>org.apache.maven.project.injection.TestProfileInjector</implementation>
|
||||
</component>
|
||||
<component>
|
||||
<role>org.apache.maven.project.TestArtifactResolver</role>
|
||||
<implementation>org.apache.maven.project.TestArtifactResolver</implementation>
|
||||
|
@ -43,6 +48,10 @@
|
|||
<requirement>
|
||||
<role>org.apache.maven.project.injection.ModelDefaultsInjector</role>
|
||||
</requirement>
|
||||
<requirement>
|
||||
<role>org.apache.maven.project.injection.ProfileInjector</role>
|
||||
<role-hint>test</role-hint>
|
||||
</requirement>
|
||||
<requirement>
|
||||
<role>org.apache.maven.project.interpolation.ModelInterpolator</role>
|
||||
</requirement>
|
||||
|
|
|
@ -0,0 +1,79 @@
|
|||
<plexus>
|
||||
<components>
|
||||
<!-- Due to PLX-108, have to work around it...
|
||||
<component>
|
||||
<role>org.apache.maven.artifact.ArtifactResolver</role>
|
||||
<implementation>org.apache.maven.project.TestArtifactResolvertion>
|
||||
<requirements>
|
||||
<requirement>
|
||||
<role>org.apache.maven.artifact.manager.WagonManager</role>
|
||||
</requirement>
|
||||
<requirement>
|
||||
<role>org.apache.maven.artifact.factory.ArtifactFactory</role>
|
||||
</requirement>
|
||||
</requirements>
|
||||
</component>
|
||||
-->
|
||||
<component>
|
||||
<role>org.apache.maven.project.injection.ProfileInjector</role>
|
||||
<role-hint>test</role-hint>
|
||||
<implementation>org.apache.maven.project.injection.TestProfileInjector</implementation>
|
||||
</component>
|
||||
<component>
|
||||
<role>org.apache.maven.project.TestArtifactResolver</role>
|
||||
<implementation>org.apache.maven.project.TestArtifactResolver</implementation>
|
||||
<requirements>
|
||||
<requirement>
|
||||
<role>org.apache.maven.artifact.manager.WagonManager</role>
|
||||
</requirement>
|
||||
<requirement>
|
||||
<role>org.apache.maven.artifact.factory.ArtifactFactory</role>
|
||||
</requirement>
|
||||
<requirement>
|
||||
<role>org.apache.maven.artifact.repository.ArtifactRepositoryFactory</role>
|
||||
</requirement>
|
||||
<requirement>
|
||||
<role>org.apache.maven.artifact.resolver.ArtifactCollector</role>
|
||||
</requirement>
|
||||
</requirements>
|
||||
</component>
|
||||
<component>
|
||||
<role>org.apache.maven.project.MavenProjectBuilder</role>
|
||||
<role-hint>test</role-hint>
|
||||
<implementation>org.apache.maven.project.TestProjectBuilder</implementation>
|
||||
<requirements>
|
||||
<requirement>
|
||||
<role>org.apache.maven.profiles.MavenProfilesBuilder</role>
|
||||
</requirement>
|
||||
<requirement>
|
||||
<role>org.apache.maven.project.injection.ModelDefaultsInjector</role>
|
||||
</requirement>
|
||||
<requirement>
|
||||
<role>org.apache.maven.project.injection.ProfileInjector</role>
|
||||
<role-hint>test</role-hint>
|
||||
</requirement>
|
||||
<requirement>
|
||||
<role>org.apache.maven.project.interpolation.ModelInterpolator</role>
|
||||
</requirement>
|
||||
<requirement>
|
||||
<role>org.apache.maven.project.inheritance.ModelInheritanceAssembler</role>
|
||||
</requirement>
|
||||
<requirement>
|
||||
<role>org.apache.maven.project.validation.ModelValidator</role>
|
||||
</requirement>
|
||||
<requirement>
|
||||
<role>org.apache.maven.project.path.PathTranslator</role>
|
||||
</requirement>
|
||||
<requirement>
|
||||
<role>org.apache.maven.artifact.factory.ArtifactFactory</role>
|
||||
</requirement>
|
||||
<requirement>
|
||||
<role>org.apache.maven.artifact.resolver.ArtifactResolver</role>
|
||||
</requirement>
|
||||
<requirement>
|
||||
<role>org.apache.maven.artifact.repository.ArtifactRepositoryFactory</role>
|
||||
</requirement>
|
||||
</requirements>
|
||||
</component>
|
||||
</components>
|
||||
</plexus>
|
Loading…
Reference in New Issue