mirror of https://github.com/apache/maven.git
[MNG-5577] Use JSR 330 constructor injection
# Conflicts: # maven-core/src/main/java/org/apache/maven/lifecycle/internal/DefaultLifecyclePluginAnalyzer.java
This commit is contained in:
parent
1ab49b349f
commit
35e5a4d71d
|
@ -20,6 +20,7 @@ package org.apache.maven.project;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
import java.lang.reflect.Field;
|
||||||
|
|
||||||
import org.apache.maven.artifact.Artifact;
|
import org.apache.maven.artifact.Artifact;
|
||||||
import org.apache.maven.repository.internal.DefaultArtifactDescriptorReader;
|
import org.apache.maven.repository.internal.DefaultArtifactDescriptorReader;
|
||||||
|
@ -45,8 +46,10 @@ public class ProjectClasspathTest
|
||||||
super.setUp();
|
super.setUp();
|
||||||
|
|
||||||
ArtifactResolver resolver = getContainer().lookup( ArtifactResolver.class, "classpath" );
|
ArtifactResolver resolver = getContainer().lookup( ArtifactResolver.class, "classpath" );
|
||||||
DefaultArtifactDescriptorReader pomReader = (DefaultArtifactDescriptorReader)getContainer().lookup(ArtifactDescriptorReader.class);
|
DefaultArtifactDescriptorReader pomReader = (DefaultArtifactDescriptorReader) getContainer().lookup(ArtifactDescriptorReader.class);
|
||||||
pomReader.setArtifactResolver( resolver );
|
Field field = DefaultArtifactDescriptorReader.class.getDeclaredField( "artifactResolver" );
|
||||||
|
field.setAccessible( true );
|
||||||
|
field.set( pomReader, resolver );
|
||||||
|
|
||||||
projectBuilder = getContainer().lookup( ProjectBuilder.class, "classpath" );
|
projectBuilder = getContainer().lookup( ProjectBuilder.class, "classpath" );
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,7 +19,14 @@ import java.io.File;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
|
|
||||||
import org.apache.maven.artifact.repository.ArtifactRepository;
|
import org.apache.maven.artifact.repository.ArtifactRepository;
|
||||||
|
import org.apache.maven.bridge.MavenRepositorySystem;
|
||||||
|
import org.apache.maven.model.building.ModelBuilder;
|
||||||
|
import org.apache.maven.model.building.ModelProcessor;
|
||||||
|
import org.codehaus.plexus.logging.Logger;
|
||||||
|
import org.eclipse.aether.RepositorySystem;
|
||||||
|
import org.eclipse.aether.impl.RemoteRepositoryManager;
|
||||||
|
|
||||||
|
import javax.inject.Inject;
|
||||||
import javax.inject.Named;
|
import javax.inject.Named;
|
||||||
import javax.inject.Singleton;
|
import javax.inject.Singleton;
|
||||||
|
|
||||||
|
@ -28,6 +35,16 @@ import javax.inject.Singleton;
|
||||||
public class TestProjectBuilder
|
public class TestProjectBuilder
|
||||||
extends DefaultProjectBuilder
|
extends DefaultProjectBuilder
|
||||||
{
|
{
|
||||||
|
@Inject
|
||||||
|
public TestProjectBuilder(
|
||||||
|
Logger logger, ModelBuilder modelBuilder, ModelProcessor modelProcessor,
|
||||||
|
ProjectBuildingHelper projectBuildingHelper, MavenRepositorySystem repositorySystem,
|
||||||
|
RepositorySystem repoSystem, RemoteRepositoryManager repositoryManager,
|
||||||
|
ProjectDependenciesResolver dependencyResolver )
|
||||||
|
{
|
||||||
|
super( logger, modelBuilder, modelProcessor, projectBuildingHelper, repositorySystem, repoSystem,
|
||||||
|
repositoryManager, dependencyResolver );
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ProjectBuildingResult build( File pomFile, ProjectBuildingRequest configuration )
|
public ProjectBuildingResult build( File pomFile, ProjectBuildingRequest configuration )
|
||||||
|
|
|
@ -83,42 +83,58 @@ public class DefaultMaven
|
||||||
implements Maven
|
implements Maven
|
||||||
{
|
{
|
||||||
|
|
||||||
@Inject
|
private final Logger logger;
|
||||||
private Logger logger;
|
|
||||||
|
|
||||||
@Inject
|
|
||||||
protected ProjectBuilder projectBuilder;
|
protected ProjectBuilder projectBuilder;
|
||||||
|
|
||||||
@Inject
|
|
||||||
private LifecycleStarter lifecycleStarter;
|
private LifecycleStarter lifecycleStarter;
|
||||||
|
|
||||||
@Inject
|
|
||||||
protected PlexusContainer container;
|
protected PlexusContainer container;
|
||||||
|
|
||||||
@Inject
|
|
||||||
private ExecutionEventCatapult eventCatapult;
|
private ExecutionEventCatapult eventCatapult;
|
||||||
|
|
||||||
@Inject
|
|
||||||
private LegacySupport legacySupport;
|
private LegacySupport legacySupport;
|
||||||
|
|
||||||
@Inject
|
|
||||||
private SessionScope sessionScope;
|
private SessionScope sessionScope;
|
||||||
|
|
||||||
@Inject
|
|
||||||
private DefaultRepositorySystemSessionFactory repositorySessionFactory;
|
private DefaultRepositorySystemSessionFactory repositorySessionFactory;
|
||||||
|
|
||||||
@Inject
|
private final GraphBuilder graphBuilder;
|
||||||
@Named( GraphBuilder.HINT )
|
|
||||||
private GraphBuilder graphBuilder;
|
private final BuildResumptionAnalyzer buildResumptionAnalyzer;
|
||||||
|
|
||||||
|
private final BuildResumptionDataRepository buildResumptionDataRepository;
|
||||||
|
|
||||||
|
private final SuperPomProvider superPomProvider;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
private BuildResumptionAnalyzer buildResumptionAnalyzer;
|
public DefaultMaven(
|
||||||
|
Logger logger,
|
||||||
@Inject
|
ProjectBuilder projectBuilder,
|
||||||
private BuildResumptionDataRepository buildResumptionDataRepository;
|
LifecycleStarter lifecycleStarter,
|
||||||
|
PlexusContainer container,
|
||||||
@Inject
|
ExecutionEventCatapult eventCatapult,
|
||||||
private SuperPomProvider superPomProvider;
|
LegacySupport legacySupport,
|
||||||
|
SessionScope sessionScope,
|
||||||
|
DefaultRepositorySystemSessionFactory repositorySessionFactory,
|
||||||
|
@Named( GraphBuilder.HINT ) GraphBuilder graphBuilder,
|
||||||
|
BuildResumptionAnalyzer buildResumptionAnalyzer,
|
||||||
|
BuildResumptionDataRepository buildResumptionDataRepository,
|
||||||
|
SuperPomProvider superPomProvider )
|
||||||
|
{
|
||||||
|
this.logger = logger;
|
||||||
|
this.projectBuilder = projectBuilder;
|
||||||
|
this.lifecycleStarter = lifecycleStarter;
|
||||||
|
this.container = container;
|
||||||
|
this.eventCatapult = eventCatapult;
|
||||||
|
this.legacySupport = legacySupport;
|
||||||
|
this.sessionScope = sessionScope;
|
||||||
|
this.repositorySessionFactory = repositorySessionFactory;
|
||||||
|
this.graphBuilder = graphBuilder;
|
||||||
|
this.buildResumptionAnalyzer = buildResumptionAnalyzer;
|
||||||
|
this.buildResumptionDataRepository = buildResumptionDataRepository;
|
||||||
|
this.superPomProvider = superPomProvider;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public MavenExecutionResult execute( MavenExecutionRequest request )
|
public MavenExecutionResult execute( MavenExecutionRequest request )
|
||||||
|
|
|
@ -56,11 +56,18 @@ public class DefaultProjectDependenciesResolver
|
||||||
implements ProjectDependenciesResolver
|
implements ProjectDependenciesResolver
|
||||||
{
|
{
|
||||||
|
|
||||||
@Inject
|
private final RepositorySystem repositorySystem;
|
||||||
private RepositorySystem repositorySystem;
|
|
||||||
|
private final ResolutionErrorHandler resolutionErrorHandler;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
private ResolutionErrorHandler resolutionErrorHandler;
|
public DefaultProjectDependenciesResolver(
|
||||||
|
RepositorySystem repositorySystem,
|
||||||
|
ResolutionErrorHandler resolutionErrorHandler )
|
||||||
|
{
|
||||||
|
this.repositorySystem = repositorySystem;
|
||||||
|
this.resolutionErrorHandler = resolutionErrorHandler;
|
||||||
|
}
|
||||||
|
|
||||||
public Set<Artifact> resolve( MavenProject project, Collection<String> scopesToResolve, MavenSession session )
|
public Set<Artifact> resolve( MavenProject project, Collection<String> scopesToResolve, MavenSession session )
|
||||||
throws ArtifactResolutionException, ArtifactNotFoundException
|
throws ArtifactResolutionException, ArtifactNotFoundException
|
||||||
|
|
|
@ -67,13 +67,10 @@ class ReactorReader
|
||||||
|
|
||||||
private static final Logger LOGGER = LoggerFactory.getLogger( ReactorReader.class );
|
private static final Logger LOGGER = LoggerFactory.getLogger( ReactorReader.class );
|
||||||
|
|
||||||
private MavenSession session;
|
private final MavenSession session;
|
||||||
|
private final Map<String, MavenProject> projectsByGAV;
|
||||||
private Map<String, MavenProject> projectsByGAV;
|
private final Map<String, List<MavenProject>> projectsByGA;
|
||||||
|
private final WorkspaceRepository repository;
|
||||||
private Map<String, List<MavenProject>> projectsByGA;
|
|
||||||
|
|
||||||
private WorkspaceRepository repository;
|
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
ReactorReader( MavenSession session )
|
ReactorReader( MavenSession session )
|
||||||
|
|
|
@ -39,8 +39,13 @@ import org.apache.maven.artifact.versioning.VersionRange;
|
||||||
public class DefaultArtifactFactory
|
public class DefaultArtifactFactory
|
||||||
implements ArtifactFactory
|
implements ArtifactFactory
|
||||||
{
|
{
|
||||||
|
private final ArtifactHandlerManager artifactHandlerManager;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
private ArtifactHandlerManager artifactHandlerManager;
|
public DefaultArtifactFactory( ArtifactHandlerManager artifactHandlerManager )
|
||||||
|
{
|
||||||
|
this.artifactHandlerManager = artifactHandlerManager;
|
||||||
|
}
|
||||||
|
|
||||||
public Artifact createArtifact( String groupId, String artifactId, String version, String scope, String type )
|
public Artifact createArtifact( String groupId, String artifactId, String version, String scope, String type )
|
||||||
{
|
{
|
||||||
|
|
|
@ -39,10 +39,15 @@ public class DefaultArtifactHandlerManager
|
||||||
implements ArtifactHandlerManager
|
implements ArtifactHandlerManager
|
||||||
{
|
{
|
||||||
|
|
||||||
@Inject
|
private final Map<String, ArtifactHandler> artifactHandlers;
|
||||||
private Map<String, ArtifactHandler> artifactHandlers;
|
|
||||||
|
|
||||||
private Map<String, ArtifactHandler> allHandlers = new ConcurrentHashMap<>();
|
private final Map<String, ArtifactHandler> allHandlers = new ConcurrentHashMap<>();
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
public DefaultArtifactHandlerManager( Map<String, ArtifactHandler> artifactHandlers )
|
||||||
|
{
|
||||||
|
this.artifactHandlers = artifactHandlers;
|
||||||
|
}
|
||||||
|
|
||||||
public ArtifactHandler getArtifactHandler( String type )
|
public ArtifactHandler getArtifactHandler( String type )
|
||||||
{
|
{
|
||||||
|
|
|
@ -40,23 +40,18 @@ import org.eclipse.aether.RepositoryListener;
|
||||||
public class EventSpyDispatcher
|
public class EventSpyDispatcher
|
||||||
{
|
{
|
||||||
|
|
||||||
@Inject
|
private final Logger logger;
|
||||||
private Logger logger;
|
|
||||||
|
|
||||||
private List<EventSpy> eventSpies;
|
private final List<EventSpy> eventSpies;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public void setEventSpies( List<EventSpy> eventSpies )
|
public EventSpyDispatcher( Logger logger, List<EventSpy> eventSpies )
|
||||||
{
|
{
|
||||||
|
this.logger = logger;
|
||||||
// make copy to get rid of needless overhead for dynamic lookups
|
// make copy to get rid of needless overhead for dynamic lookups
|
||||||
this.eventSpies = new ArrayList<>( eventSpies );
|
this.eventSpies = new ArrayList<>( eventSpies );
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<EventSpy> getEventSpies()
|
|
||||||
{
|
|
||||||
return eventSpies;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ExecutionListener chainListener( ExecutionListener listener )
|
public ExecutionListener chainListener( ExecutionListener listener )
|
||||||
{
|
{
|
||||||
if ( eventSpies.isEmpty() )
|
if ( eventSpies.isEmpty() )
|
||||||
|
|
|
@ -77,33 +77,42 @@ import java.util.Properties;
|
||||||
@Named
|
@Named
|
||||||
public class DefaultRepositorySystemSessionFactory
|
public class DefaultRepositorySystemSessionFactory
|
||||||
{
|
{
|
||||||
@Inject
|
private final Logger logger;
|
||||||
private Logger logger;
|
|
||||||
|
private final ArtifactHandlerManager artifactHandlerManager;
|
||||||
|
|
||||||
|
private final RepositorySystem repoSystem;
|
||||||
|
|
||||||
|
private final LocalRepositoryManagerFactory simpleLocalRepoMgrFactory;
|
||||||
|
|
||||||
|
private final WorkspaceReader workspaceRepository;
|
||||||
|
|
||||||
|
private final SettingsDecrypter settingsDecrypter;
|
||||||
|
|
||||||
|
private final EventSpyDispatcher eventSpyDispatcher;
|
||||||
|
|
||||||
|
private final MavenRepositorySystem mavenRepositorySystem;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
private ArtifactHandlerManager artifactHandlerManager;
|
public DefaultRepositorySystemSessionFactory(
|
||||||
|
Logger logger,
|
||||||
@Inject
|
ArtifactHandlerManager artifactHandlerManager,
|
||||||
private RepositorySystem repoSystem;
|
RepositorySystem repoSystem,
|
||||||
|
@Nullable @Named( "simple" ) LocalRepositoryManagerFactory simpleLocalRepoMgrFactory,
|
||||||
@Inject
|
@Nullable @Named( "ide" ) WorkspaceReader workspaceRepository,
|
||||||
@Nullable
|
SettingsDecrypter settingsDecrypter,
|
||||||
@Named( "simple" )
|
EventSpyDispatcher eventSpyDispatcher,
|
||||||
private LocalRepositoryManagerFactory simpleLocalRepoMgrFactory;
|
MavenRepositorySystem mavenRepositorySystem )
|
||||||
|
{
|
||||||
@Inject
|
this.logger = logger;
|
||||||
@Nullable
|
this.artifactHandlerManager = artifactHandlerManager;
|
||||||
@Named( "ide" )
|
this.repoSystem = repoSystem;
|
||||||
private WorkspaceReader workspaceRepository;
|
this.simpleLocalRepoMgrFactory = simpleLocalRepoMgrFactory;
|
||||||
|
this.workspaceRepository = workspaceRepository;
|
||||||
@Inject
|
this.settingsDecrypter = settingsDecrypter;
|
||||||
private SettingsDecrypter settingsDecrypter;
|
this.eventSpyDispatcher = eventSpyDispatcher;
|
||||||
|
this.mavenRepositorySystem = mavenRepositorySystem;
|
||||||
@Inject
|
}
|
||||||
private EventSpyDispatcher eventSpyDispatcher;
|
|
||||||
|
|
||||||
@Inject
|
|
||||||
MavenRepositorySystem mavenRepositorySystem;
|
|
||||||
|
|
||||||
public DefaultRepositorySystemSession newRepositorySession( MavenExecutionRequest request )
|
public DefaultRepositorySystemSession newRepositorySession( MavenExecutionRequest request )
|
||||||
{
|
{
|
||||||
|
|
|
@ -62,33 +62,38 @@ public class DefaultLifecycleExecutor
|
||||||
implements LifecycleExecutor
|
implements LifecycleExecutor
|
||||||
{
|
{
|
||||||
|
|
||||||
@Inject
|
private final LifeCyclePluginAnalyzer lifeCyclePluginAnalyzer;
|
||||||
private LifeCyclePluginAnalyzer lifeCyclePluginAnalyzer;
|
private final DefaultLifecycles defaultLifeCycles;
|
||||||
|
private final LifecycleTaskSegmentCalculator lifecycleTaskSegmentCalculator;
|
||||||
|
private final LifecycleExecutionPlanCalculator lifecycleExecutionPlanCalculator;
|
||||||
|
private final MojoExecutor mojoExecutor;
|
||||||
|
private final LifecycleStarter lifecycleStarter;
|
||||||
|
private final MojoDescriptorCreator mojoDescriptorCreator;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
private DefaultLifecycles defaultLifeCycles;
|
public DefaultLifecycleExecutor(
|
||||||
|
LifeCyclePluginAnalyzer lifeCyclePluginAnalyzer,
|
||||||
@Inject
|
DefaultLifecycles defaultLifeCycles,
|
||||||
private LifecycleTaskSegmentCalculator lifecycleTaskSegmentCalculator;
|
LifecycleTaskSegmentCalculator lifecycleTaskSegmentCalculator,
|
||||||
|
LifecycleExecutionPlanCalculator lifecycleExecutionPlanCalculator,
|
||||||
@Inject
|
MojoExecutor mojoExecutor,
|
||||||
private LifecycleExecutionPlanCalculator lifecycleExecutionPlanCalculator;
|
LifecycleStarter lifecycleStarter,
|
||||||
|
MojoDescriptorCreator mojoDescriptorCreator )
|
||||||
@Inject
|
{
|
||||||
private MojoExecutor mojoExecutor;
|
this.lifeCyclePluginAnalyzer = lifeCyclePluginAnalyzer;
|
||||||
|
this.defaultLifeCycles = defaultLifeCycles;
|
||||||
@Inject
|
this.lifecycleTaskSegmentCalculator = lifecycleTaskSegmentCalculator;
|
||||||
private LifecycleStarter lifecycleStarter;
|
this.lifecycleExecutionPlanCalculator = lifecycleExecutionPlanCalculator;
|
||||||
|
this.mojoExecutor = mojoExecutor;
|
||||||
|
this.lifecycleStarter = lifecycleStarter;
|
||||||
|
this.mojoDescriptorCreator = mojoDescriptorCreator;
|
||||||
|
}
|
||||||
|
|
||||||
public void execute( MavenSession session )
|
public void execute( MavenSession session )
|
||||||
{
|
{
|
||||||
lifecycleStarter.execute( session );
|
lifecycleStarter.execute( session );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Inject
|
|
||||||
private MojoDescriptorCreator mojoDescriptorCreator;
|
|
||||||
|
|
||||||
// These methods deal with construction intact Plugin object that look like they come from a standard
|
// These methods deal with construction intact Plugin object that look like they come from a standard
|
||||||
// <plugin/> block in a Maven POM. We have to do some wiggling to pull the sources of information
|
// <plugin/> block in a Maven POM. We have to do some wiggling to pull the sources of information
|
||||||
// together and this really shows the problem of constructing a sensible default configuration but
|
// together and this really shows the problem of constructing a sensible default configuration but
|
||||||
|
|
|
@ -56,7 +56,6 @@ import org.apache.maven.plugin.lifecycle.Execution;
|
||||||
import org.apache.maven.plugin.lifecycle.Phase;
|
import org.apache.maven.plugin.lifecycle.Phase;
|
||||||
import org.apache.maven.plugin.prefix.NoPluginFoundForPrefixException;
|
import org.apache.maven.plugin.prefix.NoPluginFoundForPrefixException;
|
||||||
import org.apache.maven.plugin.version.PluginVersionResolutionException;
|
import org.apache.maven.plugin.version.PluginVersionResolutionException;
|
||||||
import org.apache.maven.plugin.version.PluginVersionResolver;
|
|
||||||
import org.apache.maven.project.MavenProject;
|
import org.apache.maven.project.MavenProject;
|
||||||
import org.codehaus.plexus.util.StringUtils;
|
import org.codehaus.plexus.util.StringUtils;
|
||||||
import org.codehaus.plexus.util.xml.Xpp3Dom;
|
import org.codehaus.plexus.util.xml.Xpp3Dom;
|
||||||
|
@ -75,34 +74,38 @@ import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
|
||||||
public class DefaultLifecycleExecutionPlanCalculator
|
public class DefaultLifecycleExecutionPlanCalculator
|
||||||
implements LifecycleExecutionPlanCalculator
|
implements LifecycleExecutionPlanCalculator
|
||||||
{
|
{
|
||||||
@Inject
|
|
||||||
private PluginVersionResolver pluginVersionResolver;
|
private final BuildPluginManager pluginManager;
|
||||||
|
|
||||||
|
private final DefaultLifecycles defaultLifeCycles;
|
||||||
|
|
||||||
|
private final MojoDescriptorCreator mojoDescriptorCreator;
|
||||||
|
|
||||||
|
private final LifecyclePluginResolver lifecyclePluginResolver;
|
||||||
|
|
||||||
|
private final LifecycleMappingDelegate standardDelegate;
|
||||||
|
|
||||||
|
private final Map<String, LifecycleMappingDelegate> delegates;
|
||||||
|
|
||||||
|
private final Map<String, MojoExecutionConfigurator> mojoExecutionConfigurators;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
private BuildPluginManager pluginManager;
|
public DefaultLifecycleExecutionPlanCalculator(
|
||||||
|
BuildPluginManager pluginManager,
|
||||||
@Inject
|
DefaultLifecycles defaultLifeCycles,
|
||||||
private DefaultLifecycles defaultLifeCycles;
|
MojoDescriptorCreator mojoDescriptorCreator,
|
||||||
|
LifecyclePluginResolver lifecyclePluginResolver,
|
||||||
@Inject
|
@Named( DefaultLifecycleMappingDelegate.HINT ) LifecycleMappingDelegate standardDelegate,
|
||||||
private MojoDescriptorCreator mojoDescriptorCreator;
|
Map<String, LifecycleMappingDelegate> delegates,
|
||||||
|
Map<String, MojoExecutionConfigurator> mojoExecutionConfigurators )
|
||||||
@Inject
|
|
||||||
private LifecyclePluginResolver lifecyclePluginResolver;
|
|
||||||
|
|
||||||
@Inject
|
|
||||||
@Named( DefaultLifecycleMappingDelegate.HINT )
|
|
||||||
private LifecycleMappingDelegate standardDelegate;
|
|
||||||
|
|
||||||
@Inject
|
|
||||||
private Map<String, LifecycleMappingDelegate> delegates;
|
|
||||||
|
|
||||||
@Inject
|
|
||||||
private Map<String, MojoExecutionConfigurator> mojoExecutionConfigurators;
|
|
||||||
|
|
||||||
@SuppressWarnings( { "UnusedDeclaration" } )
|
|
||||||
public DefaultLifecycleExecutionPlanCalculator()
|
|
||||||
{
|
{
|
||||||
|
this.pluginManager = pluginManager;
|
||||||
|
this.defaultLifeCycles = defaultLifeCycles;
|
||||||
|
this.mojoDescriptorCreator = mojoDescriptorCreator;
|
||||||
|
this.lifecyclePluginResolver = lifecyclePluginResolver;
|
||||||
|
this.standardDelegate = standardDelegate;
|
||||||
|
this.delegates = delegates;
|
||||||
|
this.mojoExecutionConfigurators = mojoExecutionConfigurators;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Only used for testing
|
// Only used for testing
|
||||||
|
@ -115,6 +118,8 @@ public class DefaultLifecycleExecutionPlanCalculator
|
||||||
this.defaultLifeCycles = defaultLifeCycles;
|
this.defaultLifeCycles = defaultLifeCycles;
|
||||||
this.mojoDescriptorCreator = mojoDescriptorCreator;
|
this.mojoDescriptorCreator = mojoDescriptorCreator;
|
||||||
this.lifecyclePluginResolver = lifecyclePluginResolver;
|
this.lifecyclePluginResolver = lifecyclePluginResolver;
|
||||||
|
this.standardDelegate = null;
|
||||||
|
this.delegates = null;
|
||||||
this.mojoExecutionConfigurators = Collections.singletonMap(
|
this.mojoExecutionConfigurators = Collections.singletonMap(
|
||||||
"default", (MojoExecutionConfigurator) new DefaultMojoExecutionConfigurator() );
|
"default", (MojoExecutionConfigurator) new DefaultMojoExecutionConfigurator() );
|
||||||
}
|
}
|
||||||
|
|
|
@ -58,14 +58,17 @@ import org.codehaus.plexus.util.StringUtils;
|
||||||
public class DefaultLifecycleTaskSegmentCalculator
|
public class DefaultLifecycleTaskSegmentCalculator
|
||||||
implements LifecycleTaskSegmentCalculator
|
implements LifecycleTaskSegmentCalculator
|
||||||
{
|
{
|
||||||
@Inject
|
private final MojoDescriptorCreator mojoDescriptorCreator;
|
||||||
private MojoDescriptorCreator mojoDescriptorCreator;
|
|
||||||
|
private final LifecyclePluginResolver lifecyclePluginResolver;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
private LifecyclePluginResolver lifecyclePluginResolver;
|
public DefaultLifecycleTaskSegmentCalculator(
|
||||||
|
MojoDescriptorCreator mojoDescriptorCreator,
|
||||||
public DefaultLifecycleTaskSegmentCalculator()
|
LifecyclePluginResolver lifecyclePluginResolver )
|
||||||
{
|
{
|
||||||
|
this.mojoDescriptorCreator = mojoDescriptorCreator;
|
||||||
|
this.lifecyclePluginResolver = lifecyclePluginResolver;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<TaskSegment> calculateTaskSegments( MavenSession session )
|
public List<TaskSegment> calculateTaskSegments( MavenSession session )
|
||||||
|
|
|
@ -52,20 +52,14 @@ import org.codehaus.plexus.util.StringUtils;
|
||||||
@Singleton
|
@Singleton
|
||||||
public class LifecycleDebugLogger
|
public class LifecycleDebugLogger
|
||||||
{
|
{
|
||||||
|
private final Logger logger;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
private Logger logger;
|
|
||||||
|
|
||||||
|
|
||||||
public LifecycleDebugLogger()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
public LifecycleDebugLogger( Logger logger )
|
public LifecycleDebugLogger( Logger logger )
|
||||||
{
|
{
|
||||||
this.logger = logger;
|
this.logger = logger;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void debug( String s )
|
public void debug( String s )
|
||||||
{
|
{
|
||||||
logger.debug( s );
|
logger.debug( s );
|
||||||
|
|
|
@ -67,29 +67,29 @@ import org.eclipse.aether.util.filter.ScopeDependencyFilter;
|
||||||
public class LifecycleDependencyResolver
|
public class LifecycleDependencyResolver
|
||||||
{
|
{
|
||||||
|
|
||||||
@Inject
|
private final ProjectDependenciesResolver dependenciesResolver;
|
||||||
private ProjectDependenciesResolver dependenciesResolver;
|
|
||||||
|
private final Logger logger;
|
||||||
|
|
||||||
|
private final ProjectArtifactFactory artifactFactory;
|
||||||
|
|
||||||
|
private final EventSpyDispatcher eventSpyDispatcher;
|
||||||
|
|
||||||
|
private final ProjectArtifactsCache projectArtifactsCache;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
private Logger logger;
|
public LifecycleDependencyResolver(
|
||||||
|
ProjectDependenciesResolver dependenciesResolver,
|
||||||
@Inject
|
Logger logger,
|
||||||
private ProjectArtifactFactory artifactFactory;
|
ProjectArtifactFactory artifactFactory,
|
||||||
|
EventSpyDispatcher eventSpyDispatcher,
|
||||||
@Inject
|
ProjectArtifactsCache projectArtifactsCache )
|
||||||
private EventSpyDispatcher eventSpyDispatcher;
|
|
||||||
|
|
||||||
@Inject
|
|
||||||
private ProjectArtifactsCache projectArtifactsCache;
|
|
||||||
|
|
||||||
public LifecycleDependencyResolver()
|
|
||||||
{
|
{
|
||||||
}
|
this.dependenciesResolver = dependenciesResolver;
|
||||||
|
|
||||||
public LifecycleDependencyResolver( ProjectDependenciesResolver projectDependenciesResolver, Logger logger )
|
|
||||||
{
|
|
||||||
this.dependenciesResolver = projectDependenciesResolver;
|
|
||||||
this.logger = logger;
|
this.logger = logger;
|
||||||
|
this.artifactFactory = artifactFactory;
|
||||||
|
this.eventSpyDispatcher = eventSpyDispatcher;
|
||||||
|
this.projectArtifactsCache = projectArtifactsCache;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static List<MavenProject> getProjects( MavenProject project, MavenSession session, boolean aggregator )
|
public static List<MavenProject> getProjects( MavenProject project, MavenSession session, boolean aggregator )
|
||||||
|
|
|
@ -53,24 +53,25 @@ import org.apache.maven.session.scope.internal.SessionScope;
|
||||||
public class LifecycleModuleBuilder
|
public class LifecycleModuleBuilder
|
||||||
{
|
{
|
||||||
|
|
||||||
@Inject
|
private final MojoExecutor mojoExecutor;
|
||||||
private MojoExecutor mojoExecutor;
|
private final BuilderCommon builderCommon;
|
||||||
|
private final ExecutionEventCatapult eventCatapult;
|
||||||
|
private final ProjectExecutionListener projectExecutionListener;
|
||||||
|
private final SessionScope sessionScope;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
private BuilderCommon builderCommon;
|
public LifecycleModuleBuilder(
|
||||||
|
MojoExecutor mojoExecutor,
|
||||||
@Inject
|
BuilderCommon builderCommon,
|
||||||
private ExecutionEventCatapult eventCatapult;
|
ExecutionEventCatapult eventCatapult,
|
||||||
|
List<ProjectExecutionListener> listeners,
|
||||||
private ProjectExecutionListener projectExecutionListener;
|
SessionScope sessionScope )
|
||||||
|
|
||||||
@Inject
|
|
||||||
private SessionScope sessionScope;
|
|
||||||
|
|
||||||
@Inject
|
|
||||||
public void setProjectExecutionListeners( final List<ProjectExecutionListener> listeners )
|
|
||||||
{
|
{
|
||||||
|
this.mojoExecutor = mojoExecutor;
|
||||||
|
this.builderCommon = builderCommon;
|
||||||
|
this.eventCatapult = eventCatapult;
|
||||||
this.projectExecutionListener = new CompoundProjectExecutionListener( listeners );
|
this.projectExecutionListener = new CompoundProjectExecutionListener( listeners );
|
||||||
|
this.sessionScope = sessionScope;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void buildProject( MavenSession session, ReactorContext reactorContext, MavenProject currentProject,
|
public void buildProject( MavenSession session, ReactorContext reactorContext, MavenProject currentProject,
|
||||||
|
|
|
@ -48,29 +48,42 @@ import org.codehaus.plexus.logging.Logger;
|
||||||
@Singleton
|
@Singleton
|
||||||
public class LifecycleStarter
|
public class LifecycleStarter
|
||||||
{
|
{
|
||||||
@Inject
|
private final ExecutionEventCatapult eventCatapult;
|
||||||
private ExecutionEventCatapult eventCatapult;
|
|
||||||
|
private final DefaultLifecycles defaultLifeCycles;
|
||||||
|
|
||||||
|
private final Logger logger;
|
||||||
|
|
||||||
|
private final BuildListCalculator buildListCalculator;
|
||||||
|
|
||||||
|
private final LifecycleDebugLogger lifecycleDebugLogger;
|
||||||
|
|
||||||
|
private final LifecycleTaskSegmentCalculator lifecycleTaskSegmentCalculator;
|
||||||
|
|
||||||
|
private final Map<String, Builder> builders;
|
||||||
|
|
||||||
|
private final SessionScope sessionScope;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
private DefaultLifecycles defaultLifeCycles;
|
public LifecycleStarter(
|
||||||
|
ExecutionEventCatapult eventCatapult,
|
||||||
@Inject
|
DefaultLifecycles defaultLifeCycles,
|
||||||
private Logger logger;
|
Logger logger,
|
||||||
|
BuildListCalculator buildListCalculator,
|
||||||
@Inject
|
LifecycleDebugLogger lifecycleDebugLogger,
|
||||||
private BuildListCalculator buildListCalculator;
|
LifecycleTaskSegmentCalculator lifecycleTaskSegmentCalculator,
|
||||||
|
Map<String, Builder> builders,
|
||||||
@Inject
|
SessionScope sessionScope )
|
||||||
private LifecycleDebugLogger lifecycleDebugLogger;
|
{
|
||||||
|
this.eventCatapult = eventCatapult;
|
||||||
@Inject
|
this.defaultLifeCycles = defaultLifeCycles;
|
||||||
private LifecycleTaskSegmentCalculator lifecycleTaskSegmentCalculator;
|
this.logger = logger;
|
||||||
|
this.buildListCalculator = buildListCalculator;
|
||||||
@Inject
|
this.lifecycleDebugLogger = lifecycleDebugLogger;
|
||||||
private Map<String, Builder> builders;
|
this.lifecycleTaskSegmentCalculator = lifecycleTaskSegmentCalculator;
|
||||||
|
this.builders = builders;
|
||||||
@Inject
|
this.sessionScope = sessionScope;
|
||||||
private SessionScope sessionScope;
|
}
|
||||||
|
|
||||||
public void execute( MavenSession session )
|
public void execute( MavenSession session )
|
||||||
{
|
{
|
||||||
|
|
|
@ -67,29 +67,21 @@ import org.codehaus.plexus.util.xml.Xpp3Dom;
|
||||||
public class MojoDescriptorCreator
|
public class MojoDescriptorCreator
|
||||||
{
|
{
|
||||||
|
|
||||||
@Inject
|
private final Logger logger;
|
||||||
private Logger logger;
|
private final PluginVersionResolver pluginVersionResolver;
|
||||||
|
private final BuildPluginManager pluginManager;
|
||||||
|
private final PluginPrefixResolver pluginPrefixResolver;
|
||||||
|
private final LifecyclePluginResolver lifecyclePluginResolver;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
private PluginVersionResolver pluginVersionResolver;
|
public MojoDescriptorCreator(
|
||||||
|
Logger logger,
|
||||||
@Inject
|
PluginVersionResolver pluginVersionResolver,
|
||||||
private BuildPluginManager pluginManager;
|
BuildPluginManager pluginManager,
|
||||||
|
PluginPrefixResolver pluginPrefixResolver,
|
||||||
@Inject
|
LifecyclePluginResolver lifecyclePluginResolver )
|
||||||
private PluginPrefixResolver pluginPrefixResolver;
|
|
||||||
|
|
||||||
@Inject
|
|
||||||
private LifecyclePluginResolver lifecyclePluginResolver;
|
|
||||||
|
|
||||||
public MojoDescriptorCreator()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
public MojoDescriptorCreator( PluginVersionResolver pluginVersionResolver, BuildPluginManager pluginManager,
|
|
||||||
PluginPrefixResolver pluginPrefixResolver,
|
|
||||||
LifecyclePluginResolver lifecyclePluginResolver )
|
|
||||||
{
|
{
|
||||||
|
this.logger = logger;
|
||||||
this.pluginVersionResolver = pluginVersionResolver;
|
this.pluginVersionResolver = pluginVersionResolver;
|
||||||
this.pluginManager = pluginManager;
|
this.pluginManager = pluginManager;
|
||||||
this.pluginPrefixResolver = pluginPrefixResolver;
|
this.pluginPrefixResolver = pluginPrefixResolver;
|
||||||
|
|
|
@ -67,20 +67,22 @@ import org.codehaus.plexus.util.StringUtils;
|
||||||
public class MojoExecutor
|
public class MojoExecutor
|
||||||
{
|
{
|
||||||
|
|
||||||
@Inject
|
private final BuildPluginManager pluginManager;
|
||||||
private BuildPluginManager pluginManager;
|
private final MavenPluginManager mavenPluginManager;
|
||||||
|
private final LifecycleDependencyResolver lifeCycleDependencyResolver;
|
||||||
|
private final ExecutionEventCatapult eventCatapult;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
private MavenPluginManager mavenPluginManager;
|
public MojoExecutor(
|
||||||
|
BuildPluginManager pluginManager,
|
||||||
@Inject
|
MavenPluginManager mavenPluginManager,
|
||||||
private LifecycleDependencyResolver lifeCycleDependencyResolver;
|
LifecycleDependencyResolver lifeCycleDependencyResolver,
|
||||||
|
ExecutionEventCatapult eventCatapult )
|
||||||
@Inject
|
|
||||||
private ExecutionEventCatapult eventCatapult;
|
|
||||||
|
|
||||||
public MojoExecutor()
|
|
||||||
{
|
{
|
||||||
|
this.pluginManager = pluginManager;
|
||||||
|
this.mavenPluginManager = mavenPluginManager;
|
||||||
|
this.lifeCycleDependencyResolver = lifeCycleDependencyResolver;
|
||||||
|
this.eventCatapult = eventCatapult;
|
||||||
}
|
}
|
||||||
|
|
||||||
public DependencyContext newDependencyContext( MavenSession session, List<MojoExecution> mojoExecutions )
|
public DependencyContext newDependencyContext( MavenSession session, List<MojoExecution> mojoExecutions )
|
||||||
|
|
|
@ -71,28 +71,22 @@ import org.codehaus.plexus.logging.Logger;
|
||||||
@Singleton
|
@Singleton
|
||||||
public class BuilderCommon
|
public class BuilderCommon
|
||||||
{
|
{
|
||||||
@Inject
|
private final Logger logger;
|
||||||
private LifecycleDebugLogger lifecycleDebugLogger;
|
private final LifecycleDebugLogger lifecycleDebugLogger;
|
||||||
|
private final LifecycleExecutionPlanCalculator lifeCycleExecutionPlanCalculator;
|
||||||
|
private final ExecutionEventCatapult eventCatapult;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
private LifecycleExecutionPlanCalculator lifeCycleExecutionPlanCalculator;
|
public BuilderCommon(
|
||||||
|
Logger logger,
|
||||||
@Inject
|
LifecycleDebugLogger lifecycleDebugLogger,
|
||||||
private ExecutionEventCatapult eventCatapult;
|
LifecycleExecutionPlanCalculator lifeCycleExecutionPlanCalculator,
|
||||||
|
ExecutionEventCatapult eventCatapult )
|
||||||
@Inject
|
|
||||||
private Logger logger;
|
|
||||||
|
|
||||||
public BuilderCommon()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
public BuilderCommon( LifecycleDebugLogger lifecycleDebugLogger,
|
|
||||||
LifecycleExecutionPlanCalculator lifeCycleExecutionPlanCalculator, Logger logger )
|
|
||||||
{
|
{
|
||||||
|
this.logger = logger;
|
||||||
this.lifecycleDebugLogger = lifecycleDebugLogger;
|
this.lifecycleDebugLogger = lifecycleDebugLogger;
|
||||||
this.lifeCycleExecutionPlanCalculator = lifeCycleExecutionPlanCalculator;
|
this.lifeCycleExecutionPlanCalculator = lifeCycleExecutionPlanCalculator;
|
||||||
this.logger = logger;
|
this.eventCatapult = eventCatapult;
|
||||||
}
|
}
|
||||||
|
|
||||||
public MavenExecutionPlan resolveBuildPlan( MavenSession session, MavenProject project, TaskSegment taskSegment,
|
public MavenExecutionPlan resolveBuildPlan( MavenSession session, MavenProject project, TaskSegment taskSegment,
|
||||||
|
|
|
@ -65,14 +65,14 @@ public class MultiThreadedBuilder
|
||||||
implements Builder
|
implements Builder
|
||||||
{
|
{
|
||||||
|
|
||||||
@Inject
|
private final Logger logger;
|
||||||
private Logger logger;
|
private final LifecycleModuleBuilder lifecycleModuleBuilder;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
private LifecycleModuleBuilder lifecycleModuleBuilder;
|
public MultiThreadedBuilder( Logger logger, LifecycleModuleBuilder lifecycleModuleBuilder )
|
||||||
|
|
||||||
public MultiThreadedBuilder()
|
|
||||||
{
|
{
|
||||||
|
this.logger = logger;
|
||||||
|
this.lifecycleModuleBuilder = lifecycleModuleBuilder;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -55,10 +55,15 @@ public class DefaultLifecycleBindingsInjector
|
||||||
implements LifecycleBindingsInjector
|
implements LifecycleBindingsInjector
|
||||||
{
|
{
|
||||||
|
|
||||||
private LifecycleBindingsMerger merger = new LifecycleBindingsMerger();
|
private final LifecycleBindingsMerger merger = new LifecycleBindingsMerger();
|
||||||
|
|
||||||
|
private final LifeCyclePluginAnalyzer lifecycle;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
private LifeCyclePluginAnalyzer lifecycle;
|
public DefaultLifecycleBindingsInjector( LifeCyclePluginAnalyzer lifecycle )
|
||||||
|
{
|
||||||
|
this.lifecycle = lifecycle;
|
||||||
|
}
|
||||||
|
|
||||||
public void injectLifecycleBindings( Model model, ModelBuildingRequest request, ModelProblemCollector problems )
|
public void injectLifecycleBindings( Model model, ModelBuildingRequest request, ModelProblemCollector problems )
|
||||||
{
|
{
|
||||||
|
|
|
@ -51,21 +51,22 @@ public class DefaultBuildPluginManager
|
||||||
implements BuildPluginManager
|
implements BuildPluginManager
|
||||||
{
|
{
|
||||||
|
|
||||||
@Inject
|
private final MavenPluginManager mavenPluginManager;
|
||||||
private MavenPluginManager mavenPluginManager;
|
private final LegacySupport legacySupport;
|
||||||
|
private final MojoExecutionScope scope;
|
||||||
|
private final MojoExecutionListener mojoExecutionListener;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
private LegacySupport legacySupport;
|
public DefaultBuildPluginManager(
|
||||||
|
MavenPluginManager mavenPluginManager,
|
||||||
@Inject
|
LegacySupport legacySupport,
|
||||||
private MojoExecutionScope scope;
|
MojoExecutionScope scope,
|
||||||
|
List<MojoExecutionListener> mojoExecutionListeners )
|
||||||
private MojoExecutionListener mojoExecutionListener;
|
|
||||||
|
|
||||||
@Inject
|
|
||||||
public void setMojoExecutionListeners( final List<MojoExecutionListener> listeners )
|
|
||||||
{
|
{
|
||||||
this.mojoExecutionListener = new CompoundMojoExecutionListener( listeners );
|
this.mavenPluginManager = mavenPluginManager;
|
||||||
|
this.legacySupport = legacySupport;
|
||||||
|
this.scope = scope;
|
||||||
|
this.mojoExecutionListener = new CompoundMojoExecutionListener( mojoExecutionListeners );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -132,48 +132,53 @@ public class DefaultMavenPluginManager
|
||||||
*/
|
*/
|
||||||
public static final String KEY_EXTENSIONS_REALMS = DefaultMavenPluginManager.class.getName() + "/extensionsRealms";
|
public static final String KEY_EXTENSIONS_REALMS = DefaultMavenPluginManager.class.getName() + "/extensionsRealms";
|
||||||
|
|
||||||
@Inject
|
|
||||||
private Logger logger;
|
private Logger logger;
|
||||||
|
|
||||||
@Inject
|
|
||||||
private LoggerManager loggerManager;
|
private LoggerManager loggerManager;
|
||||||
|
|
||||||
@Inject
|
|
||||||
private PlexusContainer container;
|
private PlexusContainer container;
|
||||||
|
|
||||||
@Inject
|
|
||||||
private ClassRealmManager classRealmManager;
|
private ClassRealmManager classRealmManager;
|
||||||
|
|
||||||
@Inject
|
|
||||||
private PluginDescriptorCache pluginDescriptorCache;
|
private PluginDescriptorCache pluginDescriptorCache;
|
||||||
|
|
||||||
@Inject
|
|
||||||
private PluginRealmCache pluginRealmCache;
|
private PluginRealmCache pluginRealmCache;
|
||||||
|
|
||||||
@Inject
|
|
||||||
private PluginDependenciesResolver pluginDependenciesResolver;
|
private PluginDependenciesResolver pluginDependenciesResolver;
|
||||||
|
|
||||||
@Inject
|
|
||||||
private RuntimeInformation runtimeInformation;
|
private RuntimeInformation runtimeInformation;
|
||||||
|
|
||||||
@Inject
|
|
||||||
private ExtensionRealmCache extensionRealmCache;
|
private ExtensionRealmCache extensionRealmCache;
|
||||||
|
|
||||||
@Inject
|
|
||||||
private PluginVersionResolver pluginVersionResolver;
|
private PluginVersionResolver pluginVersionResolver;
|
||||||
|
|
||||||
@Inject
|
|
||||||
private PluginArtifactsCache pluginArtifactsCache;
|
private PluginArtifactsCache pluginArtifactsCache;
|
||||||
|
|
||||||
@Inject
|
|
||||||
private MavenPluginValidator pluginValidator;
|
private MavenPluginValidator pluginValidator;
|
||||||
|
|
||||||
private ExtensionDescriptorBuilder extensionDescriptorBuilder = new ExtensionDescriptorBuilder();
|
private final ExtensionDescriptorBuilder extensionDescriptorBuilder = new ExtensionDescriptorBuilder();
|
||||||
|
private final PluginDescriptorBuilder builder = new PluginDescriptorBuilder();
|
||||||
|
|
||||||
private PluginDescriptorBuilder builder = new PluginDescriptorBuilder();
|
@Inject
|
||||||
|
public DefaultMavenPluginManager(
|
||||||
|
Logger logger,
|
||||||
|
LoggerManager loggerManager,
|
||||||
|
PlexusContainer container,
|
||||||
|
ClassRealmManager classRealmManager,
|
||||||
|
PluginDescriptorCache pluginDescriptorCache,
|
||||||
|
PluginRealmCache pluginRealmCache,
|
||||||
|
PluginDependenciesResolver pluginDependenciesResolver,
|
||||||
|
RuntimeInformation runtimeInformation,
|
||||||
|
ExtensionRealmCache extensionRealmCache,
|
||||||
|
PluginVersionResolver pluginVersionResolver,
|
||||||
|
PluginArtifactsCache pluginArtifactsCache,
|
||||||
|
MavenPluginValidator pluginValidator )
|
||||||
|
{
|
||||||
|
this.logger = logger;
|
||||||
|
this.loggerManager = loggerManager;
|
||||||
|
this.container = container;
|
||||||
|
this.classRealmManager = classRealmManager;
|
||||||
|
this.pluginDescriptorCache = pluginDescriptorCache;
|
||||||
|
this.pluginRealmCache = pluginRealmCache;
|
||||||
|
this.pluginDependenciesResolver = pluginDependenciesResolver;
|
||||||
|
this.runtimeInformation = runtimeInformation;
|
||||||
|
this.extensionRealmCache = extensionRealmCache;
|
||||||
|
this.pluginVersionResolver = pluginVersionResolver;
|
||||||
|
this.pluginArtifactsCache = pluginArtifactsCache;
|
||||||
|
this.pluginValidator = pluginValidator;
|
||||||
|
}
|
||||||
|
|
||||||
public synchronized PluginDescriptor getPluginDescriptor( Plugin plugin, List<RemoteRepository> repositories,
|
public synchronized PluginDescriptor getPluginDescriptor( Plugin plugin, List<RemoteRepository> repositories,
|
||||||
RepositorySystemSession session )
|
RepositorySystemSession session )
|
||||||
throws PluginResolutionException, PluginDescriptorParsingException, InvalidPluginDescriptorException
|
throws PluginResolutionException, PluginDescriptorParsingException, InvalidPluginDescriptorException
|
||||||
{
|
{
|
||||||
PluginDescriptorCache.Key cacheKey = pluginDescriptorCache.createKey( plugin, repositories, session );
|
PluginDescriptorCache.Key cacheKey = pluginDescriptorCache.createKey( plugin, repositories, session );
|
||||||
|
|
|
@ -78,11 +78,15 @@ public class DefaultPluginDependenciesResolver
|
||||||
|
|
||||||
private static final String REPOSITORY_CONTEXT = "plugin";
|
private static final String REPOSITORY_CONTEXT = "plugin";
|
||||||
|
|
||||||
@Inject
|
private final Logger logger;
|
||||||
private Logger logger;
|
private final RepositorySystem repoSystem;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
private RepositorySystem repoSystem;
|
public DefaultPluginDependenciesResolver( Logger logger, RepositorySystem repoSystem )
|
||||||
|
{
|
||||||
|
this.logger = logger;
|
||||||
|
this.repoSystem = repoSystem;
|
||||||
|
}
|
||||||
|
|
||||||
private Artifact toArtifact( Plugin plugin, RepositorySystemSession session )
|
private Artifact toArtifact( Plugin plugin, RepositorySystemSession session )
|
||||||
{
|
{
|
||||||
|
|
|
@ -70,20 +70,26 @@ public class DefaultPluginManager
|
||||||
implements PluginManager
|
implements PluginManager
|
||||||
{
|
{
|
||||||
|
|
||||||
@Inject
|
private final PlexusContainer container;
|
||||||
private PlexusContainer container;
|
private final MavenPluginManager pluginManager;
|
||||||
|
private final PluginVersionResolver pluginVersionResolver;
|
||||||
|
private final PluginPrefixResolver pluginPrefixResolver;
|
||||||
|
private final LegacySupport legacySupport;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
private MavenPluginManager pluginManager;
|
public DefaultPluginManager(
|
||||||
|
PlexusContainer container,
|
||||||
@Inject
|
MavenPluginManager pluginManager,
|
||||||
private PluginVersionResolver pluginVersionResolver;
|
PluginVersionResolver pluginVersionResolver,
|
||||||
|
PluginPrefixResolver pluginPrefixResolver,
|
||||||
@Inject
|
LegacySupport legacySupport )
|
||||||
private PluginPrefixResolver pluginPrefixResolver;
|
{
|
||||||
|
this.container = container;
|
||||||
@Inject
|
this.pluginManager = pluginManager;
|
||||||
private LegacySupport legacySupport;
|
this.pluginVersionResolver = pluginVersionResolver;
|
||||||
|
this.pluginPrefixResolver = pluginPrefixResolver;
|
||||||
|
this.legacySupport = legacySupport;
|
||||||
|
}
|
||||||
|
|
||||||
public void executeMojo( MavenProject project, MojoExecution execution, MavenSession session )
|
public void executeMojo( MavenProject project, MojoExecution execution, MavenSession session )
|
||||||
throws MojoExecutionException, ArtifactResolutionException, MojoFailureException, ArtifactNotFoundException,
|
throws MojoExecutionException, ArtifactResolutionException, MojoFailureException, ArtifactNotFoundException,
|
||||||
|
|
|
@ -68,17 +68,23 @@ public class DefaultPluginPrefixResolver
|
||||||
|
|
||||||
private static final String REPOSITORY_CONTEXT = "plugin";
|
private static final String REPOSITORY_CONTEXT = "plugin";
|
||||||
|
|
||||||
@Inject
|
private final Logger logger;
|
||||||
private Logger logger;
|
private final BuildPluginManager pluginManager;
|
||||||
|
private final RepositorySystem repositorySystem;
|
||||||
|
private final MetadataReader metadataReader;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
private BuildPluginManager pluginManager;
|
public DefaultPluginPrefixResolver(
|
||||||
|
Logger logger,
|
||||||
@Inject
|
BuildPluginManager pluginManager,
|
||||||
private RepositorySystem repositorySystem;
|
RepositorySystem repositorySystem,
|
||||||
|
MetadataReader metadataReader )
|
||||||
@Inject
|
{
|
||||||
private MetadataReader metadataReader;
|
this.logger = logger;
|
||||||
|
this.pluginManager = pluginManager;
|
||||||
|
this.repositorySystem = repositorySystem;
|
||||||
|
this.metadataReader = metadataReader;
|
||||||
|
}
|
||||||
|
|
||||||
public PluginPrefixResult resolve( PluginPrefixRequest request )
|
public PluginPrefixResult resolve( PluginPrefixRequest request )
|
||||||
throws NoPluginFoundForPrefixException
|
throws NoPluginFoundForPrefixException
|
||||||
|
|
|
@ -81,17 +81,23 @@ public class DefaultPluginVersionResolver
|
||||||
|
|
||||||
private static final Object CACHE_KEY = new Object();
|
private static final Object CACHE_KEY = new Object();
|
||||||
|
|
||||||
@Inject
|
private final Logger logger;
|
||||||
private Logger logger;
|
private final RepositorySystem repositorySystem;
|
||||||
|
private final MetadataReader metadataReader;
|
||||||
|
private final MavenPluginManager pluginManager;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
private RepositorySystem repositorySystem;
|
public DefaultPluginVersionResolver(
|
||||||
|
Logger logger,
|
||||||
@Inject
|
RepositorySystem repositorySystem,
|
||||||
private MetadataReader metadataReader;
|
MetadataReader metadataReader,
|
||||||
|
MavenPluginManager pluginManager )
|
||||||
@Inject
|
{
|
||||||
private MavenPluginManager pluginManager;
|
this.logger = logger;
|
||||||
|
this.repositorySystem = repositorySystem;
|
||||||
|
this.metadataReader = metadataReader;
|
||||||
|
this.pluginManager = pluginManager;
|
||||||
|
}
|
||||||
|
|
||||||
public PluginVersionResult resolve( PluginVersionRequest request )
|
public PluginVersionResult resolve( PluginVersionRequest request )
|
||||||
throws PluginVersionResolutionException
|
throws PluginVersionResolutionException
|
||||||
|
|
|
@ -75,6 +75,7 @@ import org.apache.maven.repository.internal.DefaultModelCache;
|
||||||
import org.codehaus.plexus.logging.Logger;
|
import org.codehaus.plexus.logging.Logger;
|
||||||
import org.codehaus.plexus.util.Os;
|
import org.codehaus.plexus.util.Os;
|
||||||
import org.codehaus.plexus.util.StringUtils;
|
import org.codehaus.plexus.util.StringUtils;
|
||||||
|
import org.eclipse.aether.RepositorySystem;
|
||||||
import org.eclipse.aether.RepositorySystemSession;
|
import org.eclipse.aether.RepositorySystemSession;
|
||||||
import org.eclipse.aether.RequestTrace;
|
import org.eclipse.aether.RequestTrace;
|
||||||
import org.eclipse.aether.impl.RemoteRepositoryManager;
|
import org.eclipse.aether.impl.RemoteRepositoryManager;
|
||||||
|
@ -93,31 +94,36 @@ public class DefaultProjectBuilder
|
||||||
implements ProjectBuilder
|
implements ProjectBuilder
|
||||||
{
|
{
|
||||||
|
|
||||||
@Inject
|
private final Logger logger;
|
||||||
private Logger logger;
|
private final ModelBuilder modelBuilder;
|
||||||
|
private final ModelProcessor modelProcessor;
|
||||||
|
private final ProjectBuildingHelper projectBuildingHelper;
|
||||||
|
private final MavenRepositorySystem repositorySystem;
|
||||||
|
private final org.eclipse.aether.RepositorySystem repoSystem;
|
||||||
|
private final RemoteRepositoryManager repositoryManager;
|
||||||
|
private final ProjectDependenciesResolver dependencyResolver;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
private ModelBuilder modelBuilder;
|
public DefaultProjectBuilder(
|
||||||
|
Logger logger,
|
||||||
@Inject
|
ModelBuilder modelBuilder,
|
||||||
private ModelProcessor modelProcessor;
|
ModelProcessor modelProcessor,
|
||||||
|
ProjectBuildingHelper projectBuildingHelper,
|
||||||
@Inject
|
MavenRepositorySystem repositorySystem,
|
||||||
private ProjectBuildingHelper projectBuildingHelper;
|
RepositorySystem repoSystem,
|
||||||
|
RemoteRepositoryManager repositoryManager,
|
||||||
@Inject
|
ProjectDependenciesResolver dependencyResolver )
|
||||||
private MavenRepositorySystem repositorySystem;
|
{
|
||||||
|
this.logger = logger;
|
||||||
@Inject
|
this.modelBuilder = modelBuilder;
|
||||||
private org.eclipse.aether.RepositorySystem repoSystem;
|
this.modelProcessor = modelProcessor;
|
||||||
|
this.projectBuildingHelper = projectBuildingHelper;
|
||||||
@Inject
|
this.repositorySystem = repositorySystem;
|
||||||
private RemoteRepositoryManager repositoryManager;
|
this.repoSystem = repoSystem;
|
||||||
|
this.repositoryManager = repositoryManager;
|
||||||
@Inject
|
this.dependencyResolver = dependencyResolver;
|
||||||
private ProjectDependenciesResolver dependencyResolver;
|
}
|
||||||
|
// ----------------------------------------------------------------------
|
||||||
// ----------------------------------------------------------------------
|
|
||||||
// MavenProjectBuilder Implementation
|
// MavenProjectBuilder Implementation
|
||||||
// ----------------------------------------------------------------------
|
// ----------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
|
@ -68,23 +68,29 @@ public class DefaultProjectBuildingHelper
|
||||||
implements ProjectBuildingHelper
|
implements ProjectBuildingHelper
|
||||||
{
|
{
|
||||||
|
|
||||||
@Inject
|
private final Logger logger;
|
||||||
private Logger logger;
|
private final PlexusContainer container;
|
||||||
|
private final ClassRealmManager classRealmManager;
|
||||||
|
private final ProjectRealmCache projectRealmCache;
|
||||||
|
private final RepositorySystem repositorySystem;
|
||||||
|
private final MavenPluginManager pluginManager;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
private PlexusContainer container;
|
public DefaultProjectBuildingHelper(
|
||||||
|
Logger logger,
|
||||||
@Inject
|
PlexusContainer container,
|
||||||
private ClassRealmManager classRealmManager;
|
ClassRealmManager classRealmManager,
|
||||||
|
ProjectRealmCache projectRealmCache,
|
||||||
@Inject
|
RepositorySystem repositorySystem,
|
||||||
private ProjectRealmCache projectRealmCache;
|
MavenPluginManager pluginManager )
|
||||||
|
{
|
||||||
@Inject
|
this.logger = logger;
|
||||||
private RepositorySystem repositorySystem;
|
this.container = container;
|
||||||
|
this.classRealmManager = classRealmManager;
|
||||||
@Inject
|
this.projectRealmCache = projectRealmCache;
|
||||||
private MavenPluginManager pluginManager;
|
this.repositorySystem = repositorySystem;
|
||||||
|
this.pluginManager = pluginManager;
|
||||||
|
}
|
||||||
|
|
||||||
public List<ArtifactRepository> createArtifactRepositories( List<Repository> pomRepositories,
|
public List<ArtifactRepository> createArtifactRepositories( List<Repository> pomRepositories,
|
||||||
List<ArtifactRepository> externalRepositories,
|
List<ArtifactRepository> externalRepositories,
|
||||||
|
|
|
@ -62,14 +62,20 @@ public class DefaultProjectDependenciesResolver
|
||||||
implements ProjectDependenciesResolver
|
implements ProjectDependenciesResolver
|
||||||
{
|
{
|
||||||
|
|
||||||
@Inject
|
private final Logger logger;
|
||||||
private Logger logger;
|
private final RepositorySystem repoSystem;
|
||||||
|
private final List<RepositorySessionDecorator> decorators;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
private RepositorySystem repoSystem;
|
public DefaultProjectDependenciesResolver(
|
||||||
|
Logger logger,
|
||||||
@Inject
|
RepositorySystem repoSystem,
|
||||||
private List<RepositorySessionDecorator> decorators;
|
List<RepositorySessionDecorator> decorators )
|
||||||
|
{
|
||||||
|
this.logger = logger;
|
||||||
|
this.repoSystem = repoSystem;
|
||||||
|
this.decorators = decorators;
|
||||||
|
}
|
||||||
|
|
||||||
public DependencyResolutionResult resolve( DependencyResolutionRequest request )
|
public DependencyResolutionResult resolve( DependencyResolutionRequest request )
|
||||||
throws DependencyResolutionException
|
throws DependencyResolutionException
|
||||||
|
|
|
@ -19,9 +19,16 @@ package org.apache.maven.project.artifact;
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import javax.inject.Inject;
|
||||||
import javax.inject.Named;
|
import javax.inject.Named;
|
||||||
import javax.inject.Singleton;
|
import javax.inject.Singleton;
|
||||||
|
|
||||||
|
import org.apache.maven.artifact.factory.ArtifactFactory;
|
||||||
|
import org.apache.maven.artifact.repository.metadata.RepositoryMetadataManager;
|
||||||
|
import org.apache.maven.plugin.LegacySupport;
|
||||||
|
import org.apache.maven.project.ProjectBuilder;
|
||||||
|
import org.codehaus.plexus.logging.Logger;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This realizes the metadata source via the default hint to provide backward-compat with Maven 2.x whose Plexus version
|
* This realizes the metadata source via the default hint to provide backward-compat with Maven 2.x whose Plexus version
|
||||||
* registered component descriptors twice: once keyed by role+roleHint and once keyed by role only. This effectively
|
* registered component descriptors twice: once keyed by role+roleHint and once keyed by role only. This effectively
|
||||||
|
@ -34,5 +41,11 @@ import javax.inject.Singleton;
|
||||||
public class DefaultMetadataSource
|
public class DefaultMetadataSource
|
||||||
extends MavenMetadataSource
|
extends MavenMetadataSource
|
||||||
{
|
{
|
||||||
|
@Inject
|
||||||
|
public DefaultMetadataSource(
|
||||||
|
Logger logger, RepositoryMetadataManager repositoryMetadataManager, ArtifactFactory repositorySystem,
|
||||||
|
ProjectBuilder projectBuilder, MavenMetadataCache cache, LegacySupport legacySupport )
|
||||||
|
{
|
||||||
|
super( logger, repositoryMetadataManager, repositorySystem, projectBuilder, cache, legacySupport );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -78,8 +78,6 @@ import org.apache.maven.properties.internal.SystemProperties;
|
||||||
import org.apache.maven.repository.internal.MavenWorkspaceReader;
|
import org.apache.maven.repository.internal.MavenWorkspaceReader;
|
||||||
import org.apache.maven.repository.legacy.metadata.DefaultMetadataResolutionRequest;
|
import org.apache.maven.repository.legacy.metadata.DefaultMetadataResolutionRequest;
|
||||||
import org.apache.maven.repository.legacy.metadata.MetadataResolutionRequest;
|
import org.apache.maven.repository.legacy.metadata.MetadataResolutionRequest;
|
||||||
import org.codehaus.plexus.PlexusContainer;
|
|
||||||
import org.codehaus.plexus.component.repository.exception.ComponentLookupException;
|
|
||||||
import org.codehaus.plexus.logging.Logger;
|
import org.codehaus.plexus.logging.Logger;
|
||||||
import org.eclipse.aether.RepositorySystemSession;
|
import org.eclipse.aether.RepositorySystemSession;
|
||||||
import org.eclipse.aether.repository.RepositoryPolicy;
|
import org.eclipse.aether.repository.RepositoryPolicy;
|
||||||
|
@ -94,27 +92,30 @@ import org.eclipse.aether.transfer.ArtifactNotFoundException;
|
||||||
public class MavenMetadataSource
|
public class MavenMetadataSource
|
||||||
implements ArtifactMetadataSource
|
implements ArtifactMetadataSource
|
||||||
{
|
{
|
||||||
@Inject
|
|
||||||
private RepositoryMetadataManager repositoryMetadataManager;
|
|
||||||
|
|
||||||
@Inject
|
|
||||||
private ArtifactFactory repositorySystem;
|
|
||||||
|
|
||||||
//TODO This prevents a cycle in the composition which shows us another problem we need to deal with.
|
|
||||||
//@Inject
|
|
||||||
private ProjectBuilder projectBuilder;
|
|
||||||
|
|
||||||
@Inject
|
|
||||||
private PlexusContainer container;
|
|
||||||
|
|
||||||
@Inject
|
|
||||||
private Logger logger;
|
private Logger logger;
|
||||||
|
private RepositoryMetadataManager repositoryMetadataManager;
|
||||||
@Inject
|
private ArtifactFactory repositorySystem;
|
||||||
|
private ProjectBuilder projectBuilder;
|
||||||
private MavenMetadataCache cache;
|
private MavenMetadataCache cache;
|
||||||
|
private LegacySupport legacySupport;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
private LegacySupport legacySupport;
|
public MavenMetadataSource(
|
||||||
|
Logger logger,
|
||||||
|
RepositoryMetadataManager repositoryMetadataManager,
|
||||||
|
ArtifactFactory repositorySystem,
|
||||||
|
ProjectBuilder projectBuilder,
|
||||||
|
MavenMetadataCache cache,
|
||||||
|
LegacySupport legacySupport )
|
||||||
|
{
|
||||||
|
this.logger = logger;
|
||||||
|
this.repositoryMetadataManager = repositoryMetadataManager;
|
||||||
|
this.repositorySystem = repositorySystem;
|
||||||
|
this.projectBuilder = projectBuilder;
|
||||||
|
this.cache = cache;
|
||||||
|
this.legacySupport = legacySupport;
|
||||||
|
}
|
||||||
|
|
||||||
private void injectSession( MetadataResolutionRequest request )
|
private void injectSession( MetadataResolutionRequest request )
|
||||||
{
|
{
|
||||||
|
@ -535,24 +536,6 @@ public class MavenMetadataSource
|
||||||
return artifacts;
|
return artifacts;
|
||||||
}
|
}
|
||||||
|
|
||||||
private ProjectBuilder getProjectBuilder()
|
|
||||||
{
|
|
||||||
if ( projectBuilder != null )
|
|
||||||
{
|
|
||||||
return projectBuilder;
|
|
||||||
}
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
projectBuilder = container.lookup( ProjectBuilder.class );
|
|
||||||
}
|
|
||||||
catch ( ComponentLookupException e )
|
|
||||||
{
|
|
||||||
// Won't happen
|
|
||||||
}
|
|
||||||
|
|
||||||
return projectBuilder;
|
|
||||||
}
|
|
||||||
@SuppressWarnings( "checkstyle:methodlength" )
|
@SuppressWarnings( "checkstyle:methodlength" )
|
||||||
private ProjectRelocation retrieveRelocatedProject( Artifact artifact, MetadataResolutionRequest repositoryRequest )
|
private ProjectRelocation retrieveRelocatedProject( Artifact artifact, MetadataResolutionRequest repositoryRequest )
|
||||||
throws ArtifactMetadataRetrievalException
|
throws ArtifactMetadataRetrievalException
|
||||||
|
@ -593,7 +576,7 @@ public class MavenMetadataSource
|
||||||
configuration.setSystemProperties( getSystemProperties() );
|
configuration.setSystemProperties( getSystemProperties() );
|
||||||
configuration.setRepositorySession( legacySupport.getRepositorySession() );
|
configuration.setRepositorySession( legacySupport.getRepositorySession() );
|
||||||
|
|
||||||
project = getProjectBuilder().build( pomArtifact, configuration ).getProject();
|
project = projectBuilder.build( pomArtifact, configuration ).getProject();
|
||||||
}
|
}
|
||||||
catch ( ProjectBuildingException e )
|
catch ( ProjectBuildingException e )
|
||||||
{
|
{
|
||||||
|
|
|
@ -46,11 +46,16 @@ public class DefaultRuntimeInformation
|
||||||
implements RuntimeInformation
|
implements RuntimeInformation
|
||||||
{
|
{
|
||||||
|
|
||||||
@Inject
|
private final Logger logger;
|
||||||
private Logger logger;
|
|
||||||
|
|
||||||
private String mavenVersion;
|
private String mavenVersion;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
public DefaultRuntimeInformation( Logger logger )
|
||||||
|
{
|
||||||
|
this.logger = logger;
|
||||||
|
}
|
||||||
|
|
||||||
public String getMavenVersion()
|
public String getMavenVersion()
|
||||||
{
|
{
|
||||||
if ( mavenVersion == null )
|
if ( mavenVersion == null )
|
||||||
|
|
|
@ -46,8 +46,13 @@ public class DefaultMavenSettingsBuilder
|
||||||
implements MavenSettingsBuilder
|
implements MavenSettingsBuilder
|
||||||
{
|
{
|
||||||
|
|
||||||
|
private final SettingsBuilder settingsBuilder;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
private SettingsBuilder settingsBuilder;
|
public DefaultMavenSettingsBuilder( SettingsBuilder settingsBuilder )
|
||||||
|
{
|
||||||
|
this.settingsBuilder = settingsBuilder;
|
||||||
|
}
|
||||||
|
|
||||||
public Settings buildSettings()
|
public Settings buildSettings()
|
||||||
throws IOException, XmlPullParserException
|
throws IOException, XmlPullParserException
|
||||||
|
|
|
@ -43,11 +43,15 @@ import org.codehaus.plexus.logging.Logger;
|
||||||
public class DefaultToolchainManager
|
public class DefaultToolchainManager
|
||||||
implements ToolchainManager
|
implements ToolchainManager
|
||||||
{
|
{
|
||||||
@Inject
|
final Logger logger;
|
||||||
Logger logger;
|
final Map<String, ToolchainFactory> factories;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
Map<String, ToolchainFactory> factories;
|
public DefaultToolchainManager( Logger logger, Map<String, ToolchainFactory> factories )
|
||||||
|
{
|
||||||
|
this.logger = logger;
|
||||||
|
this.factories = factories;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Toolchain getToolchainFromBuildContext( String type, MavenSession session )
|
public Toolchain getToolchainFromBuildContext( String type, MavenSession session )
|
||||||
|
|
|
@ -23,11 +23,13 @@ import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
import javax.inject.Inject;
|
||||||
import javax.inject.Named;
|
import javax.inject.Named;
|
||||||
import javax.inject.Singleton;
|
import javax.inject.Singleton;
|
||||||
|
|
||||||
import org.apache.maven.execution.MavenSession;
|
import org.apache.maven.execution.MavenSession;
|
||||||
import org.apache.maven.toolchain.model.ToolchainModel;
|
import org.apache.maven.toolchain.model.ToolchainModel;
|
||||||
|
import org.codehaus.plexus.logging.Logger;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author mkleint
|
* @author mkleint
|
||||||
|
@ -40,6 +42,12 @@ public class DefaultToolchainManagerPrivate
|
||||||
implements ToolchainManagerPrivate
|
implements ToolchainManagerPrivate
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
public DefaultToolchainManagerPrivate( Logger logger, Map<String, ToolchainFactory> factories )
|
||||||
|
{
|
||||||
|
super( logger, factories );
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ToolchainPrivate[] getToolchainsForType( String type, MavenSession context )
|
public ToolchainPrivate[] getToolchainsForType( String type, MavenSession context )
|
||||||
throws MisconfiguredToolchainException
|
throws MisconfiguredToolchainException
|
||||||
|
|
|
@ -42,8 +42,13 @@ public class DefaultToolchainsBuilder
|
||||||
implements ToolchainsBuilder
|
implements ToolchainsBuilder
|
||||||
{
|
{
|
||||||
|
|
||||||
|
private final Logger logger;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
private Logger logger;
|
public DefaultToolchainsBuilder( Logger logger )
|
||||||
|
{
|
||||||
|
this.logger = logger;
|
||||||
|
}
|
||||||
|
|
||||||
public PersistedToolchains build( File userToolchainsFile )
|
public PersistedToolchains build( File userToolchainsFile )
|
||||||
throws MisconfiguredToolchainException
|
throws MisconfiguredToolchainException
|
||||||
|
|
|
@ -53,13 +53,18 @@ import java.util.Map;
|
||||||
public class DefaultToolchainsBuilder
|
public class DefaultToolchainsBuilder
|
||||||
implements ToolchainsBuilder
|
implements ToolchainsBuilder
|
||||||
{
|
{
|
||||||
private MavenToolchainMerger toolchainsMerger = new MavenToolchainMerger();
|
private final MavenToolchainMerger toolchainsMerger = new MavenToolchainMerger();
|
||||||
|
|
||||||
@Inject
|
|
||||||
private ToolchainsWriter toolchainsWriter;
|
private ToolchainsWriter toolchainsWriter;
|
||||||
|
private ToolchainsReader toolchainsReader;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
private ToolchainsReader toolchainsReader;
|
public DefaultToolchainsBuilder(
|
||||||
|
ToolchainsWriter toolchainsWriter,
|
||||||
|
ToolchainsReader toolchainsReader )
|
||||||
|
{
|
||||||
|
this.toolchainsWriter = toolchainsWriter;
|
||||||
|
this.toolchainsReader = toolchainsReader;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ToolchainsBuildingResult build( ToolchainsBuildingRequest request )
|
public ToolchainsBuildingResult build( ToolchainsBuildingRequest request )
|
||||||
|
|
|
@ -51,9 +51,14 @@ public class JavaToolchainFactory
|
||||||
implements ToolchainFactory
|
implements ToolchainFactory
|
||||||
{
|
{
|
||||||
|
|
||||||
@Inject
|
|
||||||
private Logger logger;
|
private Logger logger;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
public JavaToolchainFactory( Logger logger )
|
||||||
|
{
|
||||||
|
this.logger = logger;
|
||||||
|
}
|
||||||
|
|
||||||
public ToolchainPrivate createToolchain( ToolchainModel model )
|
public ToolchainPrivate createToolchain( ToolchainModel model )
|
||||||
throws MisconfiguredToolchainException
|
throws MisconfiguredToolchainException
|
||||||
{
|
{
|
||||||
|
|
|
@ -28,6 +28,7 @@ import javax.inject.Singleton;
|
||||||
import org.apache.maven.execution.MojoExecutionEvent;
|
import org.apache.maven.execution.MojoExecutionEvent;
|
||||||
import org.apache.maven.execution.MojoExecutionListener;
|
import org.apache.maven.execution.MojoExecutionListener;
|
||||||
import org.apache.maven.plugin.MojoExecutionException;
|
import org.apache.maven.plugin.MojoExecutionException;
|
||||||
|
import org.eclipse.sisu.Priority;
|
||||||
|
|
||||||
@Named
|
@Named
|
||||||
@Singleton
|
@Singleton
|
||||||
|
|
|
@ -98,8 +98,7 @@ public class BuilderCommonTest
|
||||||
public BuilderCommon getBuilderCommon()
|
public BuilderCommon getBuilderCommon()
|
||||||
{
|
{
|
||||||
final LifecycleDebugLogger debugLogger = new LifecycleDebugLogger( logger );
|
final LifecycleDebugLogger debugLogger = new LifecycleDebugLogger( logger );
|
||||||
return new BuilderCommon( debugLogger, new LifecycleExecutionPlanCalculatorStub(),
|
return new BuilderCommon( logger, debugLogger, new LifecycleExecutionPlanCalculatorStub(), null );
|
||||||
logger );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -72,7 +72,7 @@ public class LifecycleExecutionPlanCalculatorTest
|
||||||
|
|
||||||
public static MojoDescriptorCreator createMojoDescriptorCreator()
|
public static MojoDescriptorCreator createMojoDescriptorCreator()
|
||||||
{
|
{
|
||||||
return new MojoDescriptorCreator( new PluginVersionResolverStub(), new BuildPluginManagerStub(),
|
return new MojoDescriptorCreator( null, new PluginVersionResolverStub(), new BuildPluginManagerStub(),
|
||||||
new PluginPrefixResolverStub(),
|
new PluginPrefixResolverStub(),
|
||||||
new LifecyclePluginResolver( new PluginVersionResolverStub() ) );
|
new LifecyclePluginResolver( new PluginVersionResolverStub() ) );
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,8 +17,10 @@ package org.apache.maven.lifecycle.internal.stub;
|
||||||
|
|
||||||
import org.apache.maven.execution.MavenSession;
|
import org.apache.maven.execution.MavenSession;
|
||||||
import org.apache.maven.lifecycle.internal.GoalTask;
|
import org.apache.maven.lifecycle.internal.GoalTask;
|
||||||
|
import org.apache.maven.lifecycle.internal.LifecyclePluginResolver;
|
||||||
import org.apache.maven.lifecycle.internal.LifecycleTask;
|
import org.apache.maven.lifecycle.internal.LifecycleTask;
|
||||||
import org.apache.maven.lifecycle.internal.DefaultLifecycleTaskSegmentCalculator;
|
import org.apache.maven.lifecycle.internal.DefaultLifecycleTaskSegmentCalculator;
|
||||||
|
import org.apache.maven.lifecycle.internal.MojoDescriptorCreator;
|
||||||
import org.apache.maven.lifecycle.internal.TaskSegment;
|
import org.apache.maven.lifecycle.internal.TaskSegment;
|
||||||
import org.apache.maven.plugin.InvalidPluginDescriptorException;
|
import org.apache.maven.plugin.InvalidPluginDescriptorException;
|
||||||
import org.apache.maven.plugin.MojoNotFoundException;
|
import org.apache.maven.plugin.MojoNotFoundException;
|
||||||
|
@ -43,8 +45,12 @@ public class LifecycleTaskSegmentCalculatorStub
|
||||||
|
|
||||||
public static final String install = "install";
|
public static final String install = "install";
|
||||||
|
|
||||||
|
public LifecycleTaskSegmentCalculatorStub()
|
||||||
|
{
|
||||||
|
super( null, null );
|
||||||
|
}
|
||||||
|
|
||||||
public List<TaskSegment> calculateTaskSegments( MavenSession session, List<String> tasks )
|
public List<TaskSegment> calculateTaskSegments(MavenSession session, List<String> tasks )
|
||||||
throws PluginNotFoundException, PluginResolutionException, PluginDescriptorParsingException,
|
throws PluginNotFoundException, PluginResolutionException, PluginDescriptorParsingException,
|
||||||
MojoNotFoundException, NoPluginFoundForPrefixException, InvalidPluginDescriptorException,
|
MojoNotFoundException, NoPluginFoundForPrefixException, InvalidPluginDescriptorException,
|
||||||
PluginVersionResolutionException
|
PluginVersionResolutionException
|
||||||
|
|
|
@ -18,9 +18,13 @@ package org.apache.maven.lifecycle.internal.stub;
|
||||||
import org.apache.maven.execution.MavenSession;
|
import org.apache.maven.execution.MavenSession;
|
||||||
import org.apache.maven.lifecycle.LifecycleExecutionException;
|
import org.apache.maven.lifecycle.LifecycleExecutionException;
|
||||||
import org.apache.maven.lifecycle.internal.DependencyContext;
|
import org.apache.maven.lifecycle.internal.DependencyContext;
|
||||||
|
import org.apache.maven.lifecycle.internal.ExecutionEventCatapult;
|
||||||
|
import org.apache.maven.lifecycle.internal.LifecycleDependencyResolver;
|
||||||
import org.apache.maven.lifecycle.internal.MojoExecutor;
|
import org.apache.maven.lifecycle.internal.MojoExecutor;
|
||||||
import org.apache.maven.lifecycle.internal.PhaseRecorder;
|
import org.apache.maven.lifecycle.internal.PhaseRecorder;
|
||||||
import org.apache.maven.lifecycle.internal.ProjectIndex;
|
import org.apache.maven.lifecycle.internal.ProjectIndex;
|
||||||
|
import org.apache.maven.plugin.BuildPluginManager;
|
||||||
|
import org.apache.maven.plugin.MavenPluginManager;
|
||||||
import org.apache.maven.plugin.MojoExecution;
|
import org.apache.maven.plugin.MojoExecution;
|
||||||
import org.apache.maven.plugin.descriptor.MojoDescriptor;
|
import org.apache.maven.plugin.descriptor.MojoDescriptor;
|
||||||
import org.apache.maven.plugin.descriptor.PluginDescriptor;
|
import org.apache.maven.plugin.descriptor.PluginDescriptor;
|
||||||
|
@ -36,7 +40,16 @@ public class MojoExecutorStub
|
||||||
extends MojoExecutor
|
extends MojoExecutor
|
||||||
{ // This is being lazy instead of making interface
|
{ // This is being lazy instead of making interface
|
||||||
|
|
||||||
public List<MojoExecution> executions = Collections.synchronizedList(new ArrayList<>() );
|
public final List<MojoExecution> executions = Collections.synchronizedList(new ArrayList<>() );
|
||||||
|
|
||||||
|
public MojoExecutorStub(
|
||||||
|
BuildPluginManager pluginManager,
|
||||||
|
MavenPluginManager mavenPluginManager,
|
||||||
|
LifecycleDependencyResolver lifeCycleDependencyResolver,
|
||||||
|
ExecutionEventCatapult eventCatapult )
|
||||||
|
{
|
||||||
|
super( pluginManager, mavenPluginManager, lifeCycleDependencyResolver, eventCatapult );
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute( MavenSession session, MojoExecution mojoExecution, ProjectIndex projectIndex,
|
public void execute( MavenSession session, MojoExecution mojoExecution, ProjectIndex projectIndex,
|
||||||
|
|
|
@ -25,10 +25,15 @@ import javax.inject.Named;
|
||||||
import javax.inject.Singleton;
|
import javax.inject.Singleton;
|
||||||
|
|
||||||
import org.apache.maven.artifact.Artifact;
|
import org.apache.maven.artifact.Artifact;
|
||||||
|
import org.apache.maven.artifact.factory.ArtifactFactory;
|
||||||
import org.apache.maven.artifact.metadata.ArtifactMetadataRetrievalException;
|
import org.apache.maven.artifact.metadata.ArtifactMetadataRetrievalException;
|
||||||
import org.apache.maven.artifact.metadata.ResolutionGroup;
|
import org.apache.maven.artifact.metadata.ResolutionGroup;
|
||||||
import org.apache.maven.artifact.repository.ArtifactRepository;
|
import org.apache.maven.artifact.repository.ArtifactRepository;
|
||||||
|
import org.apache.maven.artifact.repository.metadata.RepositoryMetadataManager;
|
||||||
|
import org.apache.maven.plugin.LegacySupport;
|
||||||
|
import org.apache.maven.project.artifact.MavenMetadataCache;
|
||||||
import org.apache.maven.project.artifact.MavenMetadataSource;
|
import org.apache.maven.project.artifact.MavenMetadataSource;
|
||||||
|
import org.codehaus.plexus.logging.Logger;
|
||||||
|
|
||||||
@SuppressWarnings( "deprecation" )
|
@SuppressWarnings( "deprecation" )
|
||||||
@Named( "classpath" )
|
@Named( "classpath" )
|
||||||
|
@ -36,6 +41,11 @@ import org.apache.maven.project.artifact.MavenMetadataSource;
|
||||||
public class TestMetadataSource
|
public class TestMetadataSource
|
||||||
extends MavenMetadataSource
|
extends MavenMetadataSource
|
||||||
{
|
{
|
||||||
|
|
||||||
|
public TestMetadataSource( Logger logger, RepositoryMetadataManager repositoryMetadataManager, ArtifactFactory repositorySystem, ProjectBuilder projectBuilder, MavenMetadataCache cache, LegacySupport legacySupport) {
|
||||||
|
super( logger, repositoryMetadataManager, repositorySystem, projectBuilder, cache, legacySupport );
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ResolutionGroup retrieve( Artifact artifact, ArtifactRepository localRepository,
|
public ResolutionGroup retrieve( Artifact artifact, ArtifactRepository localRepository,
|
||||||
List<ArtifactRepository> remoteRepositories )
|
List<ArtifactRepository> remoteRepositories )
|
||||||
|
|
|
@ -60,13 +60,13 @@ public class DefaultToolchainManagerPrivateTest
|
||||||
@BeforeEach
|
@BeforeEach
|
||||||
public void setUp()
|
public void setUp()
|
||||||
{
|
{
|
||||||
toolchainManager = new DefaultToolchainManagerPrivate();
|
|
||||||
|
|
||||||
MockitoAnnotations.initMocks( this );
|
MockitoAnnotations.initMocks( this );
|
||||||
|
|
||||||
toolchainManager.factories = new HashMap<>();
|
Map<String, ToolchainFactory> factories = new HashMap<>();
|
||||||
toolchainManager.factories.put( "basic", toolchainFactory_basicType );
|
factories.put( "basic", toolchainFactory_basicType );
|
||||||
toolchainManager.factories.put( "rare", toolchainFactory_rareType );
|
factories.put( "rare", toolchainFactory_rareType );
|
||||||
|
toolchainManager = new DefaultToolchainManagerPrivate( logger, factories );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
|
@ -61,13 +61,12 @@ public class DefaultToolchainManagerTest
|
||||||
@BeforeEach
|
@BeforeEach
|
||||||
public void onSetup() throws Exception
|
public void onSetup() throws Exception
|
||||||
{
|
{
|
||||||
toolchainManager = new DefaultToolchainManager();
|
|
||||||
|
|
||||||
MockitoAnnotations.initMocks( this );
|
MockitoAnnotations.initMocks( this );
|
||||||
|
|
||||||
toolchainManager.factories = new HashMap<>();
|
Map<String, ToolchainFactory> factories = new HashMap<>();
|
||||||
toolchainManager.factories.put( "basic", toolchainFactory_basicType );
|
factories.put( "basic", toolchainFactory_basicType );
|
||||||
toolchainManager.factories.put( "rare", toolchainFactory_rareType );
|
factories.put( "rare", toolchainFactory_rareType );
|
||||||
|
toolchainManager = new DefaultToolchainManager( logger, factories );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
|
@ -73,11 +73,17 @@ public class SettingsXmlConfigurationProcessor
|
||||||
|
|
||||||
private static final Logger LOGGER = LoggerFactory.getLogger( SettingsXmlConfigurationProcessor.class );
|
private static final Logger LOGGER = LoggerFactory.getLogger( SettingsXmlConfigurationProcessor.class );
|
||||||
|
|
||||||
@Inject
|
private final SettingsBuilder settingsBuilder;
|
||||||
private SettingsBuilder settingsBuilder;
|
private final SettingsDecrypter settingsDecrypter;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
private SettingsDecrypter settingsDecrypter;
|
public SettingsXmlConfigurationProcessor(
|
||||||
|
SettingsBuilder settingsBuilder,
|
||||||
|
SettingsDecrypter settingsDecrypter )
|
||||||
|
{
|
||||||
|
this.settingsBuilder = settingsBuilder;
|
||||||
|
this.settingsDecrypter = settingsDecrypter;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void process( CliRequest cliRequest )
|
public void process( CliRequest cliRequest )
|
||||||
|
|
|
@ -103,170 +103,321 @@ import org.eclipse.sisu.Nullable;
|
||||||
public class DefaultModelBuilder
|
public class DefaultModelBuilder
|
||||||
implements ModelBuilder
|
implements ModelBuilder
|
||||||
{
|
{
|
||||||
@Inject
|
private final ModelMerger modelMerger = new FileToRawModelMerger();
|
||||||
private ModelProcessor modelProcessor;
|
|
||||||
|
private final ModelProcessor modelProcessor;
|
||||||
|
private final ModelValidator modelValidator;
|
||||||
|
private final ModelNormalizer modelNormalizer;
|
||||||
|
private final ModelInterpolator modelInterpolator;
|
||||||
|
private final ModelPathTranslator modelPathTranslator;
|
||||||
|
private final ModelUrlNormalizer modelUrlNormalizer;
|
||||||
|
private final SuperPomProvider superPomProvider;
|
||||||
|
private final InheritanceAssembler inheritanceAssembler;
|
||||||
|
private final ProfileSelector profileSelector;
|
||||||
|
private final ProfileInjector profileInjector;
|
||||||
|
private final PluginManagementInjector pluginManagementInjector;
|
||||||
|
private final DependencyManagementInjector dependencyManagementInjector;
|
||||||
|
private final DependencyManagementImporter dependencyManagementImporter;
|
||||||
|
private final LifecycleBindingsInjector lifecycleBindingsInjector;
|
||||||
|
private final PluginConfigurationExpander pluginConfigurationExpander;
|
||||||
|
private final ReportConfigurationExpander reportConfigurationExpander;
|
||||||
|
private final ReportingConverter reportingConverter;
|
||||||
|
private final ProfileActivationFilePathInterpolator profileActivationFilePathInterpolator;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
private ModelValidator modelValidator;
|
public DefaultModelBuilder(
|
||||||
|
ModelProcessor modelProcessor,
|
||||||
@Inject
|
ModelValidator modelValidator,
|
||||||
private ModelNormalizer modelNormalizer;
|
ModelNormalizer modelNormalizer,
|
||||||
|
ModelInterpolator modelInterpolator,
|
||||||
@Inject
|
ModelPathTranslator modelPathTranslator,
|
||||||
private ModelInterpolator modelInterpolator;
|
ModelUrlNormalizer modelUrlNormalizer,
|
||||||
|
SuperPomProvider superPomProvider,
|
||||||
@Inject
|
InheritanceAssembler inheritanceAssembler,
|
||||||
private ModelPathTranslator modelPathTranslator;
|
ProfileSelector profileSelector,
|
||||||
|
ProfileInjector profileInjector,
|
||||||
@Inject
|
PluginManagementInjector pluginManagementInjector,
|
||||||
private ModelUrlNormalizer modelUrlNormalizer;
|
DependencyManagementInjector dependencyManagementInjector,
|
||||||
|
DependencyManagementImporter dependencyManagementImporter,
|
||||||
@Inject
|
@Nullable LifecycleBindingsInjector lifecycleBindingsInjector,
|
||||||
private SuperPomProvider superPomProvider;
|
PluginConfigurationExpander pluginConfigurationExpander,
|
||||||
|
ReportConfigurationExpander reportConfigurationExpander,
|
||||||
@Inject
|
ReportingConverter reportingConverter,
|
||||||
private InheritanceAssembler inheritanceAssembler;
|
ProfileActivationFilePathInterpolator profileActivationFilePathInterpolator )
|
||||||
|
|
||||||
@Inject
|
|
||||||
private ProfileSelector profileSelector;
|
|
||||||
|
|
||||||
@Inject
|
|
||||||
private ProfileInjector profileInjector;
|
|
||||||
|
|
||||||
@Inject
|
|
||||||
private PluginManagementInjector pluginManagementInjector;
|
|
||||||
|
|
||||||
@Inject
|
|
||||||
private DependencyManagementInjector dependencyManagementInjector;
|
|
||||||
|
|
||||||
@Inject
|
|
||||||
private DependencyManagementImporter dependencyManagementImporter;
|
|
||||||
|
|
||||||
@Inject
|
|
||||||
@Nullable
|
|
||||||
private LifecycleBindingsInjector lifecycleBindingsInjector;
|
|
||||||
|
|
||||||
@Inject
|
|
||||||
private PluginConfigurationExpander pluginConfigurationExpander;
|
|
||||||
|
|
||||||
@Inject
|
|
||||||
private ReportConfigurationExpander reportConfigurationExpander;
|
|
||||||
|
|
||||||
@Inject
|
|
||||||
private ReportingConverter reportingConverter;
|
|
||||||
|
|
||||||
private ModelMerger modelMerger = new FileToRawModelMerger();
|
|
||||||
|
|
||||||
@Inject
|
|
||||||
private ProfileActivationFilePathInterpolator profileActivationFilePathInterpolator;
|
|
||||||
|
|
||||||
public DefaultModelBuilder setModelProcessor( ModelProcessor modelProcessor )
|
|
||||||
{
|
{
|
||||||
this.modelProcessor = modelProcessor;
|
this.modelProcessor = modelProcessor;
|
||||||
return this;
|
this.modelValidator = modelValidator;
|
||||||
|
this.modelNormalizer = modelNormalizer;
|
||||||
|
this.modelInterpolator = modelInterpolator;
|
||||||
|
this.modelPathTranslator = modelPathTranslator;
|
||||||
|
this.modelUrlNormalizer = modelUrlNormalizer;
|
||||||
|
this.superPomProvider = superPomProvider;
|
||||||
|
this.inheritanceAssembler = inheritanceAssembler;
|
||||||
|
this.profileSelector = profileSelector;
|
||||||
|
this.profileInjector = profileInjector;
|
||||||
|
this.pluginManagementInjector = pluginManagementInjector;
|
||||||
|
this.dependencyManagementInjector = dependencyManagementInjector;
|
||||||
|
this.dependencyManagementImporter = dependencyManagementImporter;
|
||||||
|
this.lifecycleBindingsInjector = lifecycleBindingsInjector;
|
||||||
|
this.pluginConfigurationExpander = pluginConfigurationExpander;
|
||||||
|
this.reportConfigurationExpander = reportConfigurationExpander;
|
||||||
|
this.reportingConverter = reportingConverter;
|
||||||
|
this.profileActivationFilePathInterpolator = profileActivationFilePathInterpolator;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated since Maven 4
|
||||||
|
* @see DefaultModelBuilderFactory#set
|
||||||
|
*/
|
||||||
|
@Deprecated
|
||||||
|
public DefaultModelBuilder setModelProcessor( ModelProcessor modelProcessor )
|
||||||
|
{
|
||||||
|
return new DefaultModelBuilder( modelProcessor, modelValidator, modelNormalizer, modelInterpolator,
|
||||||
|
modelPathTranslator, modelUrlNormalizer, superPomProvider, inheritanceAssembler, profileSelector,
|
||||||
|
profileInjector, pluginManagementInjector, dependencyManagementInjector, dependencyManagementImporter,
|
||||||
|
lifecycleBindingsInjector, pluginConfigurationExpander, reportConfigurationExpander,
|
||||||
|
reportingConverter, profileActivationFilePathInterpolator );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated since Maven 4
|
||||||
|
* @see DefaultModelBuilderFactory#setModelProcessor(ModelProcessor)
|
||||||
|
*/
|
||||||
|
@Deprecated
|
||||||
public DefaultModelBuilder setModelValidator( ModelValidator modelValidator )
|
public DefaultModelBuilder setModelValidator( ModelValidator modelValidator )
|
||||||
{
|
{
|
||||||
this.modelValidator = modelValidator;
|
return new DefaultModelBuilder( modelProcessor, modelValidator, modelNormalizer, modelInterpolator,
|
||||||
return this;
|
modelPathTranslator, modelUrlNormalizer, superPomProvider, inheritanceAssembler, profileSelector,
|
||||||
|
profileInjector, pluginManagementInjector, dependencyManagementInjector, dependencyManagementImporter,
|
||||||
|
lifecycleBindingsInjector, pluginConfigurationExpander, reportConfigurationExpander,
|
||||||
|
reportingConverter, profileActivationFilePathInterpolator );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated since Maven 4
|
||||||
|
* @see DefaultModelBuilderFactory#setModelNormalizer(ModelNormalizer)
|
||||||
|
*/
|
||||||
|
@Deprecated
|
||||||
public DefaultModelBuilder setModelNormalizer( ModelNormalizer modelNormalizer )
|
public DefaultModelBuilder setModelNormalizer( ModelNormalizer modelNormalizer )
|
||||||
{
|
{
|
||||||
this.modelNormalizer = modelNormalizer;
|
return new DefaultModelBuilder( modelProcessor, modelValidator, modelNormalizer, modelInterpolator,
|
||||||
return this;
|
modelPathTranslator, modelUrlNormalizer, superPomProvider, inheritanceAssembler, profileSelector,
|
||||||
|
profileInjector, pluginManagementInjector, dependencyManagementInjector, dependencyManagementImporter,
|
||||||
|
lifecycleBindingsInjector, pluginConfigurationExpander, reportConfigurationExpander,
|
||||||
|
reportingConverter, profileActivationFilePathInterpolator );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated since Maven 4
|
||||||
|
* @see DefaultModelBuilderFactory#setModelInterpolator(ModelInterpolator)
|
||||||
|
*/
|
||||||
|
@Deprecated
|
||||||
public DefaultModelBuilder setModelInterpolator( ModelInterpolator modelInterpolator )
|
public DefaultModelBuilder setModelInterpolator( ModelInterpolator modelInterpolator )
|
||||||
{
|
{
|
||||||
this.modelInterpolator = modelInterpolator;
|
return new DefaultModelBuilder( modelProcessor, modelValidator, modelNormalizer, modelInterpolator,
|
||||||
return this;
|
modelPathTranslator, modelUrlNormalizer, superPomProvider, inheritanceAssembler, profileSelector,
|
||||||
|
profileInjector, pluginManagementInjector, dependencyManagementInjector, dependencyManagementImporter,
|
||||||
|
lifecycleBindingsInjector, pluginConfigurationExpander, reportConfigurationExpander,
|
||||||
|
reportingConverter, profileActivationFilePathInterpolator );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated since Maven 4
|
||||||
|
* @see DefaultModelBuilderFactory#set
|
||||||
|
*/
|
||||||
|
@Deprecated
|
||||||
public DefaultModelBuilder setModelPathTranslator( ModelPathTranslator modelPathTranslator )
|
public DefaultModelBuilder setModelPathTranslator( ModelPathTranslator modelPathTranslator )
|
||||||
{
|
{
|
||||||
this.modelPathTranslator = modelPathTranslator;
|
return new DefaultModelBuilder( modelProcessor, modelValidator, modelNormalizer, modelInterpolator,
|
||||||
return this;
|
modelPathTranslator, modelUrlNormalizer, superPomProvider, inheritanceAssembler, profileSelector,
|
||||||
|
profileInjector, pluginManagementInjector, dependencyManagementInjector, dependencyManagementImporter,
|
||||||
|
lifecycleBindingsInjector, pluginConfigurationExpander, reportConfigurationExpander,
|
||||||
|
reportingConverter, profileActivationFilePathInterpolator );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated since Maven 4
|
||||||
|
* @see DefaultModelBuilderFactory#setModelUrlNormalizer(ModelUrlNormalizer)
|
||||||
|
*/
|
||||||
|
@Deprecated
|
||||||
public DefaultModelBuilder setModelUrlNormalizer( ModelUrlNormalizer modelUrlNormalizer )
|
public DefaultModelBuilder setModelUrlNormalizer( ModelUrlNormalizer modelUrlNormalizer )
|
||||||
{
|
{
|
||||||
this.modelUrlNormalizer = modelUrlNormalizer;
|
return new DefaultModelBuilder( modelProcessor, modelValidator, modelNormalizer, modelInterpolator,
|
||||||
return this;
|
modelPathTranslator, modelUrlNormalizer, superPomProvider, inheritanceAssembler, profileSelector,
|
||||||
|
profileInjector, pluginManagementInjector, dependencyManagementInjector, dependencyManagementImporter,
|
||||||
|
lifecycleBindingsInjector, pluginConfigurationExpander, reportConfigurationExpander,
|
||||||
|
reportingConverter, profileActivationFilePathInterpolator );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated since Maven 4
|
||||||
|
* @see DefaultModelBuilderFactory#setSuperPomProvider(SuperPomProvider)
|
||||||
|
*/
|
||||||
|
@Deprecated
|
||||||
public DefaultModelBuilder setSuperPomProvider( SuperPomProvider superPomProvider )
|
public DefaultModelBuilder setSuperPomProvider( SuperPomProvider superPomProvider )
|
||||||
{
|
{
|
||||||
this.superPomProvider = superPomProvider;
|
return new DefaultModelBuilder( modelProcessor, modelValidator, modelNormalizer, modelInterpolator,
|
||||||
return this;
|
modelPathTranslator, modelUrlNormalizer, superPomProvider, inheritanceAssembler, profileSelector,
|
||||||
}
|
profileInjector, pluginManagementInjector, dependencyManagementInjector, dependencyManagementImporter,
|
||||||
|
lifecycleBindingsInjector, pluginConfigurationExpander, reportConfigurationExpander,
|
||||||
public DefaultModelBuilder setProfileSelector( ProfileSelector profileSelector )
|
reportingConverter, profileActivationFilePathInterpolator );
|
||||||
{
|
|
||||||
this.profileSelector = profileSelector;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public DefaultModelBuilder setProfileInjector( ProfileInjector profileInjector )
|
|
||||||
{
|
|
||||||
this.profileInjector = profileInjector;
|
|
||||||
return this;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated since Maven 4
|
||||||
|
* @see DefaultModelBuilderFactory#setInheritanceAssembler(InheritanceAssembler)
|
||||||
|
*/
|
||||||
|
@Deprecated
|
||||||
public DefaultModelBuilder setInheritanceAssembler( InheritanceAssembler inheritanceAssembler )
|
public DefaultModelBuilder setInheritanceAssembler( InheritanceAssembler inheritanceAssembler )
|
||||||
{
|
{
|
||||||
this.inheritanceAssembler = inheritanceAssembler;
|
return new DefaultModelBuilder( modelProcessor, modelValidator, modelNormalizer, modelInterpolator,
|
||||||
return this;
|
modelPathTranslator, modelUrlNormalizer, superPomProvider, inheritanceAssembler, profileSelector,
|
||||||
|
profileInjector, pluginManagementInjector, dependencyManagementInjector, dependencyManagementImporter,
|
||||||
|
lifecycleBindingsInjector, pluginConfigurationExpander, reportConfigurationExpander,
|
||||||
|
reportingConverter, profileActivationFilePathInterpolator );
|
||||||
}
|
}
|
||||||
|
|
||||||
public DefaultModelBuilder setDependencyManagementImporter( DependencyManagementImporter depMgmtImporter )
|
/**
|
||||||
|
* @deprecated since Maven 4
|
||||||
|
* @see DefaultModelBuilderFactory#set
|
||||||
|
*/
|
||||||
|
@Deprecated
|
||||||
|
public DefaultModelBuilder setProfileSelector( ProfileSelector profileSelector )
|
||||||
{
|
{
|
||||||
this.dependencyManagementImporter = depMgmtImporter;
|
return new DefaultModelBuilder( modelProcessor, modelValidator, modelNormalizer, modelInterpolator,
|
||||||
return this;
|
modelPathTranslator, modelUrlNormalizer, superPomProvider, inheritanceAssembler, profileSelector,
|
||||||
|
profileInjector, pluginManagementInjector, dependencyManagementInjector, dependencyManagementImporter,
|
||||||
|
lifecycleBindingsInjector, pluginConfigurationExpander, reportConfigurationExpander,
|
||||||
|
reportingConverter, profileActivationFilePathInterpolator );
|
||||||
}
|
}
|
||||||
|
|
||||||
public DefaultModelBuilder setDependencyManagementInjector( DependencyManagementInjector depMgmtInjector )
|
/**
|
||||||
|
* @deprecated since Maven 4
|
||||||
|
* @see DefaultModelBuilderFactory#setProfileInjector(ProfileInjector)
|
||||||
|
*/
|
||||||
|
@Deprecated
|
||||||
|
public DefaultModelBuilder setProfileInjector( ProfileInjector profileInjector )
|
||||||
{
|
{
|
||||||
this.dependencyManagementInjector = depMgmtInjector;
|
return new DefaultModelBuilder( modelProcessor, modelValidator, modelNormalizer, modelInterpolator,
|
||||||
return this;
|
modelPathTranslator, modelUrlNormalizer, superPomProvider, inheritanceAssembler, profileSelector,
|
||||||
}
|
profileInjector, pluginManagementInjector, dependencyManagementInjector, dependencyManagementImporter,
|
||||||
|
lifecycleBindingsInjector, pluginConfigurationExpander, reportConfigurationExpander,
|
||||||
public DefaultModelBuilder setLifecycleBindingsInjector( LifecycleBindingsInjector lifecycleBindingsInjector )
|
reportingConverter, profileActivationFilePathInterpolator );
|
||||||
{
|
|
||||||
this.lifecycleBindingsInjector = lifecycleBindingsInjector;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public DefaultModelBuilder setPluginConfigurationExpander( PluginConfigurationExpander pluginConfigurationExpander )
|
|
||||||
{
|
|
||||||
this.pluginConfigurationExpander = pluginConfigurationExpander;
|
|
||||||
return this;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated since Maven 4
|
||||||
|
* @see DefaultModelBuilderFactory#setPluginManagementInjector(PluginManagementInjector)
|
||||||
|
*/
|
||||||
|
@Deprecated
|
||||||
public DefaultModelBuilder setPluginManagementInjector( PluginManagementInjector pluginManagementInjector )
|
public DefaultModelBuilder setPluginManagementInjector( PluginManagementInjector pluginManagementInjector )
|
||||||
{
|
{
|
||||||
this.pluginManagementInjector = pluginManagementInjector;
|
return new DefaultModelBuilder( modelProcessor, modelValidator, modelNormalizer, modelInterpolator,
|
||||||
return this;
|
modelPathTranslator, modelUrlNormalizer, superPomProvider, inheritanceAssembler, profileSelector,
|
||||||
|
profileInjector, pluginManagementInjector, dependencyManagementInjector, dependencyManagementImporter,
|
||||||
|
lifecycleBindingsInjector, pluginConfigurationExpander, reportConfigurationExpander,
|
||||||
|
reportingConverter, profileActivationFilePathInterpolator );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated since Maven 4
|
||||||
|
* @see DefaultModelBuilderFactory#setDependencyManagementInjector(DependencyManagementInjector)
|
||||||
|
*/
|
||||||
|
@Deprecated
|
||||||
|
public DefaultModelBuilder setDependencyManagementInjector(
|
||||||
|
DependencyManagementInjector dependencyManagementInjector )
|
||||||
|
{
|
||||||
|
return new DefaultModelBuilder( modelProcessor, modelValidator, modelNormalizer, modelInterpolator,
|
||||||
|
modelPathTranslator, modelUrlNormalizer, superPomProvider, inheritanceAssembler, profileSelector,
|
||||||
|
profileInjector, pluginManagementInjector, dependencyManagementInjector, dependencyManagementImporter,
|
||||||
|
lifecycleBindingsInjector, pluginConfigurationExpander, reportConfigurationExpander,
|
||||||
|
reportingConverter, profileActivationFilePathInterpolator );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated since Maven 4
|
||||||
|
* @see DefaultModelBuilderFactory#setDependencyManagementImporter(DependencyManagementImporter)
|
||||||
|
*/
|
||||||
|
@Deprecated
|
||||||
|
public DefaultModelBuilder setDependencyManagementImporter(
|
||||||
|
DependencyManagementImporter dependencyManagementImporter )
|
||||||
|
{
|
||||||
|
return new DefaultModelBuilder( modelProcessor, modelValidator, modelNormalizer, modelInterpolator,
|
||||||
|
modelPathTranslator, modelUrlNormalizer, superPomProvider, inheritanceAssembler, profileSelector,
|
||||||
|
profileInjector, pluginManagementInjector, dependencyManagementInjector, dependencyManagementImporter,
|
||||||
|
lifecycleBindingsInjector, pluginConfigurationExpander, reportConfigurationExpander,
|
||||||
|
reportingConverter, profileActivationFilePathInterpolator );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated since Maven 4
|
||||||
|
* @see DefaultModelBuilderFactory#setLifecycleBindingsInjector(LifecycleBindingsInjector)
|
||||||
|
*/
|
||||||
|
@Deprecated
|
||||||
|
public DefaultModelBuilder setLifecycleBindingsInjector( LifecycleBindingsInjector lifecycleBindingsInjector )
|
||||||
|
{
|
||||||
|
return new DefaultModelBuilder( modelProcessor, modelValidator, modelNormalizer, modelInterpolator,
|
||||||
|
modelPathTranslator, modelUrlNormalizer, superPomProvider, inheritanceAssembler, profileSelector,
|
||||||
|
profileInjector, pluginManagementInjector, dependencyManagementInjector, dependencyManagementImporter,
|
||||||
|
lifecycleBindingsInjector, pluginConfigurationExpander, reportConfigurationExpander,
|
||||||
|
reportingConverter, profileActivationFilePathInterpolator );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated since Maven 4
|
||||||
|
* @see DefaultModelBuilderFactory#setPluginConfigurationExpander(PluginConfigurationExpander)
|
||||||
|
*/
|
||||||
|
@Deprecated
|
||||||
|
public DefaultModelBuilder setPluginConfigurationExpander( PluginConfigurationExpander pluginConfigurationExpander )
|
||||||
|
{
|
||||||
|
return new DefaultModelBuilder( modelProcessor, modelValidator, modelNormalizer, modelInterpolator,
|
||||||
|
modelPathTranslator, modelUrlNormalizer, superPomProvider, inheritanceAssembler, profileSelector,
|
||||||
|
profileInjector, pluginManagementInjector, dependencyManagementInjector, dependencyManagementImporter,
|
||||||
|
lifecycleBindingsInjector, pluginConfigurationExpander, reportConfigurationExpander,
|
||||||
|
reportingConverter, profileActivationFilePathInterpolator );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated since Maven 4
|
||||||
|
* @see DefaultModelBuilderFactory#setReportConfigurationExpander(ReportConfigurationExpander)
|
||||||
|
*/
|
||||||
|
@Deprecated
|
||||||
public DefaultModelBuilder setReportConfigurationExpander( ReportConfigurationExpander reportConfigurationExpander )
|
public DefaultModelBuilder setReportConfigurationExpander( ReportConfigurationExpander reportConfigurationExpander )
|
||||||
{
|
{
|
||||||
this.reportConfigurationExpander = reportConfigurationExpander;
|
return new DefaultModelBuilder( modelProcessor, modelValidator, modelNormalizer, modelInterpolator,
|
||||||
return this;
|
modelPathTranslator, modelUrlNormalizer, superPomProvider, inheritanceAssembler, profileSelector,
|
||||||
|
profileInjector, pluginManagementInjector, dependencyManagementInjector, dependencyManagementImporter,
|
||||||
|
lifecycleBindingsInjector, pluginConfigurationExpander, reportConfigurationExpander,
|
||||||
|
reportingConverter, profileActivationFilePathInterpolator );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated since Maven 4
|
||||||
|
* @see DefaultModelBuilderFactory#setReportingConverter(ReportingConverter)
|
||||||
|
*/
|
||||||
|
@Deprecated
|
||||||
public DefaultModelBuilder setReportingConverter( ReportingConverter reportingConverter )
|
public DefaultModelBuilder setReportingConverter( ReportingConverter reportingConverter )
|
||||||
{
|
{
|
||||||
this.reportingConverter = reportingConverter;
|
return new DefaultModelBuilder( modelProcessor, modelValidator, modelNormalizer, modelInterpolator,
|
||||||
return this;
|
modelPathTranslator, modelUrlNormalizer, superPomProvider, inheritanceAssembler, profileSelector,
|
||||||
|
profileInjector, pluginManagementInjector, dependencyManagementInjector, dependencyManagementImporter,
|
||||||
|
lifecycleBindingsInjector, pluginConfigurationExpander, reportConfigurationExpander,
|
||||||
|
reportingConverter, profileActivationFilePathInterpolator );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated since Maven 4
|
||||||
|
* @see DefaultModelBuilderFactory#setProfileActivationFilePathInterpolator(ProfileActivationFilePathInterpolator)
|
||||||
|
*/
|
||||||
|
@Deprecated
|
||||||
public DefaultModelBuilder setProfileActivationFilePathInterpolator(
|
public DefaultModelBuilder setProfileActivationFilePathInterpolator(
|
||||||
ProfileActivationFilePathInterpolator profileActivationFilePathInterpolator )
|
ProfileActivationFilePathInterpolator profileActivationFilePathInterpolator )
|
||||||
{
|
{
|
||||||
this.profileActivationFilePathInterpolator = profileActivationFilePathInterpolator;
|
return new DefaultModelBuilder( modelProcessor, modelValidator, modelNormalizer, modelInterpolator,
|
||||||
return this;
|
modelPathTranslator, modelUrlNormalizer, superPomProvider, inheritanceAssembler, profileSelector,
|
||||||
|
profileInjector, pluginManagementInjector, dependencyManagementInjector, dependencyManagementImporter,
|
||||||
|
lifecycleBindingsInjector, pluginConfigurationExpander, reportConfigurationExpander,
|
||||||
|
reportingConverter, profileActivationFilePathInterpolator );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -19,6 +19,8 @@ package org.apache.maven.model.building;
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
|
||||||
import org.apache.maven.model.Model;
|
import org.apache.maven.model.Model;
|
||||||
import org.apache.maven.model.composition.DefaultDependencyManagementImporter;
|
import org.apache.maven.model.composition.DefaultDependencyManagementImporter;
|
||||||
import org.apache.maven.model.composition.DependencyManagementImporter;
|
import org.apache.maven.model.composition.DependencyManagementImporter;
|
||||||
|
@ -70,19 +72,151 @@ import org.apache.maven.model.validation.ModelValidator;
|
||||||
* A factory to create model builder instances when no dependency injection is available. <em>Note:</em> This class is
|
* A factory to create model builder instances when no dependency injection is available. <em>Note:</em> This class is
|
||||||
* only meant as a utility for developers that want to employ the model builder outside of the Maven build system, Maven
|
* only meant as a utility for developers that want to employ the model builder outside of the Maven build system, Maven
|
||||||
* plugins should always acquire model builder instances via dependency injection. Developers might want to subclass
|
* plugins should always acquire model builder instances via dependency injection. Developers might want to subclass
|
||||||
* this factory to provide custom implementations for some of the components used by the model builder.
|
* this factory to provide custom implementations for some of the components used by the model builder, or use the
|
||||||
|
* builder API to inject custom instances.
|
||||||
*
|
*
|
||||||
* @author Benjamin Bentmann
|
* @author Benjamin Bentmann
|
||||||
|
* @author Guillaume Nodet
|
||||||
*/
|
*/
|
||||||
public class DefaultModelBuilderFactory
|
public class DefaultModelBuilderFactory
|
||||||
{
|
{
|
||||||
|
|
||||||
|
private ModelProcessor modelProcessor;
|
||||||
|
private ModelValidator modelValidator;
|
||||||
|
private ModelNormalizer modelNormalizer;
|
||||||
|
private ModelInterpolator modelInterpolator;
|
||||||
|
private ModelPathTranslator modelPathTranslator;
|
||||||
|
private ModelUrlNormalizer modelUrlNormalizer;
|
||||||
|
private SuperPomProvider superPomProvider;
|
||||||
|
private InheritanceAssembler inheritanceAssembler;
|
||||||
|
private ProfileSelector profileSelector;
|
||||||
|
private ProfileInjector profileInjector;
|
||||||
|
private PluginManagementInjector pluginManagementInjector;
|
||||||
|
private DependencyManagementInjector dependencyManagementInjector;
|
||||||
|
private DependencyManagementImporter dependencyManagementImporter;
|
||||||
|
private LifecycleBindingsInjector lifecycleBindingsInjector;
|
||||||
|
private PluginConfigurationExpander pluginConfigurationExpander;
|
||||||
|
private ReportConfigurationExpander reportConfigurationExpander;
|
||||||
|
private ReportingConverter reportingConverter;
|
||||||
|
private ProfileActivationFilePathInterpolator profileActivationFilePathInterpolator;
|
||||||
|
|
||||||
|
public DefaultModelBuilderFactory setModelProcessor( ModelProcessor modelProcessor )
|
||||||
|
{
|
||||||
|
this.modelProcessor = modelProcessor;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DefaultModelBuilderFactory setModelValidator( ModelValidator modelValidator )
|
||||||
|
{
|
||||||
|
this.modelValidator = modelValidator;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DefaultModelBuilderFactory setModelNormalizer( ModelNormalizer modelNormalizer )
|
||||||
|
{
|
||||||
|
this.modelNormalizer = modelNormalizer;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DefaultModelBuilderFactory setModelInterpolator( ModelInterpolator modelInterpolator )
|
||||||
|
{
|
||||||
|
this.modelInterpolator = modelInterpolator;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DefaultModelBuilderFactory setModelPathTranslator( ModelPathTranslator modelPathTranslator )
|
||||||
|
{
|
||||||
|
this.modelPathTranslator = modelPathTranslator;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DefaultModelBuilderFactory setModelUrlNormalizer( ModelUrlNormalizer modelUrlNormalizer )
|
||||||
|
{
|
||||||
|
this.modelUrlNormalizer = modelUrlNormalizer;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DefaultModelBuilderFactory setSuperPomProvider( SuperPomProvider superPomProvider )
|
||||||
|
{
|
||||||
|
this.superPomProvider = superPomProvider;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DefaultModelBuilderFactory setInheritanceAssembler( InheritanceAssembler inheritanceAssembler )
|
||||||
|
{
|
||||||
|
this.inheritanceAssembler = inheritanceAssembler;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DefaultModelBuilderFactory setProfileSelector( ProfileSelector profileSelector )
|
||||||
|
{
|
||||||
|
this.profileSelector = profileSelector;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DefaultModelBuilderFactory setProfileInjector( ProfileInjector profileInjector )
|
||||||
|
{
|
||||||
|
this.profileInjector = profileInjector;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DefaultModelBuilderFactory setPluginManagementInjector( PluginManagementInjector pluginManagementInjector )
|
||||||
|
{
|
||||||
|
this.pluginManagementInjector = pluginManagementInjector;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DefaultModelBuilderFactory setDependencyManagementInjector(
|
||||||
|
DependencyManagementInjector dependencyManagementInjector )
|
||||||
|
{
|
||||||
|
this.dependencyManagementInjector = dependencyManagementInjector;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DefaultModelBuilderFactory setDependencyManagementImporter(
|
||||||
|
DependencyManagementImporter dependencyManagementImporter )
|
||||||
|
{
|
||||||
|
this.dependencyManagementImporter = dependencyManagementImporter;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DefaultModelBuilderFactory setLifecycleBindingsInjector(
|
||||||
|
LifecycleBindingsInjector lifecycleBindingsInjector )
|
||||||
|
{
|
||||||
|
this.lifecycleBindingsInjector = lifecycleBindingsInjector;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DefaultModelBuilderFactory setPluginConfigurationExpander(
|
||||||
|
PluginConfigurationExpander pluginConfigurationExpander )
|
||||||
|
{
|
||||||
|
this.pluginConfigurationExpander = pluginConfigurationExpander;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DefaultModelBuilderFactory setReportConfigurationExpander(
|
||||||
|
ReportConfigurationExpander reportConfigurationExpander )
|
||||||
|
{
|
||||||
|
this.reportConfigurationExpander = reportConfigurationExpander;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DefaultModelBuilderFactory setReportingConverter( ReportingConverter reportingConverter )
|
||||||
|
{
|
||||||
|
this.reportingConverter = reportingConverter;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DefaultModelBuilderFactory setProfileActivationFilePathInterpolator(
|
||||||
|
ProfileActivationFilePathInterpolator profileActivationFilePathInterpolator )
|
||||||
|
{
|
||||||
|
this.profileActivationFilePathInterpolator = profileActivationFilePathInterpolator;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
protected ModelProcessor newModelProcessor()
|
protected ModelProcessor newModelProcessor()
|
||||||
{
|
{
|
||||||
DefaultModelProcessor processor = new DefaultModelProcessor();
|
return new DefaultModelProcessor( newModelLocator(), newModelReader() );
|
||||||
processor.setModelLocator( newModelLocator() );
|
|
||||||
processor.setModelReader( newModelReader() );
|
|
||||||
return processor;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected ModelLocator newModelLocator()
|
protected ModelLocator newModelLocator()
|
||||||
|
@ -92,33 +226,23 @@ public class DefaultModelBuilderFactory
|
||||||
|
|
||||||
protected ModelReader newModelReader()
|
protected ModelReader newModelReader()
|
||||||
{
|
{
|
||||||
DefaultModelReader reader = new DefaultModelReader();
|
return new DefaultModelReader( newModelSourceTransformer() );
|
||||||
reader.setTransformer( newModelSourceTransformer() );
|
|
||||||
return reader;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected ProfileSelector newProfileSelector()
|
protected ProfileSelector newProfileSelector()
|
||||||
{
|
{
|
||||||
DefaultProfileSelector profileSelector = new DefaultProfileSelector();
|
return new DefaultProfileSelector( Arrays.asList( newProfileActivators() ) );
|
||||||
|
|
||||||
for ( ProfileActivator activator : newProfileActivators() )
|
|
||||||
{
|
|
||||||
profileSelector.addProfileActivator( activator );
|
|
||||||
}
|
|
||||||
|
|
||||||
return profileSelector;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected ProfileActivator[] newProfileActivators()
|
protected ProfileActivator[] newProfileActivators()
|
||||||
{
|
{
|
||||||
return new ProfileActivator[] { new JdkVersionProfileActivator(), new OperatingSystemProfileActivator(),
|
return new ProfileActivator[] { new JdkVersionProfileActivator(), new OperatingSystemProfileActivator(),
|
||||||
new PropertyProfileActivator(), new FileProfileActivator()
|
new PropertyProfileActivator(), new FileProfileActivator( newProfileActivationFilePathInterpolator() ) };
|
||||||
.setProfileActivationFilePathInterpolator( newProfileActivationFilePathInterpolator() ) };
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected ProfileActivationFilePathInterpolator newProfileActivationFilePathInterpolator()
|
protected ProfileActivationFilePathInterpolator newProfileActivationFilePathInterpolator()
|
||||||
{
|
{
|
||||||
return new ProfileActivationFilePathInterpolator().setPathTranslator( newPathTranslator() );
|
return new ProfileActivationFilePathInterpolator( newPathTranslator() );
|
||||||
}
|
}
|
||||||
|
|
||||||
protected UrlNormalizer newUrlNormalizer()
|
protected UrlNormalizer newUrlNormalizer()
|
||||||
|
@ -135,7 +259,7 @@ public class DefaultModelBuilderFactory
|
||||||
{
|
{
|
||||||
UrlNormalizer normalizer = newUrlNormalizer();
|
UrlNormalizer normalizer = newUrlNormalizer();
|
||||||
PathTranslator pathTranslator = newPathTranslator();
|
PathTranslator pathTranslator = newPathTranslator();
|
||||||
return new StringVisitorModelInterpolator().setPathTranslator( pathTranslator ).setUrlNormalizer( normalizer );
|
return new StringVisitorModelInterpolator( pathTranslator, normalizer );
|
||||||
}
|
}
|
||||||
|
|
||||||
protected ModelValidator newModelValidator()
|
protected ModelValidator newModelValidator()
|
||||||
|
@ -150,12 +274,12 @@ public class DefaultModelBuilderFactory
|
||||||
|
|
||||||
protected ModelPathTranslator newModelPathTranslator()
|
protected ModelPathTranslator newModelPathTranslator()
|
||||||
{
|
{
|
||||||
return new DefaultModelPathTranslator().setPathTranslator( newPathTranslator() );
|
return new DefaultModelPathTranslator( newPathTranslator() );
|
||||||
}
|
}
|
||||||
|
|
||||||
protected ModelUrlNormalizer newModelUrlNormalizer()
|
protected ModelUrlNormalizer newModelUrlNormalizer()
|
||||||
{
|
{
|
||||||
return new DefaultModelUrlNormalizer().setUrlNormalizer( newUrlNormalizer() );
|
return new DefaultModelUrlNormalizer( newUrlNormalizer() );
|
||||||
}
|
}
|
||||||
|
|
||||||
protected InheritanceAssembler newInheritanceAssembler()
|
protected InheritanceAssembler newInheritanceAssembler()
|
||||||
|
@ -170,7 +294,7 @@ public class DefaultModelBuilderFactory
|
||||||
|
|
||||||
protected SuperPomProvider newSuperPomProvider()
|
protected SuperPomProvider newSuperPomProvider()
|
||||||
{
|
{
|
||||||
return new DefaultSuperPomProvider().setModelProcessor( newModelProcessor() );
|
return new DefaultSuperPomProvider( newModelProcessor() );
|
||||||
}
|
}
|
||||||
|
|
||||||
protected DependencyManagementImporter newDependencyManagementImporter()
|
protected DependencyManagementImporter newDependencyManagementImporter()
|
||||||
|
@ -220,28 +344,27 @@ public class DefaultModelBuilderFactory
|
||||||
*/
|
*/
|
||||||
public DefaultModelBuilder newInstance()
|
public DefaultModelBuilder newInstance()
|
||||||
{
|
{
|
||||||
DefaultModelBuilder modelBuilder = new DefaultModelBuilder();
|
return new DefaultModelBuilder(
|
||||||
|
modelProcessor != null ? modelProcessor : newModelProcessor(),
|
||||||
modelBuilder.setModelProcessor( newModelProcessor() );
|
modelValidator != null ? modelValidator : newModelValidator(),
|
||||||
modelBuilder.setModelValidator( newModelValidator() );
|
modelNormalizer != null ? modelNormalizer : newModelNormalizer(),
|
||||||
modelBuilder.setModelNormalizer( newModelNormalizer() );
|
modelInterpolator != null ? modelInterpolator : newModelInterpolator(),
|
||||||
modelBuilder.setModelPathTranslator( newModelPathTranslator() );
|
modelPathTranslator != null ? modelPathTranslator : newModelPathTranslator(),
|
||||||
modelBuilder.setModelUrlNormalizer( newModelUrlNormalizer() );
|
modelUrlNormalizer != null ? modelUrlNormalizer : newModelUrlNormalizer(),
|
||||||
modelBuilder.setModelInterpolator( newModelInterpolator() );
|
superPomProvider != null ? superPomProvider : newSuperPomProvider(),
|
||||||
modelBuilder.setInheritanceAssembler( newInheritanceAssembler() );
|
inheritanceAssembler != null ? inheritanceAssembler : newInheritanceAssembler(),
|
||||||
modelBuilder.setProfileInjector( newProfileInjector() );
|
profileSelector != null ? profileSelector : newProfileSelector(),
|
||||||
modelBuilder.setProfileSelector( newProfileSelector() );
|
profileInjector != null ? profileInjector : newProfileInjector(),
|
||||||
modelBuilder.setSuperPomProvider( newSuperPomProvider() );
|
pluginManagementInjector != null ? pluginManagementInjector : newPluginManagementInjector(),
|
||||||
modelBuilder.setDependencyManagementImporter( newDependencyManagementImporter() );
|
dependencyManagementInjector != null ? dependencyManagementInjector : newDependencyManagementInjector(),
|
||||||
modelBuilder.setDependencyManagementInjector( newDependencyManagementInjector() );
|
dependencyManagementImporter != null ? dependencyManagementImporter : newDependencyManagementImporter(),
|
||||||
modelBuilder.setLifecycleBindingsInjector( newLifecycleBindingsInjector() );
|
lifecycleBindingsInjector != null ? lifecycleBindingsInjector : newLifecycleBindingsInjector(),
|
||||||
modelBuilder.setPluginManagementInjector( newPluginManagementInjector() );
|
pluginConfigurationExpander != null ? pluginConfigurationExpander : newPluginConfigurationExpander(),
|
||||||
modelBuilder.setPluginConfigurationExpander( newPluginConfigurationExpander() );
|
reportConfigurationExpander != null ? reportConfigurationExpander : newReportConfigurationExpander(),
|
||||||
modelBuilder.setReportConfigurationExpander( newReportConfigurationExpander() );
|
reportingConverter != null ? reportingConverter : newReportingConverter(),
|
||||||
modelBuilder.setReportingConverter( newReportingConverter() );
|
profileActivationFilePathInterpolator != null
|
||||||
modelBuilder.setProfileActivationFilePathInterpolator( newProfileActivationFilePathInterpolator() );
|
? profileActivationFilePathInterpolator : newProfileActivationFilePathInterpolator()
|
||||||
|
);
|
||||||
return modelBuilder;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class StubLifecycleBindingsInjector
|
private static class StubLifecycleBindingsInjector
|
||||||
|
|
|
@ -66,22 +66,14 @@ public class DefaultModelProcessor
|
||||||
implements ModelProcessor
|
implements ModelProcessor
|
||||||
{
|
{
|
||||||
|
|
||||||
@Inject
|
private final ModelLocator locator;
|
||||||
private ModelLocator locator;
|
private final ModelReader reader;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
private ModelReader reader;
|
public DefaultModelProcessor( ModelLocator locator, ModelReader reader )
|
||||||
|
|
||||||
public DefaultModelProcessor setModelLocator( ModelLocator locator )
|
|
||||||
{
|
{
|
||||||
this.locator = locator;
|
this.locator = locator;
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public DefaultModelProcessor setModelReader( ModelReader reader )
|
|
||||||
{
|
|
||||||
this.reader = reader;
|
this.reader = reader;
|
||||||
return this;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -82,26 +82,14 @@ public abstract class AbstractStringBasedModelInterpolator
|
||||||
TRANSLATED_PATH_EXPRESSIONS = translatedPrefixes;
|
TRANSLATED_PATH_EXPRESSIONS = translatedPrefixes;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Inject
|
private final PathTranslator pathTranslator;
|
||||||
private PathTranslator pathTranslator;
|
private final UrlNormalizer urlNormalizer;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
private UrlNormalizer urlNormalizer;
|
public AbstractStringBasedModelInterpolator( PathTranslator pathTranslator, UrlNormalizer urlNormalizer )
|
||||||
|
|
||||||
public AbstractStringBasedModelInterpolator()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
public AbstractStringBasedModelInterpolator setPathTranslator( PathTranslator pathTranslator )
|
|
||||||
{
|
{
|
||||||
this.pathTranslator = pathTranslator;
|
this.pathTranslator = pathTranslator;
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public AbstractStringBasedModelInterpolator setUrlNormalizer( UrlNormalizer urlNormalizer )
|
|
||||||
{
|
|
||||||
this.urlNormalizer = urlNormalizer;
|
this.urlNormalizer = urlNormalizer;
|
||||||
return this;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected List<ValueSource> createValueSources( final Model model, final File projectDir,
|
protected List<ValueSource> createValueSources( final Model model, final File projectDir,
|
||||||
|
|
|
@ -26,6 +26,8 @@ import org.apache.maven.model.building.ModelProblem.Severity;
|
||||||
import org.apache.maven.model.building.ModelProblem.Version;
|
import org.apache.maven.model.building.ModelProblem.Version;
|
||||||
import org.apache.maven.model.building.ModelProblemCollector;
|
import org.apache.maven.model.building.ModelProblemCollector;
|
||||||
import org.apache.maven.model.building.ModelProblemCollectorRequest;
|
import org.apache.maven.model.building.ModelProblemCollectorRequest;
|
||||||
|
import org.apache.maven.model.path.PathTranslator;
|
||||||
|
import org.apache.maven.model.path.UrlNormalizer;
|
||||||
import org.codehaus.plexus.interpolation.InterpolationException;
|
import org.codehaus.plexus.interpolation.InterpolationException;
|
||||||
import org.codehaus.plexus.interpolation.InterpolationPostProcessor;
|
import org.codehaus.plexus.interpolation.InterpolationPostProcessor;
|
||||||
import org.codehaus.plexus.interpolation.RecursionInterceptor;
|
import org.codehaus.plexus.interpolation.RecursionInterceptor;
|
||||||
|
@ -46,6 +48,8 @@ import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
|
||||||
|
import javax.inject.Inject;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* StringSearchModelInterpolator
|
* StringSearchModelInterpolator
|
||||||
* @deprecated replaced by StringVisitorModelInterpolator (MNG-6697)
|
* @deprecated replaced by StringVisitorModelInterpolator (MNG-6697)
|
||||||
|
@ -63,6 +67,17 @@ public class StringSearchModelInterpolator
|
||||||
String interpolate( String value );
|
String interpolate( String value );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
public StringSearchModelInterpolator( PathTranslator pathTranslator, UrlNormalizer urlNormalizer )
|
||||||
|
{
|
||||||
|
super( pathTranslator, urlNormalizer );
|
||||||
|
}
|
||||||
|
|
||||||
|
StringSearchModelInterpolator()
|
||||||
|
{
|
||||||
|
super( null, null );
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Model interpolateModel( Model model, File projectDir, ModelBuildingRequest config,
|
public Model interpolateModel( Model model, File projectDir, ModelBuildingRequest config,
|
||||||
ModelProblemCollector problems )
|
ModelProblemCollector problems )
|
||||||
|
|
|
@ -26,6 +26,7 @@ import java.util.ListIterator;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
|
|
||||||
|
import javax.inject.Inject;
|
||||||
import javax.inject.Named;
|
import javax.inject.Named;
|
||||||
import javax.inject.Singleton;
|
import javax.inject.Singleton;
|
||||||
|
|
||||||
|
@ -71,6 +72,8 @@ import org.apache.maven.model.building.ModelProblem.Severity;
|
||||||
import org.apache.maven.model.building.ModelProblem.Version;
|
import org.apache.maven.model.building.ModelProblem.Version;
|
||||||
import org.apache.maven.model.building.ModelProblemCollector;
|
import org.apache.maven.model.building.ModelProblemCollector;
|
||||||
import org.apache.maven.model.building.ModelProblemCollectorRequest;
|
import org.apache.maven.model.building.ModelProblemCollectorRequest;
|
||||||
|
import org.apache.maven.model.path.PathTranslator;
|
||||||
|
import org.apache.maven.model.path.UrlNormalizer;
|
||||||
import org.codehaus.plexus.interpolation.InterpolationException;
|
import org.codehaus.plexus.interpolation.InterpolationException;
|
||||||
import org.codehaus.plexus.interpolation.InterpolationPostProcessor;
|
import org.codehaus.plexus.interpolation.InterpolationPostProcessor;
|
||||||
import org.codehaus.plexus.interpolation.RecursionInterceptor;
|
import org.codehaus.plexus.interpolation.RecursionInterceptor;
|
||||||
|
@ -88,6 +91,11 @@ import org.codehaus.plexus.util.xml.Xpp3Dom;
|
||||||
public class StringVisitorModelInterpolator
|
public class StringVisitorModelInterpolator
|
||||||
extends AbstractStringBasedModelInterpolator
|
extends AbstractStringBasedModelInterpolator
|
||||||
{
|
{
|
||||||
|
@Inject
|
||||||
|
public StringVisitorModelInterpolator( PathTranslator pathTranslator, UrlNormalizer urlNormalizer )
|
||||||
|
{
|
||||||
|
super( pathTranslator, urlNormalizer );
|
||||||
|
}
|
||||||
|
|
||||||
interface InnerInterpolator
|
interface InnerInterpolator
|
||||||
{
|
{
|
||||||
|
|
|
@ -52,10 +52,10 @@ import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
|
||||||
public class DefaultModelReader
|
public class DefaultModelReader
|
||||||
implements ModelReader
|
implements ModelReader
|
||||||
{
|
{
|
||||||
@Inject
|
private final ModelSourceTransformer transformer;
|
||||||
private ModelSourceTransformer transformer;
|
|
||||||
|
|
||||||
public void setTransformer( ModelSourceTransformer transformer )
|
@Inject
|
||||||
|
public DefaultModelReader( ModelSourceTransformer transformer )
|
||||||
{
|
{
|
||||||
this.transformer = transformer;
|
this.transformer = transformer;
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,13 +44,12 @@ public class DefaultModelPathTranslator
|
||||||
implements ModelPathTranslator
|
implements ModelPathTranslator
|
||||||
{
|
{
|
||||||
|
|
||||||
@Inject
|
private final PathTranslator pathTranslator;
|
||||||
private PathTranslator pathTranslator;
|
|
||||||
|
|
||||||
public DefaultModelPathTranslator setPathTranslator( PathTranslator pathTranslator )
|
@Inject
|
||||||
|
public DefaultModelPathTranslator( PathTranslator pathTranslator )
|
||||||
{
|
{
|
||||||
this.pathTranslator = pathTranslator;
|
this.pathTranslator = pathTranslator;
|
||||||
return this;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -41,13 +41,12 @@ public class DefaultModelUrlNormalizer
|
||||||
implements ModelUrlNormalizer
|
implements ModelUrlNormalizer
|
||||||
{
|
{
|
||||||
|
|
||||||
@Inject
|
private final UrlNormalizer urlNormalizer;
|
||||||
private UrlNormalizer urlNormalizer;
|
|
||||||
|
|
||||||
public DefaultModelUrlNormalizer setUrlNormalizer( UrlNormalizer urlNormalizer )
|
@Inject
|
||||||
|
public DefaultModelUrlNormalizer( UrlNormalizer urlNormalizer )
|
||||||
{
|
{
|
||||||
this.urlNormalizer = urlNormalizer;
|
this.urlNormalizer = urlNormalizer;
|
||||||
return this;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -41,13 +41,12 @@ import java.io.File;
|
||||||
public class ProfileActivationFilePathInterpolator
|
public class ProfileActivationFilePathInterpolator
|
||||||
{
|
{
|
||||||
|
|
||||||
@Inject
|
private final PathTranslator pathTranslator;
|
||||||
private PathTranslator pathTranslator;
|
|
||||||
|
|
||||||
public ProfileActivationFilePathInterpolator setPathTranslator( PathTranslator pathTranslator )
|
@Inject
|
||||||
|
public ProfileActivationFilePathInterpolator( PathTranslator pathTranslator )
|
||||||
{
|
{
|
||||||
this.pathTranslator = pathTranslator;
|
this.pathTranslator = pathTranslator;
|
||||||
return this;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -47,8 +47,13 @@ public class DefaultProfileSelector
|
||||||
implements ProfileSelector
|
implements ProfileSelector
|
||||||
{
|
{
|
||||||
|
|
||||||
|
private final List<ProfileActivator> activators;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
private List<ProfileActivator> activators = new ArrayList<>();
|
public DefaultProfileSelector( List<ProfileActivator> activators )
|
||||||
|
{
|
||||||
|
this.activators = activators;
|
||||||
|
}
|
||||||
|
|
||||||
public DefaultProfileSelector addProfileActivator( ProfileActivator profileActivator )
|
public DefaultProfileSelector addProfileActivator( ProfileActivator profileActivator )
|
||||||
{
|
{
|
||||||
|
|
|
@ -55,14 +55,12 @@ public class FileProfileActivator
|
||||||
implements ProfileActivator
|
implements ProfileActivator
|
||||||
{
|
{
|
||||||
|
|
||||||
@Inject
|
private final ProfileActivationFilePathInterpolator profileActivationFilePathInterpolator;
|
||||||
private ProfileActivationFilePathInterpolator profileActivationFilePathInterpolator;
|
|
||||||
|
|
||||||
public FileProfileActivator setProfileActivationFilePathInterpolator(
|
@Inject
|
||||||
ProfileActivationFilePathInterpolator profileActivationFilePathInterpolator )
|
public FileProfileActivator( ProfileActivationFilePathInterpolator profileActivationFilePathInterpolator )
|
||||||
{
|
{
|
||||||
this.profileActivationFilePathInterpolator = profileActivationFilePathInterpolator;
|
this.profileActivationFilePathInterpolator = profileActivationFilePathInterpolator;
|
||||||
return this;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -43,18 +43,17 @@ public class DefaultSuperPomProvider
|
||||||
implements SuperPomProvider
|
implements SuperPomProvider
|
||||||
{
|
{
|
||||||
|
|
||||||
|
private final ModelProcessor modelProcessor;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The cached super POM, lazily created.
|
* The cached super POM, lazily created.
|
||||||
*/
|
*/
|
||||||
private Model superModel;
|
private Model superModel;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
private ModelProcessor modelProcessor;
|
public DefaultSuperPomProvider( ModelProcessor modelProcessor )
|
||||||
|
|
||||||
public DefaultSuperPomProvider setModelProcessor( ModelProcessor modelProcessor )
|
|
||||||
{
|
{
|
||||||
this.modelProcessor = modelProcessor;
|
this.modelProcessor = modelProcessor;
|
||||||
return this;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -61,8 +61,7 @@ public class DefaultInheritanceAssemblerTest
|
||||||
public void setUp()
|
public void setUp()
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
reader = new DefaultModelReader();
|
reader = new DefaultModelReader( new AbstractModelSourceTransformer()
|
||||||
reader.setTransformer( new AbstractModelSourceTransformer()
|
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
protected AbstractSAXFilter getSAXFilter( Path pomFile, TransformerContext context,
|
protected AbstractSAXFilter getSAXFilter( Path pomFile, TransformerContext context,
|
||||||
|
|
|
@ -23,6 +23,6 @@ public class StringVisitorModelInterpolatorTest extends AbstractModelInterpolato
|
||||||
{
|
{
|
||||||
protected ModelInterpolator createInterpolator()
|
protected ModelInterpolator createInterpolator()
|
||||||
{
|
{
|
||||||
return new StringVisitorModelInterpolator();
|
return new StringVisitorModelInterpolator( null, null );
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -39,25 +39,13 @@ import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
public abstract class AbstractProfileActivatorTest<T extends ProfileActivator>
|
public abstract class AbstractProfileActivatorTest<T extends ProfileActivator>
|
||||||
{
|
{
|
||||||
|
|
||||||
private Class<T> activatorClass;
|
|
||||||
|
|
||||||
protected T activator;
|
protected T activator;
|
||||||
|
|
||||||
public AbstractProfileActivatorTest( Class<T> activatorClass )
|
|
||||||
{
|
|
||||||
this.activatorClass = Objects.requireNonNull( activatorClass, "activatorClass cannot be null" );;
|
|
||||||
}
|
|
||||||
|
|
||||||
@BeforeEach
|
@BeforeEach
|
||||||
public void setUp()
|
abstract void setUp() throws Exception;
|
||||||
throws Exception
|
|
||||||
{
|
|
||||||
activator = activatorClass.getConstructor().newInstance();
|
|
||||||
}
|
|
||||||
|
|
||||||
@AfterEach
|
@AfterEach
|
||||||
public void tearDown()
|
void tearDown() throws Exception
|
||||||
throws Exception
|
|
||||||
{
|
{
|
||||||
activator = null;
|
activator = null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,17 +48,11 @@ public class FileProfileActivatorTest extends AbstractProfileActivatorTest<FileP
|
||||||
|
|
||||||
private final DefaultProfileActivationContext context = new DefaultProfileActivationContext();
|
private final DefaultProfileActivationContext context = new DefaultProfileActivationContext();
|
||||||
|
|
||||||
public FileProfileActivatorTest()
|
|
||||||
{
|
|
||||||
super( FileProfileActivator.class );
|
|
||||||
}
|
|
||||||
|
|
||||||
@BeforeEach
|
@BeforeEach
|
||||||
public void setUp() throws Exception
|
@Override
|
||||||
|
void setUp() throws Exception
|
||||||
{
|
{
|
||||||
super.setUp();
|
activator = new FileProfileActivator( new ProfileActivationFilePathInterpolator( new DefaultPathTranslator() ) );
|
||||||
activator.setProfileActivationFilePathInterpolator(
|
|
||||||
new ProfileActivationFilePathInterpolator().setPathTranslator( new DefaultPathTranslator() ) );
|
|
||||||
|
|
||||||
context.setProjectDirectory( new File( tempDir.toString() ) );
|
context.setProjectDirectory( new File( tempDir.toString() ) );
|
||||||
|
|
||||||
|
|
|
@ -23,6 +23,7 @@ import java.util.Properties;
|
||||||
|
|
||||||
import org.apache.maven.model.Activation;
|
import org.apache.maven.model.Activation;
|
||||||
import org.apache.maven.model.Profile;
|
import org.apache.maven.model.Profile;
|
||||||
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -34,12 +35,14 @@ public class JdkVersionProfileActivatorTest
|
||||||
extends AbstractProfileActivatorTest<JdkVersionProfileActivator>
|
extends AbstractProfileActivatorTest<JdkVersionProfileActivator>
|
||||||
{
|
{
|
||||||
|
|
||||||
public JdkVersionProfileActivatorTest()
|
@Override
|
||||||
|
@BeforeEach
|
||||||
|
void setUp() throws Exception
|
||||||
{
|
{
|
||||||
super( JdkVersionProfileActivator.class );
|
activator = new JdkVersionProfileActivator();
|
||||||
}
|
}
|
||||||
|
|
||||||
private Profile newProfile( String jdkVersion )
|
private Profile newProfile(String jdkVersion )
|
||||||
{
|
{
|
||||||
Activation a = new Activation();
|
Activation a = new Activation();
|
||||||
a.setJdk( jdkVersion );
|
a.setJdk( jdkVersion );
|
||||||
|
|
|
@ -24,6 +24,7 @@ import java.util.Properties;
|
||||||
import org.apache.maven.model.Activation;
|
import org.apache.maven.model.Activation;
|
||||||
import org.apache.maven.model.ActivationProperty;
|
import org.apache.maven.model.ActivationProperty;
|
||||||
import org.apache.maven.model.Profile;
|
import org.apache.maven.model.Profile;
|
||||||
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -35,12 +36,14 @@ public class PropertyProfileActivatorTest
|
||||||
extends AbstractProfileActivatorTest<PropertyProfileActivator>
|
extends AbstractProfileActivatorTest<PropertyProfileActivator>
|
||||||
{
|
{
|
||||||
|
|
||||||
public PropertyProfileActivatorTest()
|
@BeforeEach
|
||||||
|
@Override
|
||||||
|
void setUp() throws Exception
|
||||||
{
|
{
|
||||||
super( PropertyProfileActivator.class );
|
activator = new PropertyProfileActivator();
|
||||||
}
|
}
|
||||||
|
|
||||||
private Profile newProfile( String key, String value )
|
private Profile newProfile(String key, String value )
|
||||||
{
|
{
|
||||||
ActivationProperty ap = new ActivationProperty();
|
ActivationProperty ap = new ActivationProperty();
|
||||||
ap.setName( key );
|
ap.setName( key );
|
||||||
|
|
|
@ -73,80 +73,35 @@ import org.slf4j.LoggerFactory;
|
||||||
*/
|
*/
|
||||||
@Named
|
@Named
|
||||||
@Singleton
|
@Singleton
|
||||||
public class DefaultArtifactDescriptorReader
|
public class DefaultArtifactDescriptorReader implements ArtifactDescriptorReader
|
||||||
implements ArtifactDescriptorReader
|
|
||||||
{
|
{
|
||||||
private static final Logger LOGGER = LoggerFactory.getLogger( DefaultArtifactDescriptorReader.class );
|
private static final Logger LOGGER = LoggerFactory.getLogger( DefaultArtifactDescriptorReader.class );
|
||||||
|
|
||||||
private RemoteRepositoryManager remoteRepositoryManager;
|
private final RemoteRepositoryManager remoteRepositoryManager;
|
||||||
|
private final VersionResolver versionResolver;
|
||||||
private VersionResolver versionResolver;
|
private final VersionRangeResolver versionRangeResolver;
|
||||||
|
private final ArtifactResolver artifactResolver;
|
||||||
private VersionRangeResolver versionRangeResolver;
|
private final RepositoryEventDispatcher repositoryEventDispatcher;
|
||||||
|
private final ModelBuilder modelBuilder;
|
||||||
private ArtifactResolver artifactResolver;
|
|
||||||
|
|
||||||
private RepositoryEventDispatcher repositoryEventDispatcher;
|
|
||||||
|
|
||||||
private ModelBuilder modelBuilder;
|
|
||||||
|
|
||||||
public DefaultArtifactDescriptorReader()
|
|
||||||
{
|
|
||||||
// enable no-arg constructor
|
|
||||||
}
|
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
DefaultArtifactDescriptorReader( RemoteRepositoryManager remoteRepositoryManager, VersionResolver versionResolver,
|
public DefaultArtifactDescriptorReader(
|
||||||
VersionRangeResolver versionRangeResolver, ArtifactResolver artifactResolver,
|
RemoteRepositoryManager remoteRepositoryManager,
|
||||||
ModelBuilder modelBuilder, RepositoryEventDispatcher repositoryEventDispatcher )
|
VersionResolver versionResolver,
|
||||||
{
|
VersionRangeResolver versionRangeResolver,
|
||||||
setRemoteRepositoryManager( remoteRepositoryManager );
|
ArtifactResolver artifactResolver,
|
||||||
setVersionResolver( versionResolver );
|
ModelBuilder modelBuilder,
|
||||||
setVersionRangeResolver( versionRangeResolver );
|
RepositoryEventDispatcher repositoryEventDispatcher )
|
||||||
setArtifactResolver( artifactResolver );
|
|
||||||
setModelBuilder( modelBuilder );
|
|
||||||
setRepositoryEventDispatcher( repositoryEventDispatcher );
|
|
||||||
}
|
|
||||||
|
|
||||||
public DefaultArtifactDescriptorReader setRemoteRepositoryManager( RemoteRepositoryManager remoteRepositoryManager )
|
|
||||||
{
|
{
|
||||||
this.remoteRepositoryManager = Objects.requireNonNull( remoteRepositoryManager,
|
this.remoteRepositoryManager = Objects.requireNonNull( remoteRepositoryManager,
|
||||||
"remoteRepositoryManager cannot be null" );
|
"remoteRepositoryManager cannot be null" );
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public DefaultArtifactDescriptorReader setVersionResolver( VersionResolver versionResolver )
|
|
||||||
{
|
|
||||||
this.versionResolver = Objects.requireNonNull( versionResolver, "versionResolver cannot be null" );
|
this.versionResolver = Objects.requireNonNull( versionResolver, "versionResolver cannot be null" );
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** @since 3.2.2 */
|
|
||||||
public DefaultArtifactDescriptorReader setVersionRangeResolver( VersionRangeResolver versionRangeResolver )
|
|
||||||
{
|
|
||||||
this.versionRangeResolver =
|
this.versionRangeResolver =
|
||||||
Objects.requireNonNull( versionRangeResolver, "versionRangeResolver cannot be null" );
|
Objects.requireNonNull( versionRangeResolver, "versionRangeResolver cannot be null" );
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public DefaultArtifactDescriptorReader setArtifactResolver( ArtifactResolver artifactResolver )
|
|
||||||
{
|
|
||||||
this.artifactResolver = Objects.requireNonNull( artifactResolver, "artifactResolver cannot be null" );
|
this.artifactResolver = Objects.requireNonNull( artifactResolver, "artifactResolver cannot be null" );
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public DefaultArtifactDescriptorReader setRepositoryEventDispatcher(
|
|
||||||
RepositoryEventDispatcher repositoryEventDispatcher )
|
|
||||||
{
|
|
||||||
this.repositoryEventDispatcher = Objects.requireNonNull( repositoryEventDispatcher,
|
|
||||||
"repositoryEventDispatcher cannot be null" );
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public DefaultArtifactDescriptorReader setModelBuilder( ModelBuilder modelBuilder )
|
|
||||||
{
|
|
||||||
this.modelBuilder = Objects.requireNonNull( modelBuilder, "modelBuilder cannot be null" );
|
this.modelBuilder = Objects.requireNonNull( modelBuilder, "modelBuilder cannot be null" );
|
||||||
return this;
|
this.repositoryEventDispatcher = Objects.requireNonNull( repositoryEventDispatcher,
|
||||||
|
"repositoryEventDispatcher cannot be null" );
|
||||||
}
|
}
|
||||||
|
|
||||||
public ArtifactDescriptorResult readArtifactDescriptor( RepositorySystemSession session,
|
public ArtifactDescriptorResult readArtifactDescriptor( RepositorySystemSession session,
|
||||||
|
|
|
@ -70,46 +70,19 @@ public class DefaultVersionRangeResolver
|
||||||
|
|
||||||
private static final String MAVEN_METADATA_XML = "maven-metadata.xml";
|
private static final String MAVEN_METADATA_XML = "maven-metadata.xml";
|
||||||
|
|
||||||
private MetadataResolver metadataResolver;
|
private final MetadataResolver metadataResolver;
|
||||||
|
private final SyncContextFactory syncContextFactory;
|
||||||
private SyncContextFactory syncContextFactory;
|
private final RepositoryEventDispatcher repositoryEventDispatcher;
|
||||||
|
|
||||||
private RepositoryEventDispatcher repositoryEventDispatcher;
|
|
||||||
|
|
||||||
public DefaultVersionRangeResolver()
|
|
||||||
{
|
|
||||||
// enable default constructor
|
|
||||||
}
|
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
DefaultVersionRangeResolver( MetadataResolver metadataResolver, SyncContextFactory syncContextFactory,
|
public DefaultVersionRangeResolver( MetadataResolver metadataResolver, SyncContextFactory syncContextFactory,
|
||||||
RepositoryEventDispatcher repositoryEventDispatcher )
|
RepositoryEventDispatcher repositoryEventDispatcher )
|
||||||
{
|
|
||||||
setMetadataResolver( metadataResolver );
|
|
||||||
setSyncContextFactory( syncContextFactory );
|
|
||||||
setRepositoryEventDispatcher( repositoryEventDispatcher );
|
|
||||||
}
|
|
||||||
|
|
||||||
public DefaultVersionRangeResolver setMetadataResolver( MetadataResolver metadataResolver )
|
|
||||||
{
|
{
|
||||||
this.metadataResolver = Objects.requireNonNull( metadataResolver, "metadataResolver cannot be null" );
|
this.metadataResolver = Objects.requireNonNull( metadataResolver, "metadataResolver cannot be null" );
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public DefaultVersionRangeResolver setSyncContextFactory( SyncContextFactory syncContextFactory )
|
|
||||||
{
|
|
||||||
this.syncContextFactory = Objects.requireNonNull( syncContextFactory, "syncContextFactory cannot be null" );
|
this.syncContextFactory = Objects.requireNonNull( syncContextFactory, "syncContextFactory cannot be null" );
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public DefaultVersionRangeResolver setRepositoryEventDispatcher(
|
|
||||||
RepositoryEventDispatcher repositoryEventDispatcher )
|
|
||||||
{
|
|
||||||
this.repositoryEventDispatcher = Objects.requireNonNull( repositoryEventDispatcher,
|
this.repositoryEventDispatcher = Objects.requireNonNull( repositoryEventDispatcher,
|
||||||
"repositoryEventDispatcher cannot be null" );
|
"repositoryEventDispatcher cannot be null" );
|
||||||
return this;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public VersionRangeResult resolveVersionRange( RepositorySystemSession session, VersionRangeRequest request )
|
public VersionRangeResult resolveVersionRange( RepositorySystemSession session, VersionRangeRequest request )
|
||||||
throws VersionRangeResolutionException
|
throws VersionRangeResolutionException
|
||||||
{
|
{
|
||||||
|
|
|
@ -81,43 +81,18 @@ public class DefaultVersionResolver
|
||||||
|
|
||||||
private static final String SNAPSHOT = "SNAPSHOT";
|
private static final String SNAPSHOT = "SNAPSHOT";
|
||||||
|
|
||||||
private MetadataResolver metadataResolver;
|
private final MetadataResolver metadataResolver;
|
||||||
|
private final SyncContextFactory syncContextFactory;
|
||||||
private SyncContextFactory syncContextFactory;
|
private final RepositoryEventDispatcher repositoryEventDispatcher;
|
||||||
|
|
||||||
private RepositoryEventDispatcher repositoryEventDispatcher;
|
|
||||||
|
|
||||||
public DefaultVersionResolver()
|
|
||||||
{
|
|
||||||
// enable no-arg constructor
|
|
||||||
}
|
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
DefaultVersionResolver( MetadataResolver metadataResolver, SyncContextFactory syncContextFactory,
|
public DefaultVersionResolver( MetadataResolver metadataResolver, SyncContextFactory syncContextFactory,
|
||||||
RepositoryEventDispatcher repositoryEventDispatcher )
|
RepositoryEventDispatcher repositoryEventDispatcher )
|
||||||
{
|
|
||||||
setMetadataResolver( metadataResolver );
|
|
||||||
setSyncContextFactory( syncContextFactory );
|
|
||||||
setRepositoryEventDispatcher( repositoryEventDispatcher );
|
|
||||||
}
|
|
||||||
|
|
||||||
public DefaultVersionResolver setMetadataResolver( MetadataResolver metadataResolver )
|
|
||||||
{
|
{
|
||||||
this.metadataResolver = Objects.requireNonNull( metadataResolver, "metadataResolver cannot be null" );
|
this.metadataResolver = Objects.requireNonNull( metadataResolver, "metadataResolver cannot be null" );
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public DefaultVersionResolver setSyncContextFactory( SyncContextFactory syncContextFactory )
|
|
||||||
{
|
|
||||||
this.syncContextFactory = Objects.requireNonNull( syncContextFactory, "syncContextFactory cannot be null" );
|
this.syncContextFactory = Objects.requireNonNull( syncContextFactory, "syncContextFactory cannot be null" );
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public DefaultVersionResolver setRepositoryEventDispatcher( RepositoryEventDispatcher repositoryEventDispatcher )
|
|
||||||
{
|
|
||||||
this.repositoryEventDispatcher = Objects.requireNonNull( repositoryEventDispatcher,
|
this.repositoryEventDispatcher = Objects.requireNonNull( repositoryEventDispatcher,
|
||||||
"repositoryEventDispatcher cannot be null" );
|
"repositoryEventDispatcher cannot be null" );
|
||||||
return this;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings( "checkstyle:methodlength" )
|
@SuppressWarnings( "checkstyle:methodlength" )
|
||||||
|
|
|
@ -19,6 +19,8 @@ package org.apache.maven.repository.internal;
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import java.lang.reflect.Field;
|
||||||
|
|
||||||
import org.eclipse.aether.RepositoryEvent;
|
import org.eclipse.aether.RepositoryEvent;
|
||||||
import org.eclipse.aether.RepositoryEvent.EventType;
|
import org.eclipse.aether.RepositoryEvent.EventType;
|
||||||
import org.eclipse.aether.artifact.DefaultArtifact;
|
import org.eclipse.aether.artifact.DefaultArtifact;
|
||||||
|
@ -48,7 +50,9 @@ public class DefaultArtifactDescriptorReaderTest
|
||||||
|
|
||||||
ArgumentCaptor<RepositoryEvent> event = ArgumentCaptor.forClass( RepositoryEvent.class );
|
ArgumentCaptor<RepositoryEvent> event = ArgumentCaptor.forClass( RepositoryEvent.class );
|
||||||
|
|
||||||
reader.setRepositoryEventDispatcher( eventDispatcher );
|
Field field = DefaultArtifactDescriptorReader.class.getDeclaredField( "repositoryEventDispatcher" );
|
||||||
|
field.setAccessible( true );
|
||||||
|
field.set( reader, eventDispatcher );
|
||||||
|
|
||||||
ArtifactDescriptorRequest request = new ArtifactDescriptorRequest();
|
ArtifactDescriptorRequest request = new ArtifactDescriptorRequest();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue