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.lang.reflect.Field;
|
||||
|
||||
import org.apache.maven.artifact.Artifact;
|
||||
import org.apache.maven.repository.internal.DefaultArtifactDescriptorReader;
|
||||
|
@ -45,8 +46,10 @@ public class ProjectClasspathTest
|
|||
super.setUp();
|
||||
|
||||
ArtifactResolver resolver = getContainer().lookup( ArtifactResolver.class, "classpath" );
|
||||
DefaultArtifactDescriptorReader pomReader = (DefaultArtifactDescriptorReader)getContainer().lookup(ArtifactDescriptorReader.class);
|
||||
pomReader.setArtifactResolver( resolver );
|
||||
DefaultArtifactDescriptorReader pomReader = (DefaultArtifactDescriptorReader) getContainer().lookup(ArtifactDescriptorReader.class);
|
||||
Field field = DefaultArtifactDescriptorReader.class.getDeclaredField( "artifactResolver" );
|
||||
field.setAccessible( true );
|
||||
field.set( pomReader, resolver );
|
||||
|
||||
projectBuilder = getContainer().lookup( ProjectBuilder.class, "classpath" );
|
||||
}
|
||||
|
|
|
@ -19,7 +19,14 @@ import java.io.File;
|
|||
import java.util.Collections;
|
||||
|
||||
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.Singleton;
|
||||
|
||||
|
@ -28,6 +35,16 @@ import javax.inject.Singleton;
|
|||
public class TestProjectBuilder
|
||||
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
|
||||
public ProjectBuildingResult build( File pomFile, ProjectBuildingRequest configuration )
|
||||
|
|
|
@ -83,42 +83,58 @@ public class DefaultMaven
|
|||
implements Maven
|
||||
{
|
||||
|
||||
@Inject
|
||||
private Logger logger;
|
||||
private final Logger logger;
|
||||
|
||||
@Inject
|
||||
protected ProjectBuilder projectBuilder;
|
||||
|
||||
@Inject
|
||||
private LifecycleStarter lifecycleStarter;
|
||||
|
||||
@Inject
|
||||
protected PlexusContainer container;
|
||||
|
||||
@Inject
|
||||
private ExecutionEventCatapult eventCatapult;
|
||||
|
||||
@Inject
|
||||
private LegacySupport legacySupport;
|
||||
|
||||
@Inject
|
||||
private SessionScope sessionScope;
|
||||
|
||||
@Inject
|
||||
private DefaultRepositorySystemSessionFactory repositorySessionFactory;
|
||||
|
||||
@Inject
|
||||
@Named( GraphBuilder.HINT )
|
||||
private GraphBuilder graphBuilder;
|
||||
private final GraphBuilder graphBuilder;
|
||||
|
||||
private final BuildResumptionAnalyzer buildResumptionAnalyzer;
|
||||
|
||||
private final BuildResumptionDataRepository buildResumptionDataRepository;
|
||||
|
||||
private final SuperPomProvider superPomProvider;
|
||||
|
||||
@Inject
|
||||
private BuildResumptionAnalyzer buildResumptionAnalyzer;
|
||||
|
||||
@Inject
|
||||
private BuildResumptionDataRepository buildResumptionDataRepository;
|
||||
|
||||
@Inject
|
||||
private SuperPomProvider superPomProvider;
|
||||
public DefaultMaven(
|
||||
Logger logger,
|
||||
ProjectBuilder projectBuilder,
|
||||
LifecycleStarter lifecycleStarter,
|
||||
PlexusContainer container,
|
||||
ExecutionEventCatapult eventCatapult,
|
||||
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
|
||||
public MavenExecutionResult execute( MavenExecutionRequest request )
|
||||
|
|
|
@ -56,11 +56,18 @@ public class DefaultProjectDependenciesResolver
|
|||
implements ProjectDependenciesResolver
|
||||
{
|
||||
|
||||
@Inject
|
||||
private RepositorySystem repositorySystem;
|
||||
private final RepositorySystem repositorySystem;
|
||||
|
||||
private final ResolutionErrorHandler resolutionErrorHandler;
|
||||
|
||||
@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 )
|
||||
throws ArtifactResolutionException, ArtifactNotFoundException
|
||||
|
|
|
@ -67,13 +67,10 @@ class ReactorReader
|
|||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger( ReactorReader.class );
|
||||
|
||||
private MavenSession session;
|
||||
|
||||
private Map<String, MavenProject> projectsByGAV;
|
||||
|
||||
private Map<String, List<MavenProject>> projectsByGA;
|
||||
|
||||
private WorkspaceRepository repository;
|
||||
private final MavenSession session;
|
||||
private final Map<String, MavenProject> projectsByGAV;
|
||||
private final Map<String, List<MavenProject>> projectsByGA;
|
||||
private final WorkspaceRepository repository;
|
||||
|
||||
@Inject
|
||||
ReactorReader( MavenSession session )
|
||||
|
|
|
@ -39,8 +39,13 @@ import org.apache.maven.artifact.versioning.VersionRange;
|
|||
public class DefaultArtifactFactory
|
||||
implements ArtifactFactory
|
||||
{
|
||||
private final ArtifactHandlerManager artifactHandlerManager;
|
||||
|
||||
@Inject
|
||||
private ArtifactHandlerManager artifactHandlerManager;
|
||||
public DefaultArtifactFactory( ArtifactHandlerManager artifactHandlerManager )
|
||||
{
|
||||
this.artifactHandlerManager = artifactHandlerManager;
|
||||
}
|
||||
|
||||
public Artifact createArtifact( String groupId, String artifactId, String version, String scope, String type )
|
||||
{
|
||||
|
|
|
@ -39,10 +39,15 @@ public class DefaultArtifactHandlerManager
|
|||
implements ArtifactHandlerManager
|
||||
{
|
||||
|
||||
@Inject
|
||||
private Map<String, ArtifactHandler> artifactHandlers;
|
||||
private final 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 )
|
||||
{
|
||||
|
|
|
@ -40,23 +40,18 @@ import org.eclipse.aether.RepositoryListener;
|
|||
public class EventSpyDispatcher
|
||||
{
|
||||
|
||||
@Inject
|
||||
private Logger logger;
|
||||
private final Logger logger;
|
||||
|
||||
private List<EventSpy> eventSpies;
|
||||
private final List<EventSpy> eventSpies;
|
||||
|
||||
@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
|
||||
this.eventSpies = new ArrayList<>( eventSpies );
|
||||
}
|
||||
|
||||
public List<EventSpy> getEventSpies()
|
||||
{
|
||||
return eventSpies;
|
||||
}
|
||||
|
||||
public ExecutionListener chainListener( ExecutionListener listener )
|
||||
{
|
||||
if ( eventSpies.isEmpty() )
|
||||
|
|
|
@ -77,33 +77,42 @@ import java.util.Properties;
|
|||
@Named
|
||||
public class DefaultRepositorySystemSessionFactory
|
||||
{
|
||||
@Inject
|
||||
private Logger logger;
|
||||
private final 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
|
||||
private ArtifactHandlerManager artifactHandlerManager;
|
||||
|
||||
@Inject
|
||||
private RepositorySystem repoSystem;
|
||||
|
||||
@Inject
|
||||
@Nullable
|
||||
@Named( "simple" )
|
||||
private LocalRepositoryManagerFactory simpleLocalRepoMgrFactory;
|
||||
|
||||
@Inject
|
||||
@Nullable
|
||||
@Named( "ide" )
|
||||
private WorkspaceReader workspaceRepository;
|
||||
|
||||
@Inject
|
||||
private SettingsDecrypter settingsDecrypter;
|
||||
|
||||
@Inject
|
||||
private EventSpyDispatcher eventSpyDispatcher;
|
||||
|
||||
@Inject
|
||||
MavenRepositorySystem mavenRepositorySystem;
|
||||
public DefaultRepositorySystemSessionFactory(
|
||||
Logger logger,
|
||||
ArtifactHandlerManager artifactHandlerManager,
|
||||
RepositorySystem repoSystem,
|
||||
@Nullable @Named( "simple" ) LocalRepositoryManagerFactory simpleLocalRepoMgrFactory,
|
||||
@Nullable @Named( "ide" ) WorkspaceReader workspaceRepository,
|
||||
SettingsDecrypter settingsDecrypter,
|
||||
EventSpyDispatcher eventSpyDispatcher,
|
||||
MavenRepositorySystem mavenRepositorySystem )
|
||||
{
|
||||
this.logger = logger;
|
||||
this.artifactHandlerManager = artifactHandlerManager;
|
||||
this.repoSystem = repoSystem;
|
||||
this.simpleLocalRepoMgrFactory = simpleLocalRepoMgrFactory;
|
||||
this.workspaceRepository = workspaceRepository;
|
||||
this.settingsDecrypter = settingsDecrypter;
|
||||
this.eventSpyDispatcher = eventSpyDispatcher;
|
||||
this.mavenRepositorySystem = mavenRepositorySystem;
|
||||
}
|
||||
|
||||
public DefaultRepositorySystemSession newRepositorySession( MavenExecutionRequest request )
|
||||
{
|
||||
|
|
|
@ -62,33 +62,38 @@ public class DefaultLifecycleExecutor
|
|||
implements LifecycleExecutor
|
||||
{
|
||||
|
||||
@Inject
|
||||
private LifeCyclePluginAnalyzer lifeCyclePluginAnalyzer;
|
||||
private final 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
|
||||
private DefaultLifecycles defaultLifeCycles;
|
||||
|
||||
@Inject
|
||||
private LifecycleTaskSegmentCalculator lifecycleTaskSegmentCalculator;
|
||||
|
||||
@Inject
|
||||
private LifecycleExecutionPlanCalculator lifecycleExecutionPlanCalculator;
|
||||
|
||||
@Inject
|
||||
private MojoExecutor mojoExecutor;
|
||||
|
||||
@Inject
|
||||
private LifecycleStarter lifecycleStarter;
|
||||
|
||||
public DefaultLifecycleExecutor(
|
||||
LifeCyclePluginAnalyzer lifeCyclePluginAnalyzer,
|
||||
DefaultLifecycles defaultLifeCycles,
|
||||
LifecycleTaskSegmentCalculator lifecycleTaskSegmentCalculator,
|
||||
LifecycleExecutionPlanCalculator lifecycleExecutionPlanCalculator,
|
||||
MojoExecutor mojoExecutor,
|
||||
LifecycleStarter lifecycleStarter,
|
||||
MojoDescriptorCreator mojoDescriptorCreator )
|
||||
{
|
||||
this.lifeCyclePluginAnalyzer = lifeCyclePluginAnalyzer;
|
||||
this.defaultLifeCycles = defaultLifeCycles;
|
||||
this.lifecycleTaskSegmentCalculator = lifecycleTaskSegmentCalculator;
|
||||
this.lifecycleExecutionPlanCalculator = lifecycleExecutionPlanCalculator;
|
||||
this.mojoExecutor = mojoExecutor;
|
||||
this.lifecycleStarter = lifecycleStarter;
|
||||
this.mojoDescriptorCreator = mojoDescriptorCreator;
|
||||
}
|
||||
|
||||
public void execute( MavenSession session )
|
||||
{
|
||||
lifecycleStarter.execute( session );
|
||||
}
|
||||
|
||||
@Inject
|
||||
private MojoDescriptorCreator mojoDescriptorCreator;
|
||||
|
||||
// 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
|
||||
// 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.prefix.NoPluginFoundForPrefixException;
|
||||
import org.apache.maven.plugin.version.PluginVersionResolutionException;
|
||||
import org.apache.maven.plugin.version.PluginVersionResolver;
|
||||
import org.apache.maven.project.MavenProject;
|
||||
import org.codehaus.plexus.util.StringUtils;
|
||||
import org.codehaus.plexus.util.xml.Xpp3Dom;
|
||||
|
@ -75,34 +74,38 @@ import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
|
|||
public class DefaultLifecycleExecutionPlanCalculator
|
||||
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
|
||||
private BuildPluginManager pluginManager;
|
||||
|
||||
@Inject
|
||||
private DefaultLifecycles defaultLifeCycles;
|
||||
|
||||
@Inject
|
||||
private MojoDescriptorCreator mojoDescriptorCreator;
|
||||
|
||||
@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()
|
||||
public DefaultLifecycleExecutionPlanCalculator(
|
||||
BuildPluginManager pluginManager,
|
||||
DefaultLifecycles defaultLifeCycles,
|
||||
MojoDescriptorCreator mojoDescriptorCreator,
|
||||
LifecyclePluginResolver lifecyclePluginResolver,
|
||||
@Named( DefaultLifecycleMappingDelegate.HINT ) LifecycleMappingDelegate standardDelegate,
|
||||
Map<String, LifecycleMappingDelegate> delegates,
|
||||
Map<String, MojoExecutionConfigurator> mojoExecutionConfigurators )
|
||||
{
|
||||
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
|
||||
|
@ -115,6 +118,8 @@ public class DefaultLifecycleExecutionPlanCalculator
|
|||
this.defaultLifeCycles = defaultLifeCycles;
|
||||
this.mojoDescriptorCreator = mojoDescriptorCreator;
|
||||
this.lifecyclePluginResolver = lifecyclePluginResolver;
|
||||
this.standardDelegate = null;
|
||||
this.delegates = null;
|
||||
this.mojoExecutionConfigurators = Collections.singletonMap(
|
||||
"default", (MojoExecutionConfigurator) new DefaultMojoExecutionConfigurator() );
|
||||
}
|
||||
|
|
|
@ -58,14 +58,17 @@ import org.codehaus.plexus.util.StringUtils;
|
|||
public class DefaultLifecycleTaskSegmentCalculator
|
||||
implements LifecycleTaskSegmentCalculator
|
||||
{
|
||||
@Inject
|
||||
private MojoDescriptorCreator mojoDescriptorCreator;
|
||||
private final MojoDescriptorCreator mojoDescriptorCreator;
|
||||
|
||||
private final LifecyclePluginResolver lifecyclePluginResolver;
|
||||
|
||||
@Inject
|
||||
private LifecyclePluginResolver lifecyclePluginResolver;
|
||||
|
||||
public DefaultLifecycleTaskSegmentCalculator()
|
||||
public DefaultLifecycleTaskSegmentCalculator(
|
||||
MojoDescriptorCreator mojoDescriptorCreator,
|
||||
LifecyclePluginResolver lifecyclePluginResolver )
|
||||
{
|
||||
this.mojoDescriptorCreator = mojoDescriptorCreator;
|
||||
this.lifecyclePluginResolver = lifecyclePluginResolver;
|
||||
}
|
||||
|
||||
public List<TaskSegment> calculateTaskSegments( MavenSession session )
|
||||
|
|
|
@ -52,20 +52,14 @@ import org.codehaus.plexus.util.StringUtils;
|
|||
@Singleton
|
||||
public class LifecycleDebugLogger
|
||||
{
|
||||
private final Logger logger;
|
||||
|
||||
@Inject
|
||||
private Logger logger;
|
||||
|
||||
|
||||
public LifecycleDebugLogger()
|
||||
{
|
||||
}
|
||||
|
||||
public LifecycleDebugLogger( Logger logger )
|
||||
{
|
||||
this.logger = logger;
|
||||
}
|
||||
|
||||
|
||||
public void debug( String s )
|
||||
{
|
||||
logger.debug( s );
|
||||
|
|
|
@ -67,29 +67,29 @@ import org.eclipse.aether.util.filter.ScopeDependencyFilter;
|
|||
public class LifecycleDependencyResolver
|
||||
{
|
||||
|
||||
@Inject
|
||||
private ProjectDependenciesResolver dependenciesResolver;
|
||||
private final ProjectDependenciesResolver dependenciesResolver;
|
||||
|
||||
private final Logger logger;
|
||||
|
||||
private final ProjectArtifactFactory artifactFactory;
|
||||
|
||||
private final EventSpyDispatcher eventSpyDispatcher;
|
||||
|
||||
private final ProjectArtifactsCache projectArtifactsCache;
|
||||
|
||||
@Inject
|
||||
private Logger logger;
|
||||
|
||||
@Inject
|
||||
private ProjectArtifactFactory artifactFactory;
|
||||
|
||||
@Inject
|
||||
private EventSpyDispatcher eventSpyDispatcher;
|
||||
|
||||
@Inject
|
||||
private ProjectArtifactsCache projectArtifactsCache;
|
||||
|
||||
public LifecycleDependencyResolver()
|
||||
public LifecycleDependencyResolver(
|
||||
ProjectDependenciesResolver dependenciesResolver,
|
||||
Logger logger,
|
||||
ProjectArtifactFactory artifactFactory,
|
||||
EventSpyDispatcher eventSpyDispatcher,
|
||||
ProjectArtifactsCache projectArtifactsCache )
|
||||
{
|
||||
}
|
||||
|
||||
public LifecycleDependencyResolver( ProjectDependenciesResolver projectDependenciesResolver, Logger logger )
|
||||
{
|
||||
this.dependenciesResolver = projectDependenciesResolver;
|
||||
this.dependenciesResolver = dependenciesResolver;
|
||||
this.logger = logger;
|
||||
this.artifactFactory = artifactFactory;
|
||||
this.eventSpyDispatcher = eventSpyDispatcher;
|
||||
this.projectArtifactsCache = projectArtifactsCache;
|
||||
}
|
||||
|
||||
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
|
||||
{
|
||||
|
||||
@Inject
|
||||
private MojoExecutor mojoExecutor;
|
||||
private final MojoExecutor mojoExecutor;
|
||||
private final BuilderCommon builderCommon;
|
||||
private final ExecutionEventCatapult eventCatapult;
|
||||
private final ProjectExecutionListener projectExecutionListener;
|
||||
private final SessionScope sessionScope;
|
||||
|
||||
@Inject
|
||||
private BuilderCommon builderCommon;
|
||||
|
||||
@Inject
|
||||
private ExecutionEventCatapult eventCatapult;
|
||||
|
||||
private ProjectExecutionListener projectExecutionListener;
|
||||
|
||||
@Inject
|
||||
private SessionScope sessionScope;
|
||||
|
||||
@Inject
|
||||
public void setProjectExecutionListeners( final List<ProjectExecutionListener> listeners )
|
||||
public LifecycleModuleBuilder(
|
||||
MojoExecutor mojoExecutor,
|
||||
BuilderCommon builderCommon,
|
||||
ExecutionEventCatapult eventCatapult,
|
||||
List<ProjectExecutionListener> listeners,
|
||||
SessionScope sessionScope )
|
||||
{
|
||||
this.mojoExecutor = mojoExecutor;
|
||||
this.builderCommon = builderCommon;
|
||||
this.eventCatapult = eventCatapult;
|
||||
this.projectExecutionListener = new CompoundProjectExecutionListener( listeners );
|
||||
this.sessionScope = sessionScope;
|
||||
}
|
||||
|
||||
public void buildProject( MavenSession session, ReactorContext reactorContext, MavenProject currentProject,
|
||||
|
|
|
@ -48,29 +48,42 @@ import org.codehaus.plexus.logging.Logger;
|
|||
@Singleton
|
||||
public class LifecycleStarter
|
||||
{
|
||||
@Inject
|
||||
private ExecutionEventCatapult eventCatapult;
|
||||
private final 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
|
||||
private DefaultLifecycles defaultLifeCycles;
|
||||
|
||||
@Inject
|
||||
private Logger logger;
|
||||
|
||||
@Inject
|
||||
private BuildListCalculator buildListCalculator;
|
||||
|
||||
@Inject
|
||||
private LifecycleDebugLogger lifecycleDebugLogger;
|
||||
|
||||
@Inject
|
||||
private LifecycleTaskSegmentCalculator lifecycleTaskSegmentCalculator;
|
||||
|
||||
@Inject
|
||||
private Map<String, Builder> builders;
|
||||
|
||||
@Inject
|
||||
private SessionScope sessionScope;
|
||||
public LifecycleStarter(
|
||||
ExecutionEventCatapult eventCatapult,
|
||||
DefaultLifecycles defaultLifeCycles,
|
||||
Logger logger,
|
||||
BuildListCalculator buildListCalculator,
|
||||
LifecycleDebugLogger lifecycleDebugLogger,
|
||||
LifecycleTaskSegmentCalculator lifecycleTaskSegmentCalculator,
|
||||
Map<String, Builder> builders,
|
||||
SessionScope sessionScope )
|
||||
{
|
||||
this.eventCatapult = eventCatapult;
|
||||
this.defaultLifeCycles = defaultLifeCycles;
|
||||
this.logger = logger;
|
||||
this.buildListCalculator = buildListCalculator;
|
||||
this.lifecycleDebugLogger = lifecycleDebugLogger;
|
||||
this.lifecycleTaskSegmentCalculator = lifecycleTaskSegmentCalculator;
|
||||
this.builders = builders;
|
||||
this.sessionScope = sessionScope;
|
||||
}
|
||||
|
||||
public void execute( MavenSession session )
|
||||
{
|
||||
|
|
|
@ -67,29 +67,21 @@ import org.codehaus.plexus.util.xml.Xpp3Dom;
|
|||
public class MojoDescriptorCreator
|
||||
{
|
||||
|
||||
@Inject
|
||||
private Logger logger;
|
||||
private final Logger logger;
|
||||
private final PluginVersionResolver pluginVersionResolver;
|
||||
private final BuildPluginManager pluginManager;
|
||||
private final PluginPrefixResolver pluginPrefixResolver;
|
||||
private final LifecyclePluginResolver lifecyclePluginResolver;
|
||||
|
||||
@Inject
|
||||
private PluginVersionResolver pluginVersionResolver;
|
||||
|
||||
@Inject
|
||||
private BuildPluginManager pluginManager;
|
||||
|
||||
@Inject
|
||||
private PluginPrefixResolver pluginPrefixResolver;
|
||||
|
||||
@Inject
|
||||
private LifecyclePluginResolver lifecyclePluginResolver;
|
||||
|
||||
public MojoDescriptorCreator()
|
||||
{
|
||||
}
|
||||
|
||||
public MojoDescriptorCreator( PluginVersionResolver pluginVersionResolver, BuildPluginManager pluginManager,
|
||||
public MojoDescriptorCreator(
|
||||
Logger logger,
|
||||
PluginVersionResolver pluginVersionResolver,
|
||||
BuildPluginManager pluginManager,
|
||||
PluginPrefixResolver pluginPrefixResolver,
|
||||
LifecyclePluginResolver lifecyclePluginResolver )
|
||||
{
|
||||
this.logger = logger;
|
||||
this.pluginVersionResolver = pluginVersionResolver;
|
||||
this.pluginManager = pluginManager;
|
||||
this.pluginPrefixResolver = pluginPrefixResolver;
|
||||
|
|
|
@ -67,20 +67,22 @@ import org.codehaus.plexus.util.StringUtils;
|
|||
public class MojoExecutor
|
||||
{
|
||||
|
||||
@Inject
|
||||
private BuildPluginManager pluginManager;
|
||||
private final BuildPluginManager pluginManager;
|
||||
private final MavenPluginManager mavenPluginManager;
|
||||
private final LifecycleDependencyResolver lifeCycleDependencyResolver;
|
||||
private final ExecutionEventCatapult eventCatapult;
|
||||
|
||||
@Inject
|
||||
private MavenPluginManager mavenPluginManager;
|
||||
|
||||
@Inject
|
||||
private LifecycleDependencyResolver lifeCycleDependencyResolver;
|
||||
|
||||
@Inject
|
||||
private ExecutionEventCatapult eventCatapult;
|
||||
|
||||
public MojoExecutor()
|
||||
public MojoExecutor(
|
||||
BuildPluginManager pluginManager,
|
||||
MavenPluginManager mavenPluginManager,
|
||||
LifecycleDependencyResolver lifeCycleDependencyResolver,
|
||||
ExecutionEventCatapult eventCatapult )
|
||||
{
|
||||
this.pluginManager = pluginManager;
|
||||
this.mavenPluginManager = mavenPluginManager;
|
||||
this.lifeCycleDependencyResolver = lifeCycleDependencyResolver;
|
||||
this.eventCatapult = eventCatapult;
|
||||
}
|
||||
|
||||
public DependencyContext newDependencyContext( MavenSession session, List<MojoExecution> mojoExecutions )
|
||||
|
|
|
@ -71,28 +71,22 @@ import org.codehaus.plexus.logging.Logger;
|
|||
@Singleton
|
||||
public class BuilderCommon
|
||||
{
|
||||
@Inject
|
||||
private LifecycleDebugLogger lifecycleDebugLogger;
|
||||
private final Logger logger;
|
||||
private final LifecycleDebugLogger lifecycleDebugLogger;
|
||||
private final LifecycleExecutionPlanCalculator lifeCycleExecutionPlanCalculator;
|
||||
private final ExecutionEventCatapult eventCatapult;
|
||||
|
||||
@Inject
|
||||
private LifecycleExecutionPlanCalculator lifeCycleExecutionPlanCalculator;
|
||||
|
||||
@Inject
|
||||
private ExecutionEventCatapult eventCatapult;
|
||||
|
||||
@Inject
|
||||
private Logger logger;
|
||||
|
||||
public BuilderCommon()
|
||||
{
|
||||
}
|
||||
|
||||
public BuilderCommon( LifecycleDebugLogger lifecycleDebugLogger,
|
||||
LifecycleExecutionPlanCalculator lifeCycleExecutionPlanCalculator, Logger logger )
|
||||
public BuilderCommon(
|
||||
Logger logger,
|
||||
LifecycleDebugLogger lifecycleDebugLogger,
|
||||
LifecycleExecutionPlanCalculator lifeCycleExecutionPlanCalculator,
|
||||
ExecutionEventCatapult eventCatapult )
|
||||
{
|
||||
this.logger = logger;
|
||||
this.lifecycleDebugLogger = lifecycleDebugLogger;
|
||||
this.lifeCycleExecutionPlanCalculator = lifeCycleExecutionPlanCalculator;
|
||||
this.logger = logger;
|
||||
this.eventCatapult = eventCatapult;
|
||||
}
|
||||
|
||||
public MavenExecutionPlan resolveBuildPlan( MavenSession session, MavenProject project, TaskSegment taskSegment,
|
||||
|
|
|
@ -65,14 +65,14 @@ public class MultiThreadedBuilder
|
|||
implements Builder
|
||||
{
|
||||
|
||||
@Inject
|
||||
private Logger logger;
|
||||
private final Logger logger;
|
||||
private final LifecycleModuleBuilder lifecycleModuleBuilder;
|
||||
|
||||
@Inject
|
||||
private LifecycleModuleBuilder lifecycleModuleBuilder;
|
||||
|
||||
public MultiThreadedBuilder()
|
||||
public MultiThreadedBuilder( Logger logger, LifecycleModuleBuilder lifecycleModuleBuilder )
|
||||
{
|
||||
this.logger = logger;
|
||||
this.lifecycleModuleBuilder = lifecycleModuleBuilder;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -55,10 +55,15 @@ public class DefaultLifecycleBindingsInjector
|
|||
implements LifecycleBindingsInjector
|
||||
{
|
||||
|
||||
private LifecycleBindingsMerger merger = new LifecycleBindingsMerger();
|
||||
private final LifecycleBindingsMerger merger = new LifecycleBindingsMerger();
|
||||
|
||||
private final LifeCyclePluginAnalyzer lifecycle;
|
||||
|
||||
@Inject
|
||||
private LifeCyclePluginAnalyzer lifecycle;
|
||||
public DefaultLifecycleBindingsInjector( LifeCyclePluginAnalyzer lifecycle )
|
||||
{
|
||||
this.lifecycle = lifecycle;
|
||||
}
|
||||
|
||||
public void injectLifecycleBindings( Model model, ModelBuildingRequest request, ModelProblemCollector problems )
|
||||
{
|
||||
|
|
|
@ -51,21 +51,22 @@ public class DefaultBuildPluginManager
|
|||
implements BuildPluginManager
|
||||
{
|
||||
|
||||
@Inject
|
||||
private MavenPluginManager mavenPluginManager;
|
||||
private final MavenPluginManager mavenPluginManager;
|
||||
private final LegacySupport legacySupport;
|
||||
private final MojoExecutionScope scope;
|
||||
private final MojoExecutionListener mojoExecutionListener;
|
||||
|
||||
@Inject
|
||||
private LegacySupport legacySupport;
|
||||
|
||||
@Inject
|
||||
private MojoExecutionScope scope;
|
||||
|
||||
private MojoExecutionListener mojoExecutionListener;
|
||||
|
||||
@Inject
|
||||
public void setMojoExecutionListeners( final List<MojoExecutionListener> listeners )
|
||||
public DefaultBuildPluginManager(
|
||||
MavenPluginManager mavenPluginManager,
|
||||
LegacySupport legacySupport,
|
||||
MojoExecutionScope scope,
|
||||
List<MojoExecutionListener> mojoExecutionListeners )
|
||||
{
|
||||
this.mojoExecutionListener = new CompoundMojoExecutionListener( listeners );
|
||||
this.mavenPluginManager = mavenPluginManager;
|
||||
this.legacySupport = legacySupport;
|
||||
this.scope = scope;
|
||||
this.mojoExecutionListener = new CompoundMojoExecutionListener( mojoExecutionListeners );
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -132,45 +132,50 @@ public class DefaultMavenPluginManager
|
|||
*/
|
||||
public static final String KEY_EXTENSIONS_REALMS = DefaultMavenPluginManager.class.getName() + "/extensionsRealms";
|
||||
|
||||
@Inject
|
||||
private Logger logger;
|
||||
|
||||
@Inject
|
||||
private LoggerManager loggerManager;
|
||||
|
||||
@Inject
|
||||
private PlexusContainer container;
|
||||
|
||||
@Inject
|
||||
private ClassRealmManager classRealmManager;
|
||||
|
||||
@Inject
|
||||
private PluginDescriptorCache pluginDescriptorCache;
|
||||
|
||||
@Inject
|
||||
private PluginRealmCache pluginRealmCache;
|
||||
|
||||
@Inject
|
||||
private PluginDependenciesResolver pluginDependenciesResolver;
|
||||
|
||||
@Inject
|
||||
private RuntimeInformation runtimeInformation;
|
||||
|
||||
@Inject
|
||||
private ExtensionRealmCache extensionRealmCache;
|
||||
|
||||
@Inject
|
||||
private PluginVersionResolver pluginVersionResolver;
|
||||
|
||||
@Inject
|
||||
private PluginArtifactsCache pluginArtifactsCache;
|
||||
|
||||
@Inject
|
||||
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,
|
||||
RepositorySystemSession session )
|
||||
|
|
|
@ -78,11 +78,15 @@ public class DefaultPluginDependenciesResolver
|
|||
|
||||
private static final String REPOSITORY_CONTEXT = "plugin";
|
||||
|
||||
@Inject
|
||||
private Logger logger;
|
||||
private final Logger logger;
|
||||
private final RepositorySystem repoSystem;
|
||||
|
||||
@Inject
|
||||
private RepositorySystem repoSystem;
|
||||
public DefaultPluginDependenciesResolver( Logger logger, RepositorySystem repoSystem )
|
||||
{
|
||||
this.logger = logger;
|
||||
this.repoSystem = repoSystem;
|
||||
}
|
||||
|
||||
private Artifact toArtifact( Plugin plugin, RepositorySystemSession session )
|
||||
{
|
||||
|
|
|
@ -70,20 +70,26 @@ public class DefaultPluginManager
|
|||
implements PluginManager
|
||||
{
|
||||
|
||||
@Inject
|
||||
private PlexusContainer container;
|
||||
private final PlexusContainer container;
|
||||
private final MavenPluginManager pluginManager;
|
||||
private final PluginVersionResolver pluginVersionResolver;
|
||||
private final PluginPrefixResolver pluginPrefixResolver;
|
||||
private final LegacySupport legacySupport;
|
||||
|
||||
@Inject
|
||||
private MavenPluginManager pluginManager;
|
||||
|
||||
@Inject
|
||||
private PluginVersionResolver pluginVersionResolver;
|
||||
|
||||
@Inject
|
||||
private PluginPrefixResolver pluginPrefixResolver;
|
||||
|
||||
@Inject
|
||||
private LegacySupport legacySupport;
|
||||
public DefaultPluginManager(
|
||||
PlexusContainer container,
|
||||
MavenPluginManager pluginManager,
|
||||
PluginVersionResolver pluginVersionResolver,
|
||||
PluginPrefixResolver pluginPrefixResolver,
|
||||
LegacySupport legacySupport )
|
||||
{
|
||||
this.container = container;
|
||||
this.pluginManager = pluginManager;
|
||||
this.pluginVersionResolver = pluginVersionResolver;
|
||||
this.pluginPrefixResolver = pluginPrefixResolver;
|
||||
this.legacySupport = legacySupport;
|
||||
}
|
||||
|
||||
public void executeMojo( MavenProject project, MojoExecution execution, MavenSession session )
|
||||
throws MojoExecutionException, ArtifactResolutionException, MojoFailureException, ArtifactNotFoundException,
|
||||
|
|
|
@ -68,17 +68,23 @@ public class DefaultPluginPrefixResolver
|
|||
|
||||
private static final String REPOSITORY_CONTEXT = "plugin";
|
||||
|
||||
@Inject
|
||||
private Logger logger;
|
||||
private final Logger logger;
|
||||
private final BuildPluginManager pluginManager;
|
||||
private final RepositorySystem repositorySystem;
|
||||
private final MetadataReader metadataReader;
|
||||
|
||||
@Inject
|
||||
private BuildPluginManager pluginManager;
|
||||
|
||||
@Inject
|
||||
private RepositorySystem repositorySystem;
|
||||
|
||||
@Inject
|
||||
private MetadataReader metadataReader;
|
||||
public DefaultPluginPrefixResolver(
|
||||
Logger logger,
|
||||
BuildPluginManager pluginManager,
|
||||
RepositorySystem repositorySystem,
|
||||
MetadataReader metadataReader )
|
||||
{
|
||||
this.logger = logger;
|
||||
this.pluginManager = pluginManager;
|
||||
this.repositorySystem = repositorySystem;
|
||||
this.metadataReader = metadataReader;
|
||||
}
|
||||
|
||||
public PluginPrefixResult resolve( PluginPrefixRequest request )
|
||||
throws NoPluginFoundForPrefixException
|
||||
|
|
|
@ -81,17 +81,23 @@ public class DefaultPluginVersionResolver
|
|||
|
||||
private static final Object CACHE_KEY = new Object();
|
||||
|
||||
@Inject
|
||||
private Logger logger;
|
||||
private final Logger logger;
|
||||
private final RepositorySystem repositorySystem;
|
||||
private final MetadataReader metadataReader;
|
||||
private final MavenPluginManager pluginManager;
|
||||
|
||||
@Inject
|
||||
private RepositorySystem repositorySystem;
|
||||
|
||||
@Inject
|
||||
private MetadataReader metadataReader;
|
||||
|
||||
@Inject
|
||||
private MavenPluginManager pluginManager;
|
||||
public DefaultPluginVersionResolver(
|
||||
Logger logger,
|
||||
RepositorySystem repositorySystem,
|
||||
MetadataReader metadataReader,
|
||||
MavenPluginManager pluginManager )
|
||||
{
|
||||
this.logger = logger;
|
||||
this.repositorySystem = repositorySystem;
|
||||
this.metadataReader = metadataReader;
|
||||
this.pluginManager = pluginManager;
|
||||
}
|
||||
|
||||
public PluginVersionResult resolve( PluginVersionRequest request )
|
||||
throws PluginVersionResolutionException
|
||||
|
|
|
@ -75,6 +75,7 @@ import org.apache.maven.repository.internal.DefaultModelCache;
|
|||
import org.codehaus.plexus.logging.Logger;
|
||||
import org.codehaus.plexus.util.Os;
|
||||
import org.codehaus.plexus.util.StringUtils;
|
||||
import org.eclipse.aether.RepositorySystem;
|
||||
import org.eclipse.aether.RepositorySystemSession;
|
||||
import org.eclipse.aether.RequestTrace;
|
||||
import org.eclipse.aether.impl.RemoteRepositoryManager;
|
||||
|
@ -93,31 +94,36 @@ public class DefaultProjectBuilder
|
|||
implements ProjectBuilder
|
||||
{
|
||||
|
||||
@Inject
|
||||
private Logger logger;
|
||||
private final 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
|
||||
private ModelBuilder modelBuilder;
|
||||
|
||||
@Inject
|
||||
private ModelProcessor modelProcessor;
|
||||
|
||||
@Inject
|
||||
private ProjectBuildingHelper projectBuildingHelper;
|
||||
|
||||
@Inject
|
||||
private MavenRepositorySystem repositorySystem;
|
||||
|
||||
@Inject
|
||||
private org.eclipse.aether.RepositorySystem repoSystem;
|
||||
|
||||
@Inject
|
||||
private RemoteRepositoryManager repositoryManager;
|
||||
|
||||
@Inject
|
||||
private ProjectDependenciesResolver dependencyResolver;
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
public DefaultProjectBuilder(
|
||||
Logger logger,
|
||||
ModelBuilder modelBuilder,
|
||||
ModelProcessor modelProcessor,
|
||||
ProjectBuildingHelper projectBuildingHelper,
|
||||
MavenRepositorySystem repositorySystem,
|
||||
RepositorySystem repoSystem,
|
||||
RemoteRepositoryManager repositoryManager,
|
||||
ProjectDependenciesResolver dependencyResolver )
|
||||
{
|
||||
this.logger = logger;
|
||||
this.modelBuilder = modelBuilder;
|
||||
this.modelProcessor = modelProcessor;
|
||||
this.projectBuildingHelper = projectBuildingHelper;
|
||||
this.repositorySystem = repositorySystem;
|
||||
this.repoSystem = repoSystem;
|
||||
this.repositoryManager = repositoryManager;
|
||||
this.dependencyResolver = dependencyResolver;
|
||||
}
|
||||
// ----------------------------------------------------------------------
|
||||
// MavenProjectBuilder Implementation
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
|
|
|
@ -68,23 +68,29 @@ public class DefaultProjectBuildingHelper
|
|||
implements ProjectBuildingHelper
|
||||
{
|
||||
|
||||
@Inject
|
||||
private Logger logger;
|
||||
private final Logger logger;
|
||||
private final PlexusContainer container;
|
||||
private final ClassRealmManager classRealmManager;
|
||||
private final ProjectRealmCache projectRealmCache;
|
||||
private final RepositorySystem repositorySystem;
|
||||
private final MavenPluginManager pluginManager;
|
||||
|
||||
@Inject
|
||||
private PlexusContainer container;
|
||||
|
||||
@Inject
|
||||
private ClassRealmManager classRealmManager;
|
||||
|
||||
@Inject
|
||||
private ProjectRealmCache projectRealmCache;
|
||||
|
||||
@Inject
|
||||
private RepositorySystem repositorySystem;
|
||||
|
||||
@Inject
|
||||
private MavenPluginManager pluginManager;
|
||||
public DefaultProjectBuildingHelper(
|
||||
Logger logger,
|
||||
PlexusContainer container,
|
||||
ClassRealmManager classRealmManager,
|
||||
ProjectRealmCache projectRealmCache,
|
||||
RepositorySystem repositorySystem,
|
||||
MavenPluginManager pluginManager )
|
||||
{
|
||||
this.logger = logger;
|
||||
this.container = container;
|
||||
this.classRealmManager = classRealmManager;
|
||||
this.projectRealmCache = projectRealmCache;
|
||||
this.repositorySystem = repositorySystem;
|
||||
this.pluginManager = pluginManager;
|
||||
}
|
||||
|
||||
public List<ArtifactRepository> createArtifactRepositories( List<Repository> pomRepositories,
|
||||
List<ArtifactRepository> externalRepositories,
|
||||
|
|
|
@ -62,14 +62,20 @@ public class DefaultProjectDependenciesResolver
|
|||
implements ProjectDependenciesResolver
|
||||
{
|
||||
|
||||
@Inject
|
||||
private Logger logger;
|
||||
private final Logger logger;
|
||||
private final RepositorySystem repoSystem;
|
||||
private final List<RepositorySessionDecorator> decorators;
|
||||
|
||||
@Inject
|
||||
private RepositorySystem repoSystem;
|
||||
|
||||
@Inject
|
||||
private List<RepositorySessionDecorator> decorators;
|
||||
public DefaultProjectDependenciesResolver(
|
||||
Logger logger,
|
||||
RepositorySystem repoSystem,
|
||||
List<RepositorySessionDecorator> decorators )
|
||||
{
|
||||
this.logger = logger;
|
||||
this.repoSystem = repoSystem;
|
||||
this.decorators = decorators;
|
||||
}
|
||||
|
||||
public DependencyResolutionResult resolve( DependencyResolutionRequest request )
|
||||
throws DependencyResolutionException
|
||||
|
|
|
@ -19,9 +19,16 @@ package org.apache.maven.project.artifact;
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Named;
|
||||
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
|
||||
* 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
|
||||
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.legacy.metadata.DefaultMetadataResolutionRequest;
|
||||
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.eclipse.aether.RepositorySystemSession;
|
||||
import org.eclipse.aether.repository.RepositoryPolicy;
|
||||
|
@ -94,27 +92,30 @@ import org.eclipse.aether.transfer.ArtifactNotFoundException;
|
|||
public class MavenMetadataSource
|
||||
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;
|
||||
|
||||
@Inject
|
||||
private RepositoryMetadataManager repositoryMetadataManager;
|
||||
private ArtifactFactory repositorySystem;
|
||||
private ProjectBuilder projectBuilder;
|
||||
private MavenMetadataCache cache;
|
||||
private LegacySupport legacySupport;
|
||||
|
||||
@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 )
|
||||
{
|
||||
|
@ -535,24 +536,6 @@ public class MavenMetadataSource
|
|||
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" )
|
||||
private ProjectRelocation retrieveRelocatedProject( Artifact artifact, MetadataResolutionRequest repositoryRequest )
|
||||
throws ArtifactMetadataRetrievalException
|
||||
|
@ -593,7 +576,7 @@ public class MavenMetadataSource
|
|||
configuration.setSystemProperties( getSystemProperties() );
|
||||
configuration.setRepositorySession( legacySupport.getRepositorySession() );
|
||||
|
||||
project = getProjectBuilder().build( pomArtifact, configuration ).getProject();
|
||||
project = projectBuilder.build( pomArtifact, configuration ).getProject();
|
||||
}
|
||||
catch ( ProjectBuildingException e )
|
||||
{
|
||||
|
|
|
@ -46,11 +46,16 @@ public class DefaultRuntimeInformation
|
|||
implements RuntimeInformation
|
||||
{
|
||||
|
||||
@Inject
|
||||
private Logger logger;
|
||||
private final Logger logger;
|
||||
|
||||
private String mavenVersion;
|
||||
|
||||
@Inject
|
||||
public DefaultRuntimeInformation( Logger logger )
|
||||
{
|
||||
this.logger = logger;
|
||||
}
|
||||
|
||||
public String getMavenVersion()
|
||||
{
|
||||
if ( mavenVersion == null )
|
||||
|
|
|
@ -46,8 +46,13 @@ public class DefaultMavenSettingsBuilder
|
|||
implements MavenSettingsBuilder
|
||||
{
|
||||
|
||||
private final SettingsBuilder settingsBuilder;
|
||||
|
||||
@Inject
|
||||
private SettingsBuilder settingsBuilder;
|
||||
public DefaultMavenSettingsBuilder( SettingsBuilder settingsBuilder )
|
||||
{
|
||||
this.settingsBuilder = settingsBuilder;
|
||||
}
|
||||
|
||||
public Settings buildSettings()
|
||||
throws IOException, XmlPullParserException
|
||||
|
|
|
@ -43,11 +43,15 @@ import org.codehaus.plexus.logging.Logger;
|
|||
public class DefaultToolchainManager
|
||||
implements ToolchainManager
|
||||
{
|
||||
@Inject
|
||||
Logger logger;
|
||||
final Logger logger;
|
||||
final Map<String, ToolchainFactory> factories;
|
||||
|
||||
@Inject
|
||||
Map<String, ToolchainFactory> factories;
|
||||
public DefaultToolchainManager( Logger logger, Map<String, ToolchainFactory> factories )
|
||||
{
|
||||
this.logger = logger;
|
||||
this.factories = factories;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Toolchain getToolchainFromBuildContext( String type, MavenSession session )
|
||||
|
|
|
@ -23,11 +23,13 @@ import java.util.ArrayList;
|
|||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Named;
|
||||
import javax.inject.Singleton;
|
||||
|
||||
import org.apache.maven.execution.MavenSession;
|
||||
import org.apache.maven.toolchain.model.ToolchainModel;
|
||||
import org.codehaus.plexus.logging.Logger;
|
||||
|
||||
/**
|
||||
* @author mkleint
|
||||
|
@ -40,6 +42,12 @@ public class DefaultToolchainManagerPrivate
|
|||
implements ToolchainManagerPrivate
|
||||
{
|
||||
|
||||
@Inject
|
||||
public DefaultToolchainManagerPrivate( Logger logger, Map<String, ToolchainFactory> factories )
|
||||
{
|
||||
super( logger, factories );
|
||||
}
|
||||
|
||||
@Override
|
||||
public ToolchainPrivate[] getToolchainsForType( String type, MavenSession context )
|
||||
throws MisconfiguredToolchainException
|
||||
|
|
|
@ -42,8 +42,13 @@ public class DefaultToolchainsBuilder
|
|||
implements ToolchainsBuilder
|
||||
{
|
||||
|
||||
private final Logger logger;
|
||||
|
||||
@Inject
|
||||
private Logger logger;
|
||||
public DefaultToolchainsBuilder( Logger logger )
|
||||
{
|
||||
this.logger = logger;
|
||||
}
|
||||
|
||||
public PersistedToolchains build( File userToolchainsFile )
|
||||
throws MisconfiguredToolchainException
|
||||
|
|
|
@ -53,13 +53,18 @@ import java.util.Map;
|
|||
public class DefaultToolchainsBuilder
|
||||
implements ToolchainsBuilder
|
||||
{
|
||||
private MavenToolchainMerger toolchainsMerger = new MavenToolchainMerger();
|
||||
|
||||
@Inject
|
||||
private final MavenToolchainMerger toolchainsMerger = new MavenToolchainMerger();
|
||||
private ToolchainsWriter toolchainsWriter;
|
||||
private ToolchainsReader toolchainsReader;
|
||||
|
||||
@Inject
|
||||
private ToolchainsReader toolchainsReader;
|
||||
public DefaultToolchainsBuilder(
|
||||
ToolchainsWriter toolchainsWriter,
|
||||
ToolchainsReader toolchainsReader )
|
||||
{
|
||||
this.toolchainsWriter = toolchainsWriter;
|
||||
this.toolchainsReader = toolchainsReader;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ToolchainsBuildingResult build( ToolchainsBuildingRequest request )
|
||||
|
|
|
@ -51,9 +51,14 @@ public class JavaToolchainFactory
|
|||
implements ToolchainFactory
|
||||
{
|
||||
|
||||
@Inject
|
||||
private Logger logger;
|
||||
|
||||
@Inject
|
||||
public JavaToolchainFactory( Logger logger )
|
||||
{
|
||||
this.logger = logger;
|
||||
}
|
||||
|
||||
public ToolchainPrivate createToolchain( ToolchainModel model )
|
||||
throws MisconfiguredToolchainException
|
||||
{
|
||||
|
|
|
@ -28,6 +28,7 @@ import javax.inject.Singleton;
|
|||
import org.apache.maven.execution.MojoExecutionEvent;
|
||||
import org.apache.maven.execution.MojoExecutionListener;
|
||||
import org.apache.maven.plugin.MojoExecutionException;
|
||||
import org.eclipse.sisu.Priority;
|
||||
|
||||
@Named
|
||||
@Singleton
|
||||
|
|
|
@ -98,8 +98,7 @@ public class BuilderCommonTest
|
|||
public BuilderCommon getBuilderCommon()
|
||||
{
|
||||
final LifecycleDebugLogger debugLogger = new LifecycleDebugLogger( logger );
|
||||
return new BuilderCommon( debugLogger, new LifecycleExecutionPlanCalculatorStub(),
|
||||
logger );
|
||||
return new BuilderCommon( logger, debugLogger, new LifecycleExecutionPlanCalculatorStub(), null );
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -72,7 +72,7 @@ public class LifecycleExecutionPlanCalculatorTest
|
|||
|
||||
public static MojoDescriptorCreator createMojoDescriptorCreator()
|
||||
{
|
||||
return new MojoDescriptorCreator( new PluginVersionResolverStub(), new BuildPluginManagerStub(),
|
||||
return new MojoDescriptorCreator( null, new PluginVersionResolverStub(), new BuildPluginManagerStub(),
|
||||
new PluginPrefixResolverStub(),
|
||||
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.lifecycle.internal.GoalTask;
|
||||
import org.apache.maven.lifecycle.internal.LifecyclePluginResolver;
|
||||
import org.apache.maven.lifecycle.internal.LifecycleTask;
|
||||
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.plugin.InvalidPluginDescriptorException;
|
||||
import org.apache.maven.plugin.MojoNotFoundException;
|
||||
|
@ -43,8 +45,12 @@ public class LifecycleTaskSegmentCalculatorStub
|
|||
|
||||
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,
|
||||
MojoNotFoundException, NoPluginFoundForPrefixException, InvalidPluginDescriptorException,
|
||||
PluginVersionResolutionException
|
||||
|
|
|
@ -18,9 +18,13 @@ package org.apache.maven.lifecycle.internal.stub;
|
|||
import org.apache.maven.execution.MavenSession;
|
||||
import org.apache.maven.lifecycle.LifecycleExecutionException;
|
||||
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.PhaseRecorder;
|
||||
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.descriptor.MojoDescriptor;
|
||||
import org.apache.maven.plugin.descriptor.PluginDescriptor;
|
||||
|
@ -36,7 +40,16 @@ public class MojoExecutorStub
|
|||
extends MojoExecutor
|
||||
{ // 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
|
||||
public void execute( MavenSession session, MojoExecution mojoExecution, ProjectIndex projectIndex,
|
||||
|
|
|
@ -25,10 +25,15 @@ import javax.inject.Named;
|
|||
import javax.inject.Singleton;
|
||||
|
||||
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.ResolutionGroup;
|
||||
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.codehaus.plexus.logging.Logger;
|
||||
|
||||
@SuppressWarnings( "deprecation" )
|
||||
@Named( "classpath" )
|
||||
|
@ -36,6 +41,11 @@ import org.apache.maven.project.artifact.MavenMetadataSource;
|
|||
public class TestMetadataSource
|
||||
extends MavenMetadataSource
|
||||
{
|
||||
|
||||
public TestMetadataSource( Logger logger, RepositoryMetadataManager repositoryMetadataManager, ArtifactFactory repositorySystem, ProjectBuilder projectBuilder, MavenMetadataCache cache, LegacySupport legacySupport) {
|
||||
super( logger, repositoryMetadataManager, repositorySystem, projectBuilder, cache, legacySupport );
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResolutionGroup retrieve( Artifact artifact, ArtifactRepository localRepository,
|
||||
List<ArtifactRepository> remoteRepositories )
|
||||
|
|
|
@ -60,13 +60,13 @@ public class DefaultToolchainManagerPrivateTest
|
|||
@BeforeEach
|
||||
public void setUp()
|
||||
{
|
||||
toolchainManager = new DefaultToolchainManagerPrivate();
|
||||
|
||||
MockitoAnnotations.initMocks( this );
|
||||
|
||||
toolchainManager.factories = new HashMap<>();
|
||||
toolchainManager.factories.put( "basic", toolchainFactory_basicType );
|
||||
toolchainManager.factories.put( "rare", toolchainFactory_rareType );
|
||||
Map<String, ToolchainFactory> factories = new HashMap<>();
|
||||
factories.put( "basic", toolchainFactory_basicType );
|
||||
factories.put( "rare", toolchainFactory_rareType );
|
||||
toolchainManager = new DefaultToolchainManagerPrivate( logger, factories );
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
@ -61,13 +61,12 @@ public class DefaultToolchainManagerTest
|
|||
@BeforeEach
|
||||
public void onSetup() throws Exception
|
||||
{
|
||||
toolchainManager = new DefaultToolchainManager();
|
||||
|
||||
MockitoAnnotations.initMocks( this );
|
||||
|
||||
toolchainManager.factories = new HashMap<>();
|
||||
toolchainManager.factories.put( "basic", toolchainFactory_basicType );
|
||||
toolchainManager.factories.put( "rare", toolchainFactory_rareType );
|
||||
Map<String, ToolchainFactory> factories = new HashMap<>();
|
||||
factories.put( "basic", toolchainFactory_basicType );
|
||||
factories.put( "rare", toolchainFactory_rareType );
|
||||
toolchainManager = new DefaultToolchainManager( logger, factories );
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
@ -73,11 +73,17 @@ public class SettingsXmlConfigurationProcessor
|
|||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger( SettingsXmlConfigurationProcessor.class );
|
||||
|
||||
@Inject
|
||||
private SettingsBuilder settingsBuilder;
|
||||
private final SettingsBuilder settingsBuilder;
|
||||
private final SettingsDecrypter settingsDecrypter;
|
||||
|
||||
@Inject
|
||||
private SettingsDecrypter settingsDecrypter;
|
||||
public SettingsXmlConfigurationProcessor(
|
||||
SettingsBuilder settingsBuilder,
|
||||
SettingsDecrypter settingsDecrypter )
|
||||
{
|
||||
this.settingsBuilder = settingsBuilder;
|
||||
this.settingsDecrypter = settingsDecrypter;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void process( CliRequest cliRequest )
|
||||
|
|
|
@ -103,170 +103,321 @@ import org.eclipse.sisu.Nullable;
|
|||
public class DefaultModelBuilder
|
||||
implements ModelBuilder
|
||||
{
|
||||
@Inject
|
||||
private ModelProcessor modelProcessor;
|
||||
private final ModelMerger modelMerger = new FileToRawModelMerger();
|
||||
|
||||
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
|
||||
private ModelValidator modelValidator;
|
||||
|
||||
@Inject
|
||||
private ModelNormalizer modelNormalizer;
|
||||
|
||||
@Inject
|
||||
private ModelInterpolator modelInterpolator;
|
||||
|
||||
@Inject
|
||||
private ModelPathTranslator modelPathTranslator;
|
||||
|
||||
@Inject
|
||||
private ModelUrlNormalizer modelUrlNormalizer;
|
||||
|
||||
@Inject
|
||||
private SuperPomProvider superPomProvider;
|
||||
|
||||
@Inject
|
||||
private InheritanceAssembler inheritanceAssembler;
|
||||
|
||||
@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 )
|
||||
public DefaultModelBuilder(
|
||||
ModelProcessor modelProcessor,
|
||||
ModelValidator modelValidator,
|
||||
ModelNormalizer modelNormalizer,
|
||||
ModelInterpolator modelInterpolator,
|
||||
ModelPathTranslator modelPathTranslator,
|
||||
ModelUrlNormalizer modelUrlNormalizer,
|
||||
SuperPomProvider superPomProvider,
|
||||
InheritanceAssembler inheritanceAssembler,
|
||||
ProfileSelector profileSelector,
|
||||
ProfileInjector profileInjector,
|
||||
PluginManagementInjector pluginManagementInjector,
|
||||
DependencyManagementInjector dependencyManagementInjector,
|
||||
DependencyManagementImporter dependencyManagementImporter,
|
||||
@Nullable LifecycleBindingsInjector lifecycleBindingsInjector,
|
||||
PluginConfigurationExpander pluginConfigurationExpander,
|
||||
ReportConfigurationExpander reportConfigurationExpander,
|
||||
ReportingConverter reportingConverter,
|
||||
ProfileActivationFilePathInterpolator profileActivationFilePathInterpolator )
|
||||
{
|
||||
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 )
|
||||
{
|
||||
this.modelValidator = modelValidator;
|
||||
return this;
|
||||
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#setModelNormalizer(ModelNormalizer)
|
||||
*/
|
||||
@Deprecated
|
||||
public DefaultModelBuilder setModelNormalizer( ModelNormalizer modelNormalizer )
|
||||
{
|
||||
this.modelNormalizer = modelNormalizer;
|
||||
return this;
|
||||
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#setModelInterpolator(ModelInterpolator)
|
||||
*/
|
||||
@Deprecated
|
||||
public DefaultModelBuilder setModelInterpolator( ModelInterpolator modelInterpolator )
|
||||
{
|
||||
this.modelInterpolator = modelInterpolator;
|
||||
return this;
|
||||
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#set
|
||||
*/
|
||||
@Deprecated
|
||||
public DefaultModelBuilder setModelPathTranslator( ModelPathTranslator modelPathTranslator )
|
||||
{
|
||||
this.modelPathTranslator = modelPathTranslator;
|
||||
return this;
|
||||
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#setModelUrlNormalizer(ModelUrlNormalizer)
|
||||
*/
|
||||
@Deprecated
|
||||
public DefaultModelBuilder setModelUrlNormalizer( ModelUrlNormalizer modelUrlNormalizer )
|
||||
{
|
||||
this.modelUrlNormalizer = modelUrlNormalizer;
|
||||
return this;
|
||||
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#setSuperPomProvider(SuperPomProvider)
|
||||
*/
|
||||
@Deprecated
|
||||
public DefaultModelBuilder setSuperPomProvider( SuperPomProvider superPomProvider )
|
||||
{
|
||||
this.superPomProvider = superPomProvider;
|
||||
return this;
|
||||
}
|
||||
|
||||
public DefaultModelBuilder setProfileSelector( ProfileSelector profileSelector )
|
||||
{
|
||||
this.profileSelector = profileSelector;
|
||||
return this;
|
||||
}
|
||||
|
||||
public DefaultModelBuilder setProfileInjector( ProfileInjector profileInjector )
|
||||
{
|
||||
this.profileInjector = profileInjector;
|
||||
return this;
|
||||
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#setInheritanceAssembler(InheritanceAssembler)
|
||||
*/
|
||||
@Deprecated
|
||||
public DefaultModelBuilder setInheritanceAssembler( InheritanceAssembler inheritanceAssembler )
|
||||
{
|
||||
this.inheritanceAssembler = inheritanceAssembler;
|
||||
return this;
|
||||
return new DefaultModelBuilder( modelProcessor, modelValidator, modelNormalizer, modelInterpolator,
|
||||
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 this;
|
||||
return new DefaultModelBuilder( modelProcessor, modelValidator, modelNormalizer, modelInterpolator,
|
||||
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 this;
|
||||
}
|
||||
|
||||
public DefaultModelBuilder setLifecycleBindingsInjector( LifecycleBindingsInjector lifecycleBindingsInjector )
|
||||
{
|
||||
this.lifecycleBindingsInjector = lifecycleBindingsInjector;
|
||||
return this;
|
||||
}
|
||||
|
||||
public DefaultModelBuilder setPluginConfigurationExpander( PluginConfigurationExpander pluginConfigurationExpander )
|
||||
{
|
||||
this.pluginConfigurationExpander = pluginConfigurationExpander;
|
||||
return this;
|
||||
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#setPluginManagementInjector(PluginManagementInjector)
|
||||
*/
|
||||
@Deprecated
|
||||
public DefaultModelBuilder setPluginManagementInjector( PluginManagementInjector pluginManagementInjector )
|
||||
{
|
||||
this.pluginManagementInjector = pluginManagementInjector;
|
||||
return this;
|
||||
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#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 )
|
||||
{
|
||||
this.reportConfigurationExpander = reportConfigurationExpander;
|
||||
return this;
|
||||
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#setReportingConverter(ReportingConverter)
|
||||
*/
|
||||
@Deprecated
|
||||
public DefaultModelBuilder setReportingConverter( ReportingConverter reportingConverter )
|
||||
{
|
||||
this.reportingConverter = reportingConverter;
|
||||
return this;
|
||||
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#setProfileActivationFilePathInterpolator(ProfileActivationFilePathInterpolator)
|
||||
*/
|
||||
@Deprecated
|
||||
public DefaultModelBuilder setProfileActivationFilePathInterpolator(
|
||||
ProfileActivationFilePathInterpolator profileActivationFilePathInterpolator )
|
||||
{
|
||||
this.profileActivationFilePathInterpolator = profileActivationFilePathInterpolator;
|
||||
return this;
|
||||
return new DefaultModelBuilder( modelProcessor, modelValidator, modelNormalizer, modelInterpolator,
|
||||
modelPathTranslator, modelUrlNormalizer, superPomProvider, inheritanceAssembler, profileSelector,
|
||||
profileInjector, pluginManagementInjector, dependencyManagementInjector, dependencyManagementImporter,
|
||||
lifecycleBindingsInjector, pluginConfigurationExpander, reportConfigurationExpander,
|
||||
reportingConverter, profileActivationFilePathInterpolator );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -19,6 +19,8 @@ package org.apache.maven.model.building;
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
import org.apache.maven.model.Model;
|
||||
import org.apache.maven.model.composition.DefaultDependencyManagementImporter;
|
||||
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
|
||||
* 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
|
||||
* 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 Guillaume Nodet
|
||||
*/
|
||||
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()
|
||||
{
|
||||
DefaultModelProcessor processor = new DefaultModelProcessor();
|
||||
processor.setModelLocator( newModelLocator() );
|
||||
processor.setModelReader( newModelReader() );
|
||||
return processor;
|
||||
return new DefaultModelProcessor( newModelLocator(), newModelReader() );
|
||||
}
|
||||
|
||||
protected ModelLocator newModelLocator()
|
||||
|
@ -92,33 +226,23 @@ public class DefaultModelBuilderFactory
|
|||
|
||||
protected ModelReader newModelReader()
|
||||
{
|
||||
DefaultModelReader reader = new DefaultModelReader();
|
||||
reader.setTransformer( newModelSourceTransformer() );
|
||||
return reader;
|
||||
return new DefaultModelReader( newModelSourceTransformer() );
|
||||
}
|
||||
|
||||
protected ProfileSelector newProfileSelector()
|
||||
{
|
||||
DefaultProfileSelector profileSelector = new DefaultProfileSelector();
|
||||
|
||||
for ( ProfileActivator activator : newProfileActivators() )
|
||||
{
|
||||
profileSelector.addProfileActivator( activator );
|
||||
}
|
||||
|
||||
return profileSelector;
|
||||
return new DefaultProfileSelector( Arrays.asList( newProfileActivators() ) );
|
||||
}
|
||||
|
||||
protected ProfileActivator[] newProfileActivators()
|
||||
{
|
||||
return new ProfileActivator[] { new JdkVersionProfileActivator(), new OperatingSystemProfileActivator(),
|
||||
new PropertyProfileActivator(), new FileProfileActivator()
|
||||
.setProfileActivationFilePathInterpolator( newProfileActivationFilePathInterpolator() ) };
|
||||
new PropertyProfileActivator(), new FileProfileActivator( newProfileActivationFilePathInterpolator() ) };
|
||||
}
|
||||
|
||||
protected ProfileActivationFilePathInterpolator newProfileActivationFilePathInterpolator()
|
||||
{
|
||||
return new ProfileActivationFilePathInterpolator().setPathTranslator( newPathTranslator() );
|
||||
return new ProfileActivationFilePathInterpolator( newPathTranslator() );
|
||||
}
|
||||
|
||||
protected UrlNormalizer newUrlNormalizer()
|
||||
|
@ -135,7 +259,7 @@ public class DefaultModelBuilderFactory
|
|||
{
|
||||
UrlNormalizer normalizer = newUrlNormalizer();
|
||||
PathTranslator pathTranslator = newPathTranslator();
|
||||
return new StringVisitorModelInterpolator().setPathTranslator( pathTranslator ).setUrlNormalizer( normalizer );
|
||||
return new StringVisitorModelInterpolator( pathTranslator, normalizer );
|
||||
}
|
||||
|
||||
protected ModelValidator newModelValidator()
|
||||
|
@ -150,12 +274,12 @@ public class DefaultModelBuilderFactory
|
|||
|
||||
protected ModelPathTranslator newModelPathTranslator()
|
||||
{
|
||||
return new DefaultModelPathTranslator().setPathTranslator( newPathTranslator() );
|
||||
return new DefaultModelPathTranslator( newPathTranslator() );
|
||||
}
|
||||
|
||||
protected ModelUrlNormalizer newModelUrlNormalizer()
|
||||
{
|
||||
return new DefaultModelUrlNormalizer().setUrlNormalizer( newUrlNormalizer() );
|
||||
return new DefaultModelUrlNormalizer( newUrlNormalizer() );
|
||||
}
|
||||
|
||||
protected InheritanceAssembler newInheritanceAssembler()
|
||||
|
@ -170,7 +294,7 @@ public class DefaultModelBuilderFactory
|
|||
|
||||
protected SuperPomProvider newSuperPomProvider()
|
||||
{
|
||||
return new DefaultSuperPomProvider().setModelProcessor( newModelProcessor() );
|
||||
return new DefaultSuperPomProvider( newModelProcessor() );
|
||||
}
|
||||
|
||||
protected DependencyManagementImporter newDependencyManagementImporter()
|
||||
|
@ -220,28 +344,27 @@ public class DefaultModelBuilderFactory
|
|||
*/
|
||||
public DefaultModelBuilder newInstance()
|
||||
{
|
||||
DefaultModelBuilder modelBuilder = new DefaultModelBuilder();
|
||||
|
||||
modelBuilder.setModelProcessor( newModelProcessor() );
|
||||
modelBuilder.setModelValidator( newModelValidator() );
|
||||
modelBuilder.setModelNormalizer( newModelNormalizer() );
|
||||
modelBuilder.setModelPathTranslator( newModelPathTranslator() );
|
||||
modelBuilder.setModelUrlNormalizer( newModelUrlNormalizer() );
|
||||
modelBuilder.setModelInterpolator( newModelInterpolator() );
|
||||
modelBuilder.setInheritanceAssembler( newInheritanceAssembler() );
|
||||
modelBuilder.setProfileInjector( newProfileInjector() );
|
||||
modelBuilder.setProfileSelector( newProfileSelector() );
|
||||
modelBuilder.setSuperPomProvider( newSuperPomProvider() );
|
||||
modelBuilder.setDependencyManagementImporter( newDependencyManagementImporter() );
|
||||
modelBuilder.setDependencyManagementInjector( newDependencyManagementInjector() );
|
||||
modelBuilder.setLifecycleBindingsInjector( newLifecycleBindingsInjector() );
|
||||
modelBuilder.setPluginManagementInjector( newPluginManagementInjector() );
|
||||
modelBuilder.setPluginConfigurationExpander( newPluginConfigurationExpander() );
|
||||
modelBuilder.setReportConfigurationExpander( newReportConfigurationExpander() );
|
||||
modelBuilder.setReportingConverter( newReportingConverter() );
|
||||
modelBuilder.setProfileActivationFilePathInterpolator( newProfileActivationFilePathInterpolator() );
|
||||
|
||||
return modelBuilder;
|
||||
return new DefaultModelBuilder(
|
||||
modelProcessor != null ? modelProcessor : newModelProcessor(),
|
||||
modelValidator != null ? modelValidator : newModelValidator(),
|
||||
modelNormalizer != null ? modelNormalizer : newModelNormalizer(),
|
||||
modelInterpolator != null ? modelInterpolator : newModelInterpolator(),
|
||||
modelPathTranslator != null ? modelPathTranslator : newModelPathTranslator(),
|
||||
modelUrlNormalizer != null ? modelUrlNormalizer : newModelUrlNormalizer(),
|
||||
superPomProvider != null ? superPomProvider : newSuperPomProvider(),
|
||||
inheritanceAssembler != null ? inheritanceAssembler : newInheritanceAssembler(),
|
||||
profileSelector != null ? profileSelector : newProfileSelector(),
|
||||
profileInjector != null ? profileInjector : newProfileInjector(),
|
||||
pluginManagementInjector != null ? pluginManagementInjector : newPluginManagementInjector(),
|
||||
dependencyManagementInjector != null ? dependencyManagementInjector : newDependencyManagementInjector(),
|
||||
dependencyManagementImporter != null ? dependencyManagementImporter : newDependencyManagementImporter(),
|
||||
lifecycleBindingsInjector != null ? lifecycleBindingsInjector : newLifecycleBindingsInjector(),
|
||||
pluginConfigurationExpander != null ? pluginConfigurationExpander : newPluginConfigurationExpander(),
|
||||
reportConfigurationExpander != null ? reportConfigurationExpander : newReportConfigurationExpander(),
|
||||
reportingConverter != null ? reportingConverter : newReportingConverter(),
|
||||
profileActivationFilePathInterpolator != null
|
||||
? profileActivationFilePathInterpolator : newProfileActivationFilePathInterpolator()
|
||||
);
|
||||
}
|
||||
|
||||
private static class StubLifecycleBindingsInjector
|
||||
|
|
|
@ -66,22 +66,14 @@ public class DefaultModelProcessor
|
|||
implements ModelProcessor
|
||||
{
|
||||
|
||||
@Inject
|
||||
private ModelLocator locator;
|
||||
private final ModelLocator locator;
|
||||
private final ModelReader reader;
|
||||
|
||||
@Inject
|
||||
private ModelReader reader;
|
||||
|
||||
public DefaultModelProcessor setModelLocator( ModelLocator locator )
|
||||
public DefaultModelProcessor( ModelLocator locator, ModelReader reader )
|
||||
{
|
||||
this.locator = locator;
|
||||
return this;
|
||||
}
|
||||
|
||||
public DefaultModelProcessor setModelReader( ModelReader reader )
|
||||
{
|
||||
this.reader = reader;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -82,26 +82,14 @@ public abstract class AbstractStringBasedModelInterpolator
|
|||
TRANSLATED_PATH_EXPRESSIONS = translatedPrefixes;
|
||||
}
|
||||
|
||||
@Inject
|
||||
private PathTranslator pathTranslator;
|
||||
private final PathTranslator pathTranslator;
|
||||
private final UrlNormalizer urlNormalizer;
|
||||
|
||||
@Inject
|
||||
private UrlNormalizer urlNormalizer;
|
||||
|
||||
public AbstractStringBasedModelInterpolator()
|
||||
{
|
||||
}
|
||||
|
||||
public AbstractStringBasedModelInterpolator setPathTranslator( PathTranslator pathTranslator )
|
||||
public AbstractStringBasedModelInterpolator( PathTranslator pathTranslator, UrlNormalizer urlNormalizer )
|
||||
{
|
||||
this.pathTranslator = pathTranslator;
|
||||
return this;
|
||||
}
|
||||
|
||||
public AbstractStringBasedModelInterpolator setUrlNormalizer( UrlNormalizer urlNormalizer )
|
||||
{
|
||||
this.urlNormalizer = urlNormalizer;
|
||||
return this;
|
||||
}
|
||||
|
||||
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.ModelProblemCollector;
|
||||
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.InterpolationPostProcessor;
|
||||
import org.codehaus.plexus.interpolation.RecursionInterceptor;
|
||||
|
@ -46,6 +48,8 @@ import java.util.List;
|
|||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
/**
|
||||
* StringSearchModelInterpolator
|
||||
* @deprecated replaced by StringVisitorModelInterpolator (MNG-6697)
|
||||
|
@ -63,6 +67,17 @@ public class StringSearchModelInterpolator
|
|||
String interpolate( String value );
|
||||
}
|
||||
|
||||
@Inject
|
||||
public StringSearchModelInterpolator( PathTranslator pathTranslator, UrlNormalizer urlNormalizer )
|
||||
{
|
||||
super( pathTranslator, urlNormalizer );
|
||||
}
|
||||
|
||||
StringSearchModelInterpolator()
|
||||
{
|
||||
super( null, null );
|
||||
}
|
||||
|
||||
@Override
|
||||
public Model interpolateModel( Model model, File projectDir, ModelBuildingRequest config,
|
||||
ModelProblemCollector problems )
|
||||
|
|
|
@ -26,6 +26,7 @@ import java.util.ListIterator;
|
|||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Named;
|
||||
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.ModelProblemCollector;
|
||||
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.InterpolationPostProcessor;
|
||||
import org.codehaus.plexus.interpolation.RecursionInterceptor;
|
||||
|
@ -88,6 +91,11 @@ import org.codehaus.plexus.util.xml.Xpp3Dom;
|
|||
public class StringVisitorModelInterpolator
|
||||
extends AbstractStringBasedModelInterpolator
|
||||
{
|
||||
@Inject
|
||||
public StringVisitorModelInterpolator( PathTranslator pathTranslator, UrlNormalizer urlNormalizer )
|
||||
{
|
||||
super( pathTranslator, urlNormalizer );
|
||||
}
|
||||
|
||||
interface InnerInterpolator
|
||||
{
|
||||
|
|
|
@ -52,10 +52,10 @@ import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
|
|||
public class DefaultModelReader
|
||||
implements ModelReader
|
||||
{
|
||||
@Inject
|
||||
private ModelSourceTransformer transformer;
|
||||
private final ModelSourceTransformer transformer;
|
||||
|
||||
public void setTransformer( ModelSourceTransformer transformer )
|
||||
@Inject
|
||||
public DefaultModelReader( ModelSourceTransformer transformer )
|
||||
{
|
||||
this.transformer = transformer;
|
||||
}
|
||||
|
|
|
@ -44,13 +44,12 @@ public class DefaultModelPathTranslator
|
|||
implements ModelPathTranslator
|
||||
{
|
||||
|
||||
@Inject
|
||||
private PathTranslator pathTranslator;
|
||||
private final PathTranslator pathTranslator;
|
||||
|
||||
public DefaultModelPathTranslator setPathTranslator( PathTranslator pathTranslator )
|
||||
@Inject
|
||||
public DefaultModelPathTranslator( PathTranslator pathTranslator )
|
||||
{
|
||||
this.pathTranslator = pathTranslator;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -41,13 +41,12 @@ public class DefaultModelUrlNormalizer
|
|||
implements ModelUrlNormalizer
|
||||
{
|
||||
|
||||
@Inject
|
||||
private UrlNormalizer urlNormalizer;
|
||||
private final UrlNormalizer urlNormalizer;
|
||||
|
||||
public DefaultModelUrlNormalizer setUrlNormalizer( UrlNormalizer urlNormalizer )
|
||||
@Inject
|
||||
public DefaultModelUrlNormalizer( UrlNormalizer urlNormalizer )
|
||||
{
|
||||
this.urlNormalizer = urlNormalizer;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -41,13 +41,12 @@ import java.io.File;
|
|||
public class ProfileActivationFilePathInterpolator
|
||||
{
|
||||
|
||||
@Inject
|
||||
private PathTranslator pathTranslator;
|
||||
private final PathTranslator pathTranslator;
|
||||
|
||||
public ProfileActivationFilePathInterpolator setPathTranslator( PathTranslator pathTranslator )
|
||||
@Inject
|
||||
public ProfileActivationFilePathInterpolator( PathTranslator pathTranslator )
|
||||
{
|
||||
this.pathTranslator = pathTranslator;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -47,8 +47,13 @@ public class DefaultProfileSelector
|
|||
implements ProfileSelector
|
||||
{
|
||||
|
||||
private final List<ProfileActivator> activators;
|
||||
|
||||
@Inject
|
||||
private List<ProfileActivator> activators = new ArrayList<>();
|
||||
public DefaultProfileSelector( List<ProfileActivator> activators )
|
||||
{
|
||||
this.activators = activators;
|
||||
}
|
||||
|
||||
public DefaultProfileSelector addProfileActivator( ProfileActivator profileActivator )
|
||||
{
|
||||
|
|
|
@ -55,14 +55,12 @@ public class FileProfileActivator
|
|||
implements ProfileActivator
|
||||
{
|
||||
|
||||
@Inject
|
||||
private ProfileActivationFilePathInterpolator profileActivationFilePathInterpolator;
|
||||
private final ProfileActivationFilePathInterpolator profileActivationFilePathInterpolator;
|
||||
|
||||
public FileProfileActivator setProfileActivationFilePathInterpolator(
|
||||
ProfileActivationFilePathInterpolator profileActivationFilePathInterpolator )
|
||||
@Inject
|
||||
public FileProfileActivator( ProfileActivationFilePathInterpolator profileActivationFilePathInterpolator )
|
||||
{
|
||||
this.profileActivationFilePathInterpolator = profileActivationFilePathInterpolator;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -43,18 +43,17 @@ public class DefaultSuperPomProvider
|
|||
implements SuperPomProvider
|
||||
{
|
||||
|
||||
private final ModelProcessor modelProcessor;
|
||||
|
||||
/**
|
||||
* The cached super POM, lazily created.
|
||||
*/
|
||||
private Model superModel;
|
||||
|
||||
@Inject
|
||||
private ModelProcessor modelProcessor;
|
||||
|
||||
public DefaultSuperPomProvider setModelProcessor( ModelProcessor modelProcessor )
|
||||
public DefaultSuperPomProvider( ModelProcessor modelProcessor )
|
||||
{
|
||||
this.modelProcessor = modelProcessor;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -61,8 +61,7 @@ public class DefaultInheritanceAssemblerTest
|
|||
public void setUp()
|
||||
throws Exception
|
||||
{
|
||||
reader = new DefaultModelReader();
|
||||
reader.setTransformer( new AbstractModelSourceTransformer()
|
||||
reader = new DefaultModelReader( new AbstractModelSourceTransformer()
|
||||
{
|
||||
@Override
|
||||
protected AbstractSAXFilter getSAXFilter( Path pomFile, TransformerContext context,
|
||||
|
|
|
@ -23,6 +23,6 @@ public class StringVisitorModelInterpolatorTest extends AbstractModelInterpolato
|
|||
{
|
||||
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>
|
||||
{
|
||||
|
||||
private Class<T> activatorClass;
|
||||
|
||||
protected T activator;
|
||||
|
||||
public AbstractProfileActivatorTest( Class<T> activatorClass )
|
||||
{
|
||||
this.activatorClass = Objects.requireNonNull( activatorClass, "activatorClass cannot be null" );;
|
||||
}
|
||||
|
||||
@BeforeEach
|
||||
public void setUp()
|
||||
throws Exception
|
||||
{
|
||||
activator = activatorClass.getConstructor().newInstance();
|
||||
}
|
||||
abstract void setUp() throws Exception;
|
||||
|
||||
@AfterEach
|
||||
public void tearDown()
|
||||
throws Exception
|
||||
void tearDown() throws Exception
|
||||
{
|
||||
activator = null;
|
||||
}
|
||||
|
|
|
@ -48,17 +48,11 @@ public class FileProfileActivatorTest extends AbstractProfileActivatorTest<FileP
|
|||
|
||||
private final DefaultProfileActivationContext context = new DefaultProfileActivationContext();
|
||||
|
||||
public FileProfileActivatorTest()
|
||||
{
|
||||
super( FileProfileActivator.class );
|
||||
}
|
||||
|
||||
@BeforeEach
|
||||
public void setUp() throws Exception
|
||||
@Override
|
||||
void setUp() throws Exception
|
||||
{
|
||||
super.setUp();
|
||||
activator.setProfileActivationFilePathInterpolator(
|
||||
new ProfileActivationFilePathInterpolator().setPathTranslator( new DefaultPathTranslator() ) );
|
||||
activator = new FileProfileActivator( new ProfileActivationFilePathInterpolator( new DefaultPathTranslator() ) );
|
||||
|
||||
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.Profile;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
/**
|
||||
|
@ -34,12 +35,14 @@ public class JdkVersionProfileActivatorTest
|
|||
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();
|
||||
a.setJdk( jdkVersion );
|
||||
|
|
|
@ -24,6 +24,7 @@ import java.util.Properties;
|
|||
import org.apache.maven.model.Activation;
|
||||
import org.apache.maven.model.ActivationProperty;
|
||||
import org.apache.maven.model.Profile;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
/**
|
||||
|
@ -35,12 +36,14 @@ public class PropertyProfileActivatorTest
|
|||
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();
|
||||
ap.setName( key );
|
||||
|
|
|
@ -73,80 +73,35 @@ import org.slf4j.LoggerFactory;
|
|||
*/
|
||||
@Named
|
||||
@Singleton
|
||||
public class DefaultArtifactDescriptorReader
|
||||
implements ArtifactDescriptorReader
|
||||
public class DefaultArtifactDescriptorReader implements ArtifactDescriptorReader
|
||||
{
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger( DefaultArtifactDescriptorReader.class );
|
||||
|
||||
private RemoteRepositoryManager remoteRepositoryManager;
|
||||
|
||||
private VersionResolver versionResolver;
|
||||
|
||||
private VersionRangeResolver versionRangeResolver;
|
||||
|
||||
private ArtifactResolver artifactResolver;
|
||||
|
||||
private RepositoryEventDispatcher repositoryEventDispatcher;
|
||||
|
||||
private ModelBuilder modelBuilder;
|
||||
|
||||
public DefaultArtifactDescriptorReader()
|
||||
{
|
||||
// enable no-arg constructor
|
||||
}
|
||||
private final RemoteRepositoryManager remoteRepositoryManager;
|
||||
private final VersionResolver versionResolver;
|
||||
private final VersionRangeResolver versionRangeResolver;
|
||||
private final ArtifactResolver artifactResolver;
|
||||
private final RepositoryEventDispatcher repositoryEventDispatcher;
|
||||
private final ModelBuilder modelBuilder;
|
||||
|
||||
@Inject
|
||||
DefaultArtifactDescriptorReader( RemoteRepositoryManager remoteRepositoryManager, VersionResolver versionResolver,
|
||||
VersionRangeResolver versionRangeResolver, ArtifactResolver artifactResolver,
|
||||
ModelBuilder modelBuilder, RepositoryEventDispatcher repositoryEventDispatcher )
|
||||
{
|
||||
setRemoteRepositoryManager( remoteRepositoryManager );
|
||||
setVersionResolver( versionResolver );
|
||||
setVersionRangeResolver( versionRangeResolver );
|
||||
setArtifactResolver( artifactResolver );
|
||||
setModelBuilder( modelBuilder );
|
||||
setRepositoryEventDispatcher( repositoryEventDispatcher );
|
||||
}
|
||||
|
||||
public DefaultArtifactDescriptorReader setRemoteRepositoryManager( RemoteRepositoryManager remoteRepositoryManager )
|
||||
public DefaultArtifactDescriptorReader(
|
||||
RemoteRepositoryManager remoteRepositoryManager,
|
||||
VersionResolver versionResolver,
|
||||
VersionRangeResolver versionRangeResolver,
|
||||
ArtifactResolver artifactResolver,
|
||||
ModelBuilder modelBuilder,
|
||||
RepositoryEventDispatcher repositoryEventDispatcher )
|
||||
{
|
||||
this.remoteRepositoryManager = Objects.requireNonNull( remoteRepositoryManager,
|
||||
"remoteRepositoryManager cannot be null" );
|
||||
return this;
|
||||
}
|
||||
|
||||
public DefaultArtifactDescriptorReader setVersionResolver( VersionResolver versionResolver )
|
||||
{
|
||||
this.versionResolver = Objects.requireNonNull( versionResolver, "versionResolver cannot be null" );
|
||||
return this;
|
||||
}
|
||||
|
||||
/** @since 3.2.2 */
|
||||
public DefaultArtifactDescriptorReader setVersionRangeResolver( VersionRangeResolver versionRangeResolver )
|
||||
{
|
||||
this.versionRangeResolver =
|
||||
Objects.requireNonNull( versionRangeResolver, "versionRangeResolver cannot be null" );
|
||||
return this;
|
||||
}
|
||||
|
||||
public DefaultArtifactDescriptorReader setArtifactResolver( ArtifactResolver artifactResolver )
|
||||
{
|
||||
this.artifactResolver = Objects.requireNonNull( artifactResolver, "artifactResolver cannot be null" );
|
||||
return this;
|
||||
}
|
||||
|
||||
public DefaultArtifactDescriptorReader setRepositoryEventDispatcher(
|
||||
RepositoryEventDispatcher repositoryEventDispatcher )
|
||||
{
|
||||
this.modelBuilder = Objects.requireNonNull( modelBuilder, "modelBuilder cannot be null" );
|
||||
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" );
|
||||
return this;
|
||||
}
|
||||
|
||||
public ArtifactDescriptorResult readArtifactDescriptor( RepositorySystemSession session,
|
||||
|
|
|
@ -70,46 +70,19 @@ public class DefaultVersionRangeResolver
|
|||
|
||||
private static final String MAVEN_METADATA_XML = "maven-metadata.xml";
|
||||
|
||||
private MetadataResolver metadataResolver;
|
||||
|
||||
private SyncContextFactory syncContextFactory;
|
||||
|
||||
private RepositoryEventDispatcher repositoryEventDispatcher;
|
||||
|
||||
public DefaultVersionRangeResolver()
|
||||
{
|
||||
// enable default constructor
|
||||
}
|
||||
private final MetadataResolver metadataResolver;
|
||||
private final SyncContextFactory syncContextFactory;
|
||||
private final RepositoryEventDispatcher repositoryEventDispatcher;
|
||||
|
||||
@Inject
|
||||
DefaultVersionRangeResolver( MetadataResolver metadataResolver, SyncContextFactory syncContextFactory,
|
||||
public DefaultVersionRangeResolver( MetadataResolver metadataResolver, SyncContextFactory syncContextFactory,
|
||||
RepositoryEventDispatcher repositoryEventDispatcher )
|
||||
{
|
||||
setMetadataResolver( metadataResolver );
|
||||
setSyncContextFactory( syncContextFactory );
|
||||
setRepositoryEventDispatcher( repositoryEventDispatcher );
|
||||
}
|
||||
|
||||
public DefaultVersionRangeResolver setMetadataResolver( MetadataResolver metadataResolver )
|
||||
{
|
||||
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" );
|
||||
return this;
|
||||
}
|
||||
|
||||
public DefaultVersionRangeResolver setRepositoryEventDispatcher(
|
||||
RepositoryEventDispatcher repositoryEventDispatcher )
|
||||
{
|
||||
this.repositoryEventDispatcher = Objects.requireNonNull( repositoryEventDispatcher,
|
||||
"repositoryEventDispatcher cannot be null" );
|
||||
return this;
|
||||
}
|
||||
|
||||
public VersionRangeResult resolveVersionRange( RepositorySystemSession session, VersionRangeRequest request )
|
||||
throws VersionRangeResolutionException
|
||||
{
|
||||
|
|
|
@ -81,43 +81,18 @@ public class DefaultVersionResolver
|
|||
|
||||
private static final String SNAPSHOT = "SNAPSHOT";
|
||||
|
||||
private MetadataResolver metadataResolver;
|
||||
|
||||
private SyncContextFactory syncContextFactory;
|
||||
|
||||
private RepositoryEventDispatcher repositoryEventDispatcher;
|
||||
|
||||
public DefaultVersionResolver()
|
||||
{
|
||||
// enable no-arg constructor
|
||||
}
|
||||
private final MetadataResolver metadataResolver;
|
||||
private final SyncContextFactory syncContextFactory;
|
||||
private final RepositoryEventDispatcher repositoryEventDispatcher;
|
||||
|
||||
@Inject
|
||||
DefaultVersionResolver( MetadataResolver metadataResolver, SyncContextFactory syncContextFactory,
|
||||
public DefaultVersionResolver( MetadataResolver metadataResolver, SyncContextFactory syncContextFactory,
|
||||
RepositoryEventDispatcher repositoryEventDispatcher )
|
||||
{
|
||||
setMetadataResolver( metadataResolver );
|
||||
setSyncContextFactory( syncContextFactory );
|
||||
setRepositoryEventDispatcher( repositoryEventDispatcher );
|
||||
}
|
||||
|
||||
public DefaultVersionResolver setMetadataResolver( MetadataResolver metadataResolver )
|
||||
{
|
||||
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" );
|
||||
return this;
|
||||
}
|
||||
|
||||
public DefaultVersionResolver setRepositoryEventDispatcher( RepositoryEventDispatcher repositoryEventDispatcher )
|
||||
{
|
||||
this.repositoryEventDispatcher = Objects.requireNonNull( repositoryEventDispatcher,
|
||||
"repositoryEventDispatcher cannot be null" );
|
||||
return this;
|
||||
}
|
||||
|
||||
@SuppressWarnings( "checkstyle:methodlength" )
|
||||
|
|
|
@ -19,6 +19,8 @@ package org.apache.maven.repository.internal;
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
|
||||
import org.eclipse.aether.RepositoryEvent;
|
||||
import org.eclipse.aether.RepositoryEvent.EventType;
|
||||
import org.eclipse.aether.artifact.DefaultArtifact;
|
||||
|
@ -48,7 +50,9 @@ public class DefaultArtifactDescriptorReaderTest
|
|||
|
||||
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();
|
||||
|
||||
|
|
Loading…
Reference in New Issue