o Completed manual wiring

git-svn-id: https://svn.apache.org/repos/asf/maven/maven-3/trunk@965431 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Benjamin Bentmann 2010-07-19 11:23:52 +00:00
parent 85ef559859
commit ce6ae6e8cf
4 changed files with 20 additions and 2 deletions

View File

@ -109,7 +109,7 @@ public class DefaultModelBuilderFactory
protected ProfileActivator[] newProfileActivators()
{
return new ProfileActivator[] { new JdkVersionProfileActivator(), new OperatingSystemProfileActivator(),
new PropertyProfileActivator(), new FileProfileActivator() };
new PropertyProfileActivator(), new FileProfileActivator().setPathTranslator( newPathTranslator() ) };
}
protected UrlNormalizer newUrlNormalizer()

View File

@ -48,6 +48,12 @@ public class FileProfileActivator
@Requirement
private PathTranslator pathTranslator;
public FileProfileActivator setPathTranslator( PathTranslator pathTranslator )
{
this.pathTranslator = pathTranslator;
return this;
}
public boolean isActive( Profile profile, ProfileActivationContext context, ModelProblemCollector problems )
{
Activation activation = profile.getActivation();

View File

@ -48,6 +48,7 @@ public class DefaultModelBuilderFactoryTest
ModelBuildingResult result = builder.build( request );
assertNotNull( result );
assertNotNull( result.getEffectiveModel() );
assertEquals( "activated", result.getEffectiveModel().getProperties().get( "profile.file" ) );
}
}

View File

@ -58,7 +58,7 @@ under the License.
<profiles>
<profile>
<id>test</id>
<id>default</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
@ -66,5 +66,16 @@ under the License.
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
</profile>
<profile>
<id>file</id>
<activation>
<file>
<exists>simple.xml</exists>
</file>
</activation>
<properties>
<profile.file>activated</profile.file>
</properties>
</profile>
</profiles>
</project>