[MNG-7391] Fix MojosExecutionStrategy lookup to be able to look into the SessionScope (#693)

This commit is contained in:
Guillaume Nodet 2022-03-15 06:56:07 +01:00 committed by GitHub
parent 7c79e634ce
commit 31193cbf0c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 4 deletions

View File

@ -35,6 +35,7 @@ import java.util.concurrent.locks.ReentrantReadWriteLock;
import javax.inject.Inject;
import javax.inject.Named;
import javax.inject.Provider;
import javax.inject.Singleton;
import org.apache.maven.artifact.Artifact;
@ -82,7 +83,7 @@ public class MojoExecutor
private final ReadWriteLock aggregatorLock = new ReentrantReadWriteLock();
private final MojosExecutionStrategy mojosExecutionStrategy;
private final Provider<MojosExecutionStrategy> mojosExecutionStrategy;
@Inject
public MojoExecutor(
@ -90,7 +91,7 @@ public class MojoExecutor
MavenPluginManager mavenPluginManager,
LifecycleDependencyResolver lifeCycleDependencyResolver,
ExecutionEventCatapult eventCatapult,
MojosExecutionStrategy mojosExecutionStrategy )
Provider<MojosExecutionStrategy> mojosExecutionStrategy )
{
this.pluginManager = pluginManager;
this.mavenPluginManager = mavenPluginManager;
@ -164,7 +165,7 @@ public class MojoExecutor
final PhaseRecorder phaseRecorder = new PhaseRecorder( session.getCurrentProject() );
mojosExecutionStrategy.execute( mojoExecutions, session, new MojoExecutionRunner()
mojosExecutionStrategy.get().execute( mojoExecutions, session, new MojoExecutionRunner()
{
@Override
public void run( MojoExecution mojoExecution ) throws LifecycleExecutionException

View File

@ -15,6 +15,8 @@
package org.apache.maven.lifecycle.internal.stub;
import javax.inject.Provider;
import org.apache.maven.execution.MavenSession;
import org.apache.maven.lifecycle.LifecycleExecutionException;
import org.apache.maven.lifecycle.internal.DependencyContext;
@ -49,7 +51,7 @@ public class MojoExecutorStub
MavenPluginManager mavenPluginManager,
LifecycleDependencyResolver lifeCycleDependencyResolver,
ExecutionEventCatapult eventCatapult,
MojosExecutionStrategy mojosExecutionStrategy )
Provider<MojosExecutionStrategy> mojosExecutionStrategy )
{
super( pluginManager, mavenPluginManager, lifeCycleDependencyResolver, eventCatapult, mojosExecutionStrategy );
}