apache / apache/maven

[MNG-8185] Embedder's MavenCli cannot be executed from another plugin Mojo.

Open
#10,454 4 comments 0 reactions 0 assignees View on GitHub
bug priority:major
Dominant language
Java
Stars
5.3k
Forks
3.1k
Avg merge
20h 42m
Merged PRs (30d)
297

Description

**[Ozgun OZ](https://issues.apache.org/jira/secure/ViewProfile.jspa?name=ozgun)** opened **[MNG-8185](https://issues.apache.org/jira/browse/MNG-8185?redirect=false)** and commented

 

I am trying to run the maven-embedder from a plugin's Mojo that I develop.

I am using the mavenCli like below,

 

```java
MavenCli cli = new MavenCli();
cli.doMain(new String[] {"clean","compile"}, project.getBasedir().getAbsolutePath(), System.out, System.err);
```

 

Here are the dependencies in my pom.xml

 

 

```java

org.apache.maven
maven-embedder
3.9.8
provided

org.apache.maven
maven-compat
3.9.8
provided

org.eclipse.sisu
org.eclipse.sisu.plexus
0.3.5
provided

org.eclipse.sisu
org.eclipse.sisu.inject
0.3.5
provided

```

The full source code of the plugin can be found here:

https://github.com/HomeOfTheWizard/spring-bridge-maven-plugin/tree/feature/embedder-for-compilation

 

When using this plugin in another maven plugin project,

I have the following error.

```java
[INFO] [ERROR] Error executing Maven.
[INFO] [ERROR] Unable to create injector, see the following errors:
[INFO] 
[INFO] 1) [Guice/ScopeNotFound]: No scope is bound to SessionScoped.
[INFO] 
[INFO] Used at:
[INFO] 1  : ReactorReader.class(ReactorReader.java:63)
[INFO]      at ClassRealm[plexus.core, parent: null]
[INFO]       \_ installed by: WireModule -> PlexusBindingModule
[INFO] 
[INFO] Learn more:
[INFO]   https://github.com/google/guice/wiki/SCOPE_NOT_FOUND
[INFO] 
[INFO] 1 error
[INFO] 
[INFO] ======================
[INFO] Full classname legend:
[INFO] ======================
[INFO] PlexusBindingModule: "org.eclipse.sisu.plexus.PlexusBindingModule"
[INFO] ReactorReader:       "org.apache.maven.ReactorReader"
[INFO] SessionScoped:       "org.apache.maven.SessionScoped"
[INFO] WireModule:          "org.eclipse.sisu.wire.WireModule"
[INFO] ========================
[INFO] End of classname legend:
[INFO] ========================
```

 

 

---

**Affects:** 3.9.8

Contributor guide

Open the contributing guide

Research direction

Start with the plugin source linked in the issue and reproduce the MavenCli invocation from another plugin Mojo using Maven 3.9.8. Read the injector failure around SessionScoped and ReactorReader, then trace the provided maven-embedder, maven-compat, and Sisu dependencies. Done means the embedded clean compile runs without the injector error.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
build-system
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.