mirror of https://github.com/apache/maven.git
Fixing problem with new extensions manager code where custom lifecycle definitions are not used in build planning. Unit tests included.
git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@600792 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
f55eb07bda
commit
1db3b755ab
|
@ -26,6 +26,7 @@ under the License.
|
||||||
<groupId>org.apache.maven</groupId>
|
<groupId>org.apache.maven</groupId>
|
||||||
<version>2.1-SNAPSHOT</version>
|
<version>2.1-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<artifactId>maven-core</artifactId>
|
<artifactId>maven-core</artifactId>
|
||||||
<name>Maven Core</name>
|
<name>Maven Core</name>
|
||||||
|
|
|
@ -21,9 +21,14 @@ import org.apache.maven.plugin.loader.PluginLoader;
|
||||||
import org.apache.maven.plugin.loader.PluginLoaderException;
|
import org.apache.maven.plugin.loader.PluginLoaderException;
|
||||||
import org.apache.maven.project.MavenProject;
|
import org.apache.maven.project.MavenProject;
|
||||||
import org.apache.maven.reporting.MavenReport;
|
import org.apache.maven.reporting.MavenReport;
|
||||||
|
import org.codehaus.plexus.PlexusConstants;
|
||||||
|
import org.codehaus.plexus.PlexusContainer;
|
||||||
import org.codehaus.plexus.classworlds.realm.ClassRealm;
|
import org.codehaus.plexus.classworlds.realm.ClassRealm;
|
||||||
|
import org.codehaus.plexus.context.Context;
|
||||||
|
import org.codehaus.plexus.context.ContextException;
|
||||||
import org.codehaus.plexus.logging.LogEnabled;
|
import org.codehaus.plexus.logging.LogEnabled;
|
||||||
import org.codehaus.plexus.logging.Logger;
|
import org.codehaus.plexus.logging.Logger;
|
||||||
|
import org.codehaus.plexus.personality.plexus.lifecycle.phase.Contextualizable;
|
||||||
import org.codehaus.plexus.util.xml.Xpp3Dom;
|
import org.codehaus.plexus.util.xml.Xpp3Dom;
|
||||||
import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
|
import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
|
||||||
|
|
||||||
|
@ -43,7 +48,7 @@ import java.util.StringTokenizer;
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class DefaultLifecycleBindingManager
|
public class DefaultLifecycleBindingManager
|
||||||
implements LifecycleBindingManager, LogEnabled
|
implements LifecycleBindingManager, LogEnabled, Contextualizable
|
||||||
{
|
{
|
||||||
private Map bindingsByPackaging;
|
private Map bindingsByPackaging;
|
||||||
|
|
||||||
|
@ -63,31 +68,45 @@ public class DefaultLifecycleBindingManager
|
||||||
// configured. Moved out of DefaultLifecycleExecutor...
|
// configured. Moved out of DefaultLifecycleExecutor...
|
||||||
private List defaultReports;
|
private List defaultReports;
|
||||||
|
|
||||||
|
// contextualized, used for setting lookup realm before retrieving lifecycle bindings for packaging.
|
||||||
|
private PlexusContainer container;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieve the LifecycleBindings given by the lifecycle mapping component/file for the project's packaging. Any
|
* Retrieve the LifecycleBindings given by the lifecycle mapping component/file for the project's packaging. Any
|
||||||
* applicable mojo configuration will be injected into the LifecycleBindings from the POM.
|
* applicable mojo configuration will be injected into the LifecycleBindings from the POM.
|
||||||
*/
|
*/
|
||||||
public LifecycleBindings getBindingsForPackaging( final MavenProject project )
|
public LifecycleBindings getBindingsForPackaging( final MavenProject project, final MavenSession session )
|
||||||
throws LifecycleLoaderException, LifecycleSpecificationException
|
throws LifecycleLoaderException, LifecycleSpecificationException
|
||||||
{
|
{
|
||||||
String packaging = project.getPackaging();
|
String packaging = project.getPackaging();
|
||||||
|
|
||||||
LifecycleBindings bindings = null;
|
LifecycleBindings bindings = null;
|
||||||
|
|
||||||
LifecycleBindingLoader loader = (LifecycleBindingLoader) bindingsByPackaging.get( packaging );
|
ClassRealm projectRealm = session.getRealmManager().getProjectRealm( project.getGroupId(), project.getArtifactId(), project.getVersion() );
|
||||||
if ( loader != null )
|
|
||||||
{
|
|
||||||
bindings = loader.getBindings();
|
|
||||||
}
|
|
||||||
|
|
||||||
// TODO: Remove this once we no longer have to support legacy-style lifecycle mappings
|
ClassRealm oldRealm = container.setLookupRealm( projectRealm );
|
||||||
if ( bindings == null )
|
|
||||||
|
try
|
||||||
{
|
{
|
||||||
LifecycleMapping mapping = (LifecycleMapping) legacyMappingsByPackaging.get( packaging );
|
LifecycleBindingLoader loader = (LifecycleBindingLoader) bindingsByPackaging.get( packaging );
|
||||||
if ( mapping != null )
|
if ( loader != null )
|
||||||
{
|
{
|
||||||
bindings = legacyLifecycleMappingParser.parseMappings( mapping, packaging );
|
bindings = loader.getBindings();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: Remove this once we no longer have to support legacy-style lifecycle mappings
|
||||||
|
if ( bindings == null )
|
||||||
|
{
|
||||||
|
LifecycleMapping mapping = (LifecycleMapping) legacyMappingsByPackaging.get( packaging );
|
||||||
|
if ( mapping != null )
|
||||||
|
{
|
||||||
|
bindings = legacyLifecycleMappingParser.parseMappings( mapping, packaging );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
container.setLookupRealm( oldRealm );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( bindings != null )
|
if ( bindings != null )
|
||||||
|
@ -582,4 +601,10 @@ public class DefaultLifecycleBindingManager
|
||||||
return reportClass.isAssignableFrom( mojoClass );
|
return reportClass.isAssignableFrom( mojoClass );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void contextualize( Context ctx )
|
||||||
|
throws ContextException
|
||||||
|
{
|
||||||
|
container = (PlexusContainer) ctx.get( PlexusConstants.PLEXUS_KEY );
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,8 +31,9 @@ public interface LifecycleBindingManager
|
||||||
/**
|
/**
|
||||||
* Retrieve the LifecycleBindings given by the lifecycle mapping component/file for the project's packaging. Any
|
* Retrieve the LifecycleBindings given by the lifecycle mapping component/file for the project's packaging. Any
|
||||||
* applicable mojo configuration will be injected into the LifecycleBindings from the POM.
|
* applicable mojo configuration will be injected into the LifecycleBindings from the POM.
|
||||||
|
* @param session
|
||||||
*/
|
*/
|
||||||
LifecycleBindings getBindingsForPackaging( MavenProject project )
|
LifecycleBindings getBindingsForPackaging( MavenProject project, MavenSession session )
|
||||||
throws LifecycleLoaderException, LifecycleSpecificationException;
|
throws LifecycleLoaderException, LifecycleSpecificationException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -51,7 +51,7 @@ public class DefaultBuildPlanner
|
||||||
throws LifecycleLoaderException, LifecycleSpecificationException, LifecyclePlannerException
|
throws LifecycleLoaderException, LifecycleSpecificationException, LifecyclePlannerException
|
||||||
{
|
{
|
||||||
LifecycleBindings defaultBindings = lifecycleBindingManager.getDefaultBindings( project );
|
LifecycleBindings defaultBindings = lifecycleBindingManager.getDefaultBindings( project );
|
||||||
LifecycleBindings packagingBindings = lifecycleBindingManager.getBindingsForPackaging( project );
|
LifecycleBindings packagingBindings = lifecycleBindingManager.getBindingsForPackaging( project, session );
|
||||||
LifecycleBindings projectBindings = lifecycleBindingManager.getProjectCustomBindings( project, session );
|
LifecycleBindings projectBindings = lifecycleBindingManager.getProjectCustomBindings( project, session );
|
||||||
|
|
||||||
BuildPlan plan = new BuildPlan( packagingBindings, projectBindings, defaultBindings, tasks );
|
BuildPlan plan = new BuildPlan( packagingBindings, projectBindings, defaultBindings, tasks );
|
||||||
|
|
|
@ -3,7 +3,6 @@ package org.apache.maven.execution;
|
||||||
import org.apache.maven.artifact.Artifact;
|
import org.apache.maven.artifact.Artifact;
|
||||||
import org.apache.maven.artifact.factory.ArtifactFactory;
|
import org.apache.maven.artifact.factory.ArtifactFactory;
|
||||||
import org.codehaus.plexus.PlexusTestCase;
|
import org.codehaus.plexus.PlexusTestCase;
|
||||||
import org.codehaus.plexus.component.repository.exception.ComponentLookupException;
|
|
||||||
import org.codehaus.plexus.logging.Logger;
|
import org.codehaus.plexus.logging.Logger;
|
||||||
import org.codehaus.plexus.logging.console.ConsoleLogger;
|
import org.codehaus.plexus.logging.console.ConsoleLogger;
|
||||||
|
|
||||||
|
@ -25,7 +24,7 @@ public class DefaultMavenRealmManagerTest
|
||||||
}
|
}
|
||||||
|
|
||||||
public void test_ReuseSingleExtensionRealmFromMultipleProjectRealms_UsingTwoManagerInstances()
|
public void test_ReuseSingleExtensionRealmFromMultipleProjectRealms_UsingTwoManagerInstances()
|
||||||
throws RealmManagementException, ComponentLookupException
|
throws Exception
|
||||||
{
|
{
|
||||||
ClassLoader cloader = Thread.currentThread().getContextClassLoader();
|
ClassLoader cloader = Thread.currentThread().getContextClassLoader();
|
||||||
URL jarResource = cloader.getResource( "org/apache/maven/execution/test-extension-1.jar" );
|
URL jarResource = cloader.getResource( "org/apache/maven/execution/test-extension-1.jar" );
|
||||||
|
|
|
@ -86,7 +86,7 @@ public class DefaultExtensionManagerTest
|
||||||
|
|
||||||
if ( f.exists() )
|
if ( f.exists() )
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
FileUtils.forceDelete( f );
|
FileUtils.forceDelete( f );
|
||||||
}
|
}
|
||||||
|
@ -207,6 +207,7 @@ public class DefaultExtensionManagerTest
|
||||||
}
|
}
|
||||||
|
|
||||||
private ExtensionManager newDefaultExtensionManager()
|
private ExtensionManager newDefaultExtensionManager()
|
||||||
|
throws Exception
|
||||||
{
|
{
|
||||||
DefaultExtensionManager mgr = new DefaultExtensionManager( factory, resolver,
|
DefaultExtensionManager mgr = new DefaultExtensionManager( factory, resolver,
|
||||||
metadataSource, container,
|
metadataSource, container,
|
||||||
|
|
|
@ -1,29 +1,45 @@
|
||||||
package org.apache.maven.lifecycle.binding;
|
package org.apache.maven.lifecycle.binding;
|
||||||
|
|
||||||
|
import org.apache.maven.artifact.Artifact;
|
||||||
|
import org.apache.maven.execution.DefaultMavenExecutionRequest;
|
||||||
|
import org.apache.maven.execution.DefaultMavenRealmManager;
|
||||||
|
import org.apache.maven.execution.MavenExecutionRequest;
|
||||||
|
import org.apache.maven.execution.MavenRealmManager;
|
||||||
|
import org.apache.maven.execution.MavenSession;
|
||||||
import org.apache.maven.lifecycle.LifecycleLoaderException;
|
import org.apache.maven.lifecycle.LifecycleLoaderException;
|
||||||
import org.apache.maven.lifecycle.LifecycleSpecificationException;
|
import org.apache.maven.lifecycle.LifecycleSpecificationException;
|
||||||
|
import org.apache.maven.lifecycle.model.BuildBinding;
|
||||||
import org.apache.maven.lifecycle.model.LifecycleBindings;
|
import org.apache.maven.lifecycle.model.LifecycleBindings;
|
||||||
import org.apache.maven.lifecycle.model.MojoBinding;
|
import org.apache.maven.lifecycle.model.MojoBinding;
|
||||||
|
import org.apache.maven.lifecycle.model.Phase;
|
||||||
import org.apache.maven.model.Build;
|
import org.apache.maven.model.Build;
|
||||||
import org.apache.maven.model.Model;
|
import org.apache.maven.model.Model;
|
||||||
import org.apache.maven.model.Plugin;
|
import org.apache.maven.model.Plugin;
|
||||||
import org.apache.maven.model.PluginExecution;
|
import org.apache.maven.model.PluginExecution;
|
||||||
import org.apache.maven.model.PluginManagement;
|
import org.apache.maven.model.PluginManagement;
|
||||||
import org.apache.maven.project.MavenProject;
|
import org.apache.maven.project.MavenProject;
|
||||||
|
import org.apache.maven.shared.tools.easymock.MockManager;
|
||||||
import org.codehaus.plexus.PlexusTestCase;
|
import org.codehaus.plexus.PlexusTestCase;
|
||||||
|
import org.codehaus.plexus.logging.Logger;
|
||||||
|
import org.codehaus.plexus.logging.console.ConsoleLogger;
|
||||||
import org.codehaus.plexus.util.xml.Xpp3Dom;
|
import org.codehaus.plexus.util.xml.Xpp3Dom;
|
||||||
|
import org.easymock.MockControl;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.net.URL;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
|
|
||||||
public class DefaultLifecycleBindingManagerTest extends PlexusTestCase
|
public class DefaultLifecycleBindingManagerTest
|
||||||
|
extends PlexusTestCase
|
||||||
{
|
{
|
||||||
|
|
||||||
private LifecycleBindingManager mgr;
|
private LifecycleBindingManager mgr;
|
||||||
|
|
||||||
public void setUp() throws Exception
|
public void setUp()
|
||||||
|
throws Exception
|
||||||
{
|
{
|
||||||
super.setUp();
|
super.setUp();
|
||||||
|
|
||||||
|
@ -36,7 +52,7 @@ public class DefaultLifecycleBindingManagerTest extends PlexusTestCase
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testGetBindingsForPackaging_TestMergePluginConfigToBinding()
|
public void testGetBindingsForPackaging_TestMergePluginConfigToBinding()
|
||||||
throws LifecycleLoaderException, LifecycleSpecificationException
|
throws Exception
|
||||||
{
|
{
|
||||||
Model model = new Model();
|
Model model = new Model();
|
||||||
model.setGroupId( "group" );
|
model.setGroupId( "group" );
|
||||||
|
@ -61,7 +77,19 @@ public class DefaultLifecycleBindingManagerTest extends PlexusTestCase
|
||||||
|
|
||||||
MavenProject project = new MavenProject( model );
|
MavenProject project = new MavenProject( model );
|
||||||
|
|
||||||
LifecycleBindings lifecycleBindings = mgr.getBindingsForPackaging( project );
|
MavenRealmManager realmManager = new DefaultMavenRealmManager(
|
||||||
|
getContainer(),
|
||||||
|
new ConsoleLogger(
|
||||||
|
Logger.LEVEL_DEBUG,
|
||||||
|
"test" ) );
|
||||||
|
MavenExecutionRequest request = new DefaultMavenExecutionRequest().setRealmManager( realmManager );
|
||||||
|
|
||||||
|
LifecycleBindings lifecycleBindings = mgr.getBindingsForPackaging( project,
|
||||||
|
new MavenSession(
|
||||||
|
getContainer(),
|
||||||
|
request,
|
||||||
|
null,
|
||||||
|
null ) );
|
||||||
|
|
||||||
List bindings = lifecycleBindings.getBuildBinding().getCompile().getBindings();
|
List bindings = lifecycleBindings.getBuildBinding().getCompile().getBindings();
|
||||||
|
|
||||||
|
@ -79,7 +107,7 @@ public class DefaultLifecycleBindingManagerTest extends PlexusTestCase
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testGetBindingsForPackaging_TestMergePluginManagementConfigToBinding()
|
public void testGetBindingsForPackaging_TestMergePluginManagementConfigToBinding()
|
||||||
throws LifecycleLoaderException, LifecycleSpecificationException
|
throws Exception
|
||||||
{
|
{
|
||||||
Model model = new Model();
|
Model model = new Model();
|
||||||
model.setGroupId( "group" );
|
model.setGroupId( "group" );
|
||||||
|
@ -107,7 +135,19 @@ public class DefaultLifecycleBindingManagerTest extends PlexusTestCase
|
||||||
|
|
||||||
MavenProject project = new MavenProject( model );
|
MavenProject project = new MavenProject( model );
|
||||||
|
|
||||||
LifecycleBindings lifecycleBindings = mgr.getBindingsForPackaging( project );
|
MavenRealmManager realmManager = new DefaultMavenRealmManager(
|
||||||
|
getContainer(),
|
||||||
|
new ConsoleLogger(
|
||||||
|
Logger.LEVEL_DEBUG,
|
||||||
|
"test" ) );
|
||||||
|
MavenExecutionRequest request = new DefaultMavenExecutionRequest().setRealmManager( realmManager );
|
||||||
|
|
||||||
|
LifecycleBindings lifecycleBindings = mgr.getBindingsForPackaging( project,
|
||||||
|
new MavenSession(
|
||||||
|
getContainer(),
|
||||||
|
request,
|
||||||
|
null,
|
||||||
|
null ) );
|
||||||
|
|
||||||
List bindings = lifecycleBindings.getBuildBinding().getCompile().getBindings();
|
List bindings = lifecycleBindings.getBuildBinding().getCompile().getBindings();
|
||||||
|
|
||||||
|
@ -178,6 +218,86 @@ public class DefaultLifecycleBindingManagerTest extends PlexusTestCase
|
||||||
assertEquals( "other-value", config.getChild( "test2" ).getValue() );
|
assertEquals( "other-value", config.getChild( "test2" ).getValue() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void test_GetBindingsForPackaging_CustomLifecycleIsUsedFromRealmManager()
|
||||||
|
throws Exception
|
||||||
|
{
|
||||||
|
Model model = new Model();
|
||||||
|
|
||||||
|
model.setPackaging( "test" );
|
||||||
|
|
||||||
|
MavenProject project = new MavenProject( model );
|
||||||
|
|
||||||
|
MavenRealmManager realmManager = new DefaultMavenRealmManager(
|
||||||
|
getContainer(),
|
||||||
|
new ConsoleLogger(
|
||||||
|
Logger.LEVEL_DEBUG,
|
||||||
|
"test" ) );
|
||||||
|
|
||||||
|
MockManager mockManager = new MockManager();
|
||||||
|
|
||||||
|
MockControl extArtifactCtl = MockControl.createControl( Artifact.class );
|
||||||
|
mockManager.add( extArtifactCtl );
|
||||||
|
|
||||||
|
Artifact extensionArtifact = (Artifact) extArtifactCtl.getMock();
|
||||||
|
|
||||||
|
extensionArtifact.getGroupId();
|
||||||
|
extArtifactCtl.setReturnValue( "group", MockControl.ZERO_OR_MORE );
|
||||||
|
|
||||||
|
extensionArtifact.getArtifactId();
|
||||||
|
extArtifactCtl.setReturnValue( "artifact", MockControl.ZERO_OR_MORE );
|
||||||
|
|
||||||
|
extensionArtifact.getVersion();
|
||||||
|
extArtifactCtl.setReturnValue( "1", MockControl.ZERO_OR_MORE );
|
||||||
|
|
||||||
|
extensionArtifact.getFile();
|
||||||
|
extArtifactCtl.setReturnValue( getResourceFile( "org/apache/maven/lifecycle/plan/test-custom-lifecycle-buildPlan-1.jar" ),
|
||||||
|
MockControl.ZERO_OR_MORE );
|
||||||
|
|
||||||
|
mockManager.replayAll();
|
||||||
|
|
||||||
|
realmManager.createExtensionRealm( extensionArtifact, Collections.EMPTY_SET );
|
||||||
|
realmManager.importExtensionsIntoProjectRealm( "group", "project", "1", extensionArtifact );
|
||||||
|
|
||||||
|
MavenExecutionRequest request = new DefaultMavenExecutionRequest().setRealmManager( realmManager );
|
||||||
|
|
||||||
|
MavenSession session = new MavenSession( getContainer(), request, null, null );
|
||||||
|
|
||||||
|
LifecycleBindings lifecycleBindings = mgr.getBindingsForPackaging( project, session );
|
||||||
|
|
||||||
|
BuildBinding buildBinding = lifecycleBindings.getBuildBinding();
|
||||||
|
assertNotNull( buildBinding );
|
||||||
|
|
||||||
|
Phase installPhase = buildBinding.getInstall();
|
||||||
|
Phase deployPhase = buildBinding.getDeploy();
|
||||||
|
Phase packagePhase = buildBinding.getCreatePackage();
|
||||||
|
|
||||||
|
assertTrue( ( packagePhase.getBindings() == null ) || packagePhase.getBindings().isEmpty() );
|
||||||
|
assertNotNull( installPhase.getBindings() );
|
||||||
|
assertEquals( 1, installPhase.getBindings().size() );
|
||||||
|
assertEquals( "maven-deploy-plugin",
|
||||||
|
( (MojoBinding) installPhase.getBindings().get( 0 ) ).getArtifactId() );
|
||||||
|
|
||||||
|
assertNotNull( deployPhase.getBindings() );
|
||||||
|
assertEquals( 1, deployPhase.getBindings().size() );
|
||||||
|
assertEquals( "maven-install-plugin",
|
||||||
|
( (MojoBinding) deployPhase.getBindings().get( 0 ) ).getArtifactId() );
|
||||||
|
|
||||||
|
mockManager.verifyAll();
|
||||||
|
}
|
||||||
|
|
||||||
|
private File getResourceFile( String path )
|
||||||
|
{
|
||||||
|
ClassLoader cloader = Thread.currentThread().getContextClassLoader();
|
||||||
|
URL resource = cloader.getResource( path );
|
||||||
|
|
||||||
|
if ( resource == null )
|
||||||
|
{
|
||||||
|
fail( "Cannot find test resource: " + path );
|
||||||
|
}
|
||||||
|
|
||||||
|
return new File( resource.getPath() );
|
||||||
|
}
|
||||||
|
|
||||||
private Object createConfiguration( final Properties configProperties )
|
private Object createConfiguration( final Properties configProperties )
|
||||||
{
|
{
|
||||||
Xpp3Dom config = new Xpp3Dom( "configuration" );
|
Xpp3Dom config = new Xpp3Dom( "configuration" );
|
||||||
|
|
|
@ -1,8 +1,11 @@
|
||||||
package org.apache.maven.lifecycle.plan;
|
package org.apache.maven.lifecycle.plan;
|
||||||
|
|
||||||
|
import org.apache.maven.artifact.Artifact;
|
||||||
|
import org.apache.maven.execution.DefaultMavenExecutionRequest;
|
||||||
|
import org.apache.maven.execution.DefaultMavenRealmManager;
|
||||||
|
import org.apache.maven.execution.MavenExecutionRequest;
|
||||||
|
import org.apache.maven.execution.MavenRealmManager;
|
||||||
import org.apache.maven.execution.MavenSession;
|
import org.apache.maven.execution.MavenSession;
|
||||||
import org.apache.maven.lifecycle.LifecycleLoaderException;
|
|
||||||
import org.apache.maven.lifecycle.LifecycleSpecificationException;
|
|
||||||
import org.apache.maven.lifecycle.MojoBindingUtils;
|
import org.apache.maven.lifecycle.MojoBindingUtils;
|
||||||
import org.apache.maven.lifecycle.model.MojoBinding;
|
import org.apache.maven.lifecycle.model.MojoBinding;
|
||||||
import org.apache.maven.lifecycle.plan.testutils.TestPluginLoader;
|
import org.apache.maven.lifecycle.plan.testutils.TestPluginLoader;
|
||||||
|
@ -14,8 +17,14 @@ import org.apache.maven.plugin.descriptor.MojoDescriptor;
|
||||||
import org.apache.maven.plugin.descriptor.PluginDescriptor;
|
import org.apache.maven.plugin.descriptor.PluginDescriptor;
|
||||||
import org.apache.maven.plugin.loader.PluginLoader;
|
import org.apache.maven.plugin.loader.PluginLoader;
|
||||||
import org.apache.maven.project.MavenProject;
|
import org.apache.maven.project.MavenProject;
|
||||||
|
import org.apache.maven.shared.tools.easymock.MockManager;
|
||||||
import org.codehaus.plexus.PlexusTestCase;
|
import org.codehaus.plexus.PlexusTestCase;
|
||||||
|
import org.codehaus.plexus.logging.Logger;
|
||||||
|
import org.codehaus.plexus.logging.console.ConsoleLogger;
|
||||||
|
import org.easymock.MockControl;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.net.URL;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -29,6 +38,8 @@ public class DefaultBuildPlannerTest
|
||||||
|
|
||||||
private TestPluginLoader pluginLoader;
|
private TestPluginLoader pluginLoader;
|
||||||
|
|
||||||
|
private MockManager mockManager = new MockManager();
|
||||||
|
|
||||||
protected void setUp()
|
protected void setUp()
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
|
@ -38,7 +49,7 @@ public class DefaultBuildPlannerTest
|
||||||
}
|
}
|
||||||
|
|
||||||
public void test_constructBuildPlan_ForkedPhaseFromMojoBoundInThatPhase()
|
public void test_constructBuildPlan_ForkedPhaseFromMojoBoundInThatPhase()
|
||||||
throws LifecycleLoaderException, LifecycleSpecificationException, LifecyclePlannerException
|
throws Exception
|
||||||
{
|
{
|
||||||
Model model = new Model();
|
Model model = new Model();
|
||||||
|
|
||||||
|
@ -59,8 +70,10 @@ public class DefaultBuildPlannerTest
|
||||||
|
|
||||||
plugin.addExecution( exec );
|
plugin.addExecution( exec );
|
||||||
|
|
||||||
PluginDescriptor pd = TestPluginLoader.createPluginDescriptor( plugin.getArtifactId(), "assembly",
|
PluginDescriptor pd = TestPluginLoader.createPluginDescriptor( plugin.getArtifactId(),
|
||||||
plugin.getGroupId(), plugin.getVersion() );
|
"assembly",
|
||||||
|
plugin.getGroupId(),
|
||||||
|
plugin.getVersion() );
|
||||||
MojoDescriptor md = TestPluginLoader.createMojoDescriptor( pd, "assembly" );
|
MojoDescriptor md = TestPluginLoader.createMojoDescriptor( pd, "assembly" );
|
||||||
md.setExecutePhase( "package" );
|
md.setExecutePhase( "package" );
|
||||||
|
|
||||||
|
@ -68,9 +81,14 @@ public class DefaultBuildPlannerTest
|
||||||
|
|
||||||
MavenProject project = new MavenProject( model );
|
MavenProject project = new MavenProject( model );
|
||||||
|
|
||||||
MavenSession session = new MavenSession( getContainer(), null, null, null );
|
MavenRealmManager realmManager = new DefaultMavenRealmManager( getContainer(), new ConsoleLogger( Logger.LEVEL_DEBUG, "test" ) );
|
||||||
|
MavenExecutionRequest request = new DefaultMavenExecutionRequest().setRealmManager( realmManager );
|
||||||
|
|
||||||
BuildPlan plan = buildPlanner.constructBuildPlan( Collections.singletonList( "package" ), project, session );
|
MavenSession session = new MavenSession( getContainer(), request, null, null );
|
||||||
|
|
||||||
|
BuildPlan plan = buildPlanner.constructBuildPlan( Collections.singletonList( "package" ),
|
||||||
|
project,
|
||||||
|
session );
|
||||||
|
|
||||||
List rendered = plan.renderExecutionPlan( new Stack() );
|
List rendered = plan.renderExecutionPlan( new Stack() );
|
||||||
|
|
||||||
|
@ -96,7 +114,75 @@ public class DefaultBuildPlannerTest
|
||||||
assertBindingIds( rendered, checkIds );
|
assertBindingIds( rendered, checkIds );
|
||||||
}
|
}
|
||||||
|
|
||||||
private void assertBindingIds( List bindings, List checkIds )
|
public void test_constructBuildPlan_CustomLifecycleIsUsedFromRealmManager()
|
||||||
|
throws Exception
|
||||||
|
{
|
||||||
|
Model model = new Model();
|
||||||
|
|
||||||
|
model.setPackaging( "test" );
|
||||||
|
|
||||||
|
MavenProject project = new MavenProject( model );
|
||||||
|
|
||||||
|
MavenRealmManager realmManager = new DefaultMavenRealmManager( getContainer(), new ConsoleLogger( Logger.LEVEL_DEBUG, "test" ) );
|
||||||
|
|
||||||
|
MockControl extArtifactCtl = MockControl.createControl( Artifact.class );
|
||||||
|
mockManager.add( extArtifactCtl );
|
||||||
|
|
||||||
|
Artifact extensionArtifact = (Artifact) extArtifactCtl.getMock();
|
||||||
|
|
||||||
|
extensionArtifact.getGroupId();
|
||||||
|
extArtifactCtl.setReturnValue( "group", MockControl.ZERO_OR_MORE );
|
||||||
|
|
||||||
|
extensionArtifact.getArtifactId();
|
||||||
|
extArtifactCtl.setReturnValue( "artifact", MockControl.ZERO_OR_MORE );
|
||||||
|
|
||||||
|
extensionArtifact.getVersion();
|
||||||
|
extArtifactCtl.setReturnValue( "1", MockControl.ZERO_OR_MORE );
|
||||||
|
|
||||||
|
extensionArtifact.getFile();
|
||||||
|
extArtifactCtl.setReturnValue( getResourceFile( "org/apache/maven/lifecycle/plan/test-custom-lifecycle-buildPlan-1.jar" ),
|
||||||
|
MockControl.ZERO_OR_MORE );
|
||||||
|
|
||||||
|
mockManager.replayAll();
|
||||||
|
|
||||||
|
realmManager.createExtensionRealm( extensionArtifact, Collections.EMPTY_SET );
|
||||||
|
realmManager.importExtensionsIntoProjectRealm( "group", "project", "1", extensionArtifact );
|
||||||
|
|
||||||
|
MavenExecutionRequest request = new DefaultMavenExecutionRequest().setRealmManager( realmManager );
|
||||||
|
|
||||||
|
MavenSession session = new MavenSession( getContainer(), request, null, null );
|
||||||
|
|
||||||
|
BuildPlan plan = buildPlanner.constructBuildPlan( Collections.singletonList( "deploy" ),
|
||||||
|
project,
|
||||||
|
session );
|
||||||
|
|
||||||
|
List rendered = plan.renderExecutionPlan( new Stack() );
|
||||||
|
|
||||||
|
List checkIds = new ArrayList();
|
||||||
|
|
||||||
|
checkIds.add( "org.apache.maven.plugins:maven-deploy-plugin:deploy" );
|
||||||
|
checkIds.add( "org.apache.maven.plugins:maven-install-plugin:install" );
|
||||||
|
|
||||||
|
assertBindingIds( rendered, checkIds );
|
||||||
|
|
||||||
|
mockManager.verifyAll();
|
||||||
|
}
|
||||||
|
|
||||||
|
private File getResourceFile( String path )
|
||||||
|
{
|
||||||
|
ClassLoader cloader = Thread.currentThread().getContextClassLoader();
|
||||||
|
URL resource = cloader.getResource( path );
|
||||||
|
|
||||||
|
if ( resource == null )
|
||||||
|
{
|
||||||
|
fail( "Cannot find test resource: " + path );
|
||||||
|
}
|
||||||
|
|
||||||
|
return new File( resource.getPath() );
|
||||||
|
}
|
||||||
|
|
||||||
|
private void assertBindingIds( List bindings,
|
||||||
|
List checkIds )
|
||||||
{
|
{
|
||||||
assertEquals( checkIds.size(), bindings.size() );
|
assertEquals( checkIds.size(), bindings.size() );
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,10 @@
|
||||||
|
<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/maven-v4_0_0.xsd">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<groupId>org.apache.maven.core.test</groupId>
|
||||||
|
<artifactId>test-custom-lifecycle-buildPlan</artifactId>
|
||||||
|
<packaging>jar</packaging>
|
||||||
|
<version>1</version>
|
||||||
|
<name>test-custom-lifecycle-buildPlan</name>
|
||||||
|
|
||||||
|
</project>
|
|
@ -0,0 +1,31 @@
|
||||||
|
<component-set>
|
||||||
|
<components>
|
||||||
|
<component>
|
||||||
|
<role>org.apache.maven.artifact.handler.ArtifactHandler</role>
|
||||||
|
<role-hint>test</role-hint>
|
||||||
|
<implementation>org.apache.maven.artifact.handler.DefaultArtifactHandler</implementation>
|
||||||
|
<configuration>
|
||||||
|
<type>test</type>
|
||||||
|
<extension>jar</extension>
|
||||||
|
<language>java</language>
|
||||||
|
<addedToClasspath>true</addedToClasspath>
|
||||||
|
</configuration>
|
||||||
|
</component>
|
||||||
|
<component>
|
||||||
|
<role>org.apache.maven.lifecycle.mapping.LifecycleMapping</role>
|
||||||
|
<role-hint>test</role-hint>
|
||||||
|
<implementation>org.apache.maven.lifecycle.mapping.DefaultLifecycleMapping</implementation>
|
||||||
|
<configuration>
|
||||||
|
<lifecycles>
|
||||||
|
<lifecycle>
|
||||||
|
<id>default</id>
|
||||||
|
<phases>
|
||||||
|
<install>org.apache.maven.plugins:maven-deploy-plugin:deploy</install>
|
||||||
|
<deploy>org.apache.maven.plugins:maven-install-plugin:install</deploy>
|
||||||
|
</phases>
|
||||||
|
</lifecycle>
|
||||||
|
</lifecycles>
|
||||||
|
</configuration>
|
||||||
|
</component>
|
||||||
|
</components>
|
||||||
|
</component-set>
|
Binary file not shown.
|
@ -27,7 +27,6 @@ import org.apache.maven.profiles.DefaultProfileManager;
|
||||||
import org.apache.maven.profiles.ProfileManager;
|
import org.apache.maven.profiles.ProfileManager;
|
||||||
import org.apache.maven.profiles.activation.DefaultProfileActivationContext;
|
import org.apache.maven.profiles.activation.DefaultProfileActivationContext;
|
||||||
import org.apache.maven.profiles.activation.ProfileActivationContext;
|
import org.apache.maven.profiles.activation.ProfileActivationContext;
|
||||||
import org.apache.maven.profiles.activation.ProfileActivationException;
|
|
||||||
import org.codehaus.plexus.PlexusTestCase;
|
import org.codehaus.plexus.PlexusTestCase;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -37,28 +36,30 @@ public class DefaultProfileManagerTest
|
||||||
extends PlexusTestCase
|
extends PlexusTestCase
|
||||||
{
|
{
|
||||||
|
|
||||||
public void setUp() throws Exception
|
public void setUp()
|
||||||
|
throws Exception
|
||||||
{
|
{
|
||||||
super.setUp();
|
super.setUp();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testShouldActivateDefaultProfile() throws ProfileActivationException
|
public void testShouldActivateDefaultProfile()
|
||||||
|
throws Exception
|
||||||
{
|
{
|
||||||
Profile notActivated = new Profile();
|
Profile notActivated = new Profile();
|
||||||
notActivated.setId("notActivated");
|
notActivated.setId( "notActivated" );
|
||||||
|
|
||||||
Activation nonActivation = new Activation();
|
Activation nonActivation = new Activation();
|
||||||
|
|
||||||
nonActivation.setJdk("19.2");
|
nonActivation.setJdk( "19.2" );
|
||||||
|
|
||||||
notActivated.setActivation( nonActivation );
|
notActivated.setActivation( nonActivation );
|
||||||
|
|
||||||
Profile defaultActivated = new Profile();
|
Profile defaultActivated = new Profile();
|
||||||
defaultActivated.setId("defaultActivated");
|
defaultActivated.setId( "defaultActivated" );
|
||||||
|
|
||||||
Activation defaultActivation = new Activation();
|
Activation defaultActivation = new Activation();
|
||||||
|
|
||||||
defaultActivation.setActiveByDefault(true);
|
defaultActivation.setActiveByDefault( true );
|
||||||
|
|
||||||
defaultActivated.setActivation( defaultActivation );
|
defaultActivated.setActivation( defaultActivation );
|
||||||
|
|
||||||
|
@ -67,36 +68,37 @@ public class DefaultProfileManagerTest
|
||||||
|
|
||||||
ProfileManager profileManager = new DefaultProfileManager( getContainer(), ctx );
|
ProfileManager profileManager = new DefaultProfileManager( getContainer(), ctx );
|
||||||
|
|
||||||
profileManager.addProfile(notActivated);
|
profileManager.addProfile( notActivated );
|
||||||
profileManager.addProfile(defaultActivated);
|
profileManager.addProfile( defaultActivated );
|
||||||
|
|
||||||
List active = profileManager.getActiveProfiles();
|
List active = profileManager.getActiveProfiles();
|
||||||
|
|
||||||
assertNotNull( active );
|
assertNotNull( active );
|
||||||
assertEquals( 1, active.size() );
|
assertEquals( 1, active.size() );
|
||||||
assertEquals("defaultActivated", ((Profile)active.get(0)).getId());
|
assertEquals( "defaultActivated", ( (Profile) active.get( 0 ) ).getId() );
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testShouldNotActivateDefaultProfile() throws ProfileActivationException
|
public void testShouldNotActivateDefaultProfile()
|
||||||
|
throws Exception
|
||||||
{
|
{
|
||||||
Profile syspropActivated = new Profile();
|
Profile syspropActivated = new Profile();
|
||||||
syspropActivated.setId("syspropActivated");
|
syspropActivated.setId( "syspropActivated" );
|
||||||
|
|
||||||
Activation syspropActivation = new Activation();
|
Activation syspropActivation = new Activation();
|
||||||
|
|
||||||
ActivationProperty syspropProperty = new ActivationProperty();
|
ActivationProperty syspropProperty = new ActivationProperty();
|
||||||
syspropProperty.setName("java.version");
|
syspropProperty.setName( "java.version" );
|
||||||
|
|
||||||
syspropActivation.setProperty(syspropProperty);
|
syspropActivation.setProperty( syspropProperty );
|
||||||
|
|
||||||
syspropActivated.setActivation( syspropActivation );
|
syspropActivated.setActivation( syspropActivation );
|
||||||
|
|
||||||
Profile defaultActivated = new Profile();
|
Profile defaultActivated = new Profile();
|
||||||
defaultActivated.setId("defaultActivated");
|
defaultActivated.setId( "defaultActivated" );
|
||||||
|
|
||||||
Activation defaultActivation = new Activation();
|
Activation defaultActivation = new Activation();
|
||||||
|
|
||||||
defaultActivation.setActiveByDefault(true);
|
defaultActivation.setActiveByDefault( true );
|
||||||
|
|
||||||
defaultActivated.setActivation( defaultActivation );
|
defaultActivated.setActivation( defaultActivation );
|
||||||
|
|
||||||
|
@ -105,27 +107,28 @@ public class DefaultProfileManagerTest
|
||||||
|
|
||||||
ProfileManager profileManager = new DefaultProfileManager( getContainer(), ctx );
|
ProfileManager profileManager = new DefaultProfileManager( getContainer(), ctx );
|
||||||
|
|
||||||
profileManager.addProfile(syspropActivated);
|
profileManager.addProfile( syspropActivated );
|
||||||
profileManager.addProfile(defaultActivated);
|
profileManager.addProfile( defaultActivated );
|
||||||
|
|
||||||
List active = profileManager.getActiveProfiles();
|
List active = profileManager.getActiveProfiles();
|
||||||
|
|
||||||
assertNotNull( active );
|
assertNotNull( active );
|
||||||
assertEquals( 1, active.size() );
|
assertEquals( 1, active.size() );
|
||||||
assertEquals("syspropActivated", ((Profile)active.get(0)).getId());
|
assertEquals( "syspropActivated", ( (Profile) active.get( 0 ) ).getId() );
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testShouldNotActivateReversalOfPresentSystemProperty() throws ProfileActivationException
|
public void testShouldNotActivateReversalOfPresentSystemProperty()
|
||||||
|
throws Exception
|
||||||
{
|
{
|
||||||
Profile syspropActivated = new Profile();
|
Profile syspropActivated = new Profile();
|
||||||
syspropActivated.setId("syspropActivated");
|
syspropActivated.setId( "syspropActivated" );
|
||||||
|
|
||||||
Activation syspropActivation = new Activation();
|
Activation syspropActivation = new Activation();
|
||||||
|
|
||||||
ActivationProperty syspropProperty = new ActivationProperty();
|
ActivationProperty syspropProperty = new ActivationProperty();
|
||||||
syspropProperty.setName("!java.version");
|
syspropProperty.setName( "!java.version" );
|
||||||
|
|
||||||
syspropActivation.setProperty(syspropProperty);
|
syspropActivation.setProperty( syspropProperty );
|
||||||
|
|
||||||
syspropActivated.setActivation( syspropActivation );
|
syspropActivated.setActivation( syspropActivation );
|
||||||
|
|
||||||
|
@ -134,7 +137,7 @@ public class DefaultProfileManagerTest
|
||||||
|
|
||||||
ProfileManager profileManager = new DefaultProfileManager( getContainer(), ctx );
|
ProfileManager profileManager = new DefaultProfileManager( getContainer(), ctx );
|
||||||
|
|
||||||
profileManager.addProfile(syspropActivated);
|
profileManager.addProfile( syspropActivated );
|
||||||
|
|
||||||
List active = profileManager.getActiveProfiles();
|
List active = profileManager.getActiveProfiles();
|
||||||
|
|
||||||
|
@ -142,17 +145,18 @@ public class DefaultProfileManagerTest
|
||||||
assertEquals( 0, active.size() );
|
assertEquals( 0, active.size() );
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testShouldOverrideAndActivateInactiveProfile() throws ProfileActivationException
|
public void testShouldOverrideAndActivateInactiveProfile()
|
||||||
|
throws Exception
|
||||||
{
|
{
|
||||||
Profile syspropActivated = new Profile();
|
Profile syspropActivated = new Profile();
|
||||||
syspropActivated.setId("syspropActivated");
|
syspropActivated.setId( "syspropActivated" );
|
||||||
|
|
||||||
Activation syspropActivation = new Activation();
|
Activation syspropActivation = new Activation();
|
||||||
|
|
||||||
ActivationProperty syspropProperty = new ActivationProperty();
|
ActivationProperty syspropProperty = new ActivationProperty();
|
||||||
syspropProperty.setName("!java.version");
|
syspropProperty.setName( "!java.version" );
|
||||||
|
|
||||||
syspropActivation.setProperty(syspropProperty);
|
syspropActivation.setProperty( syspropProperty );
|
||||||
|
|
||||||
syspropActivated.setActivation( syspropActivation );
|
syspropActivated.setActivation( syspropActivation );
|
||||||
|
|
||||||
|
@ -161,28 +165,29 @@ public class DefaultProfileManagerTest
|
||||||
|
|
||||||
ProfileManager profileManager = new DefaultProfileManager( getContainer(), ctx );
|
ProfileManager profileManager = new DefaultProfileManager( getContainer(), ctx );
|
||||||
|
|
||||||
profileManager.addProfile(syspropActivated);
|
profileManager.addProfile( syspropActivated );
|
||||||
|
|
||||||
profileManager.explicitlyActivate("syspropActivated");
|
profileManager.explicitlyActivate( "syspropActivated" );
|
||||||
|
|
||||||
List active = profileManager.getActiveProfiles();
|
List active = profileManager.getActiveProfiles();
|
||||||
|
|
||||||
assertNotNull( active );
|
assertNotNull( active );
|
||||||
assertEquals( 1, active.size() );
|
assertEquals( 1, active.size() );
|
||||||
assertEquals( "syspropActivated", ((Profile)active.get(0)).getId());
|
assertEquals( "syspropActivated", ( (Profile) active.get( 0 ) ).getId() );
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testShouldOverrideAndDeactivateActiveProfile() throws ProfileActivationException
|
public void testShouldOverrideAndDeactivateActiveProfile()
|
||||||
|
throws Exception
|
||||||
{
|
{
|
||||||
Profile syspropActivated = new Profile();
|
Profile syspropActivated = new Profile();
|
||||||
syspropActivated.setId("syspropActivated");
|
syspropActivated.setId( "syspropActivated" );
|
||||||
|
|
||||||
Activation syspropActivation = new Activation();
|
Activation syspropActivation = new Activation();
|
||||||
|
|
||||||
ActivationProperty syspropProperty = new ActivationProperty();
|
ActivationProperty syspropProperty = new ActivationProperty();
|
||||||
syspropProperty.setName("java.version");
|
syspropProperty.setName( "java.version" );
|
||||||
|
|
||||||
syspropActivation.setProperty(syspropProperty);
|
syspropActivation.setProperty( syspropProperty );
|
||||||
|
|
||||||
syspropActivated.setActivation( syspropActivation );
|
syspropActivated.setActivation( syspropActivation );
|
||||||
|
|
||||||
|
@ -191,9 +196,9 @@ public class DefaultProfileManagerTest
|
||||||
|
|
||||||
ProfileManager profileManager = new DefaultProfileManager( getContainer(), ctx );
|
ProfileManager profileManager = new DefaultProfileManager( getContainer(), ctx );
|
||||||
|
|
||||||
profileManager.addProfile(syspropActivated);
|
profileManager.addProfile( syspropActivated );
|
||||||
|
|
||||||
profileManager.explicitlyDeactivate("syspropActivated");
|
profileManager.explicitlyDeactivate( "syspropActivated" );
|
||||||
|
|
||||||
List active = profileManager.getActiveProfiles();
|
List active = profileManager.getActiveProfiles();
|
||||||
|
|
||||||
|
@ -201,27 +206,28 @@ public class DefaultProfileManagerTest
|
||||||
assertEquals( 0, active.size() );
|
assertEquals( 0, active.size() );
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testOsActivationProfile() throws ProfileActivationException
|
public void testOsActivationProfile()
|
||||||
|
throws Exception
|
||||||
{
|
{
|
||||||
Profile osActivated = new Profile();
|
Profile osActivated = new Profile();
|
||||||
osActivated.setId("os-profile");
|
osActivated.setId( "os-profile" );
|
||||||
|
|
||||||
Activation osActivation = new Activation();
|
Activation osActivation = new Activation();
|
||||||
|
|
||||||
ActivationOS activationOS = new ActivationOS();
|
ActivationOS activationOS = new ActivationOS();
|
||||||
|
|
||||||
activationOS.setName("!dddd");
|
activationOS.setName( "!dddd" );
|
||||||
|
|
||||||
osActivation.setOs(activationOS);
|
osActivation.setOs( activationOS );
|
||||||
|
|
||||||
osActivated.setActivation(osActivation);
|
osActivated.setActivation( osActivation );
|
||||||
|
|
||||||
Properties props = System.getProperties();
|
Properties props = System.getProperties();
|
||||||
ProfileActivationContext ctx = new DefaultProfileActivationContext( props, false );
|
ProfileActivationContext ctx = new DefaultProfileActivationContext( props, false );
|
||||||
|
|
||||||
ProfileManager profileManager = new DefaultProfileManager( getContainer(), ctx );
|
ProfileManager profileManager = new DefaultProfileManager( getContainer(), ctx );
|
||||||
|
|
||||||
profileManager.addProfile(osActivated);
|
profileManager.addProfile( osActivated );
|
||||||
|
|
||||||
List active = profileManager.getActiveProfiles();
|
List active = profileManager.getActiveProfiles();
|
||||||
|
|
||||||
|
|
|
@ -42,7 +42,7 @@ public class SuperPomProjectBuilderTest
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testStandaloneSuperPomContainsInjectedExternalProfileRepositories()
|
public void testStandaloneSuperPomContainsInjectedExternalProfileRepositories()
|
||||||
throws ProjectBuildingException
|
throws Exception
|
||||||
{
|
{
|
||||||
Profile profile = new Profile();
|
Profile profile = new Profile();
|
||||||
profile.setId( "test-profile" );
|
profile.setId( "test-profile" );
|
||||||
|
|
|
@ -388,7 +388,7 @@ public class DefaultModelLineageBuilderTest
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testReadPOMWithParentInRepoBroughtInViaSettingsProfile()
|
public void testReadPOMWithParentInRepoBroughtInViaSettingsProfile()
|
||||||
throws IOException, ProjectBuildingException
|
throws Exception
|
||||||
{
|
{
|
||||||
// 1. create project-root directory.
|
// 1. create project-root directory.
|
||||||
File projectRootDirectory = createTempDir( "projectRootDir" );
|
File projectRootDirectory = createTempDir( "projectRootDir" );
|
||||||
|
|
Loading…
Reference in New Issue