[ https://issues.apache.org/jira/browse/MNG-8185?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17867683#comment-17867683 ]
Ozgun OZ edited comment on MNG-8185 at 7/22/24 9:06 AM: -------------------------------------------------------- In case you have another idea how to achieve this, what I am trying to do in my plugin is to generate sources for a other plugins under development. But in order to do so, I have to compile first the sources of that plugin being developed. So my plugin is run after the maven-compiler plugin. But in order to compile the sources generated by my plugin, I have to recompile the project. Previously I was using the [https://github.com/mojo-executor/mojo-executor|https://github.com/mojo-executor/mojo-executor] but it is not maintained anymore. I can compile the generated sources myself using a Java, but for some reason it fails with sisu [https://github.com/eclipse-sisu/sisu.mojos/issues/14|https://github.com/eclipse-sisu/sisu.mojos/issues/14] It works only when I compile the whole project with maven. Now, I can of course as the client application using my plugin to setup a second execution of their maven-compiler-plugin after the execution of mine, but I would like to keep the usage of my plugin the simplest possible and make the app using it inherite this logic by the plugin directly. was (Author: ozgun): In case you have another idea how to achieve this, what I am trying to do in my plugin is to generate sources for a other plugins under development. But in order to do so, I have to compile first the sources of that plugin being developed. So my plugin is run after the maven-compiler plugin. But in order to compile the sources generated by my plugin, I have recompile the project. Previously I was using the [https://github.com/mojo-executor/mojo-executor|https://github.com/mojo-executor/mojo-executor] but it is not maintained anymore. I can compile the generated sources myself using a Java, but for some reason it fails with sisu [https://github.com/eclipse-sisu/sisu.mojos/issues/14|https://github.com/eclipse-sisu/sisu.mojos/issues/14] It works only when I compile the whole project with maven. Now, I can of course as the client application using my plugin to setup a second execution of their maven-compiler-plugin after the execution of mine, but I would like to keep the usage of my plugin the simplest possible and make the app using it inherite this logic by the plugin directly. > 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)