[ https://issues.apache.org/jira/browse/MNG-8185?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17867682#comment-17867682 ]
Ozgun OZ commented on MNG-8185: ------------------------------- Thanks for the quick reply Tamas. Just to inform that while I was searching for a solution, I have found a few StackOverflow posts of people doing this in their plugin. Not sure if those are still maintained but apparently it worked back then (before version 3.9.6) I think we should put a warning or smth on the documentation page. > Embedder's MavenCli cannot be executed from another plugin Mojo. > ----------------------------------------------------------------- > > Key: MNG-8185 > URL: https://issues.apache.org/jira/browse/MNG-8185 > Project: Maven > Issue Type: Bug > Components: Embedding > Affects Versions: 3.9.8 > Reporter: Ozgun OZ > Priority: Major > > > I am trying to run the maven-embedder from a plugin's Mojo that I develop. > I am using the mavenCli like below, > > {code:java} > MavenCli cli = new MavenCli(); > cli.doMain(new String[] {"clean","compile"}, > project.getBasedir().getAbsolutePath(), System.out, System.err); {code} > > Here are the dependencies in my pom.xml > > > {code:java} > <dependency> > <groupId>org.apache.maven</groupId> > <artifactId>maven-embedder</artifactId> > <version>3.9.8</version> > <scope>provided</scope> > </dependency> > <dependency> > <groupId>org.apache.maven</groupId> > <artifactId>maven-compat</artifactId> > <version>3.9.8</version> > <scope>provided</scope> > </dependency> > <dependency> > <groupId>org.eclipse.sisu</groupId> > <artifactId>org.eclipse.sisu.plexus</artifactId> > <version>0.3.5</version> > <scope>provided</scope> > </dependency> > <dependency> > <groupId>org.eclipse.sisu</groupId> > <artifactId>org.eclipse.sisu.inject</artifactId> > <version>0.3.5</version> > <scope>provided</scope> > </dependency> {code} > 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. > {code: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] ======================== {code} > > -- This message was sent by Atlassian Jira (v8.20.10#820010)