You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by gn...@apache.org on 2022/03/15 05:56:00 UTC
[maven] branch maven-3.9.x updated: [MNG-7391] Fix MojosExecutionStrategy lookup to be able to look into the SessionScope (#692)
This is an automated email from the ASF dual-hosted git repository.
gnodet pushed a commit to branch maven-3.9.x
in repository https://gitbox.apache.org/repos/asf/maven.git
The following commit(s) were added to refs/heads/maven-3.9.x by this push:
new 3a5a40c [MNG-7391] Fix MojosExecutionStrategy lookup to be able to look into the SessionScope (#692)
3a5a40c is described below
commit 3a5a40c6d23bc4af7ab7945eaac0fa689d2c6143
Author: Guillaume Nodet <gn...@gmail.com>
AuthorDate: Tue Mar 15 06:55:50 2022 +0100
[MNG-7391] Fix MojosExecutionStrategy lookup to be able to look into the SessionScope (#692)
---
.../org/apache/maven/lifecycle/internal/MojoExecutor.java | 15 +++++++++++++--
1 file changed, 13 insertions(+), 2 deletions(-)
diff --git a/maven-core/src/main/java/org/apache/maven/lifecycle/internal/MojoExecutor.java b/maven-core/src/main/java/org/apache/maven/lifecycle/internal/MojoExecutor.java
index f81c713..2980e88 100644
--- a/maven-core/src/main/java/org/apache/maven/lifecycle/internal/MojoExecutor.java
+++ b/maven-core/src/main/java/org/apache/maven/lifecycle/internal/MojoExecutor.java
@@ -38,8 +38,10 @@ import org.apache.maven.plugin.PluginIncompatibleException;
import org.apache.maven.plugin.PluginManagerException;
import org.apache.maven.plugin.descriptor.MojoDescriptor;
import org.apache.maven.project.MavenProject;
+import org.codehaus.plexus.PlexusContainer;
import org.codehaus.plexus.component.annotations.Component;
import org.codehaus.plexus.component.annotations.Requirement;
+import org.codehaus.plexus.component.repository.exception.ComponentLookupException;
import org.codehaus.plexus.util.StringUtils;
import org.eclipse.aether.SessionData;
@@ -88,7 +90,7 @@ public class MojoExecutor
private final ReadWriteLock aggregatorLock = new ReentrantReadWriteLock();
@Requirement
- private MojosExecutionStrategy mojosExecutionStrategy;
+ private PlexusContainer container;
public MojoExecutor()
{
@@ -159,7 +161,16 @@ public class MojoExecutor
final PhaseRecorder phaseRecorder = new PhaseRecorder( session.getCurrentProject() );
- mojosExecutionStrategy.execute( mojoExecutions, session, new MojoExecutionRunner()
+ MojosExecutionStrategy strategy;
+ try
+ {
+ strategy = container.lookup( MojosExecutionStrategy.class );
+ }
+ catch ( ComponentLookupException e )
+ {
+ throw new IllegalStateException( "Unable to lookup MojosExecutionStrategy", e );
+ }
+ strategy.execute( mojoExecutions, session, new MojoExecutionRunner()
{
@Override
public void run( MojoExecution mojoExecution ) throws LifecycleExecutionException