You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
My issue may not be an issue on the plugin, but in my usage of it.
I am developping a plugin that uses JSR330 annotations.
During the "Compile" phase of maven lifecycle, I am generating at runtime some javax.inject.Provider classes that are tagged with @Named JSR330 annotations and storing them in the classpath.
Here is the decompiled class
package com.homeofthewizard;
import com.homeofthewizard.hellolib.MyFriend;
import javax.inject.Inject;
import javax.inject.Named;
import javax.inject.Provider;
@Named
public class MyFriendProvider implements Provider<MyFriend> {
public MyFriend get() {
return new MyFriend();
}
}
During Package phase, the sisu-maven plugin takes them into account when indexing. I checked the file generated and all seems ok.
But when I execute my plugin, the classes are not found, and the providers are not injected by sisu.
Here is my mojo:
package com.homeofthewizard;
import com.homeofthewizard.hellolib.MyFriend;
import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugins.annotations.Mojo;
import org.codehaus.plexus.logging.Logger;
import javax.inject.Inject;
@Mojo( name = "sayhi")
public class MyMojo extends AbstractMojo
{
private final Logger logger;
private final MyFriend helloer;
@Inject
public MyMojo(Logger logger, MyFriend helloer) {
this.logger = logger;
this.helloer = helloer;
}
public void execute()
{
logger.info("executing mojo");
helloer.hello();
}
}
Here is the error:
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.486 s
[INFO] Finished at: 2023-07-14T17:44:47+02:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.homeofthewizard:spring-bridge-demo-maven-plugin:1.0-SNAPSHOT:sayhi (default-cli) on project spring-bridge-demo-maven-plugin: Execution default-cli of goal com.homeofthewizard:spring-bridge-demo-maven-plugin:1.0-SNAPSHOT:sayhi failed: Unable to load the mojo 'sayhi' (or one of its required components) from the plugin 'com.homeofthewizard:spring-bridge-demo-maven-plugin:1.0-SNAPSHOT': com.google.inject.ProvisionException: Unable to provision, see the following errors:
[ERROR]
[ERROR] 1) null returned by binding at org.eclipse.sisu.wire.LocatorWiring
[ERROR] but the 2th parameter of com.homeofthewizard.MyMojo.<init>(Unknown Source) is not @Nullable
[ERROR] at org.eclipse.sisu.wire.LocatorWiring
[ERROR] while locating com.homeofthewizard.hellolib.MyFriend
[ERROR] for the 2th parameter of com.homeofthewizard.MyMojo.<init>(Unknown Source)
[ERROR] while locating com.homeofthewizard.MyMojo
[ERROR] at ClassRealm[plugin>com.homeofthewizard:spring-bridge-demo-maven-plugin:1.0-SNAPSHOT, parent: jdk.internal.loader.ClassLoaders$AppClassLoader@512ddf17] (via modules: org.eclipse.sisu.wire.WireModule -> org.eclipse.sisu.plexus.PlexusBindingModule)
[ERROR] while locating org.apache.maven.plugin.Mojo annotated with @com.google.inject.name.Named(value="com.homeofthewizard:spring-bridge-demo-maven-plugin:1.0-SNAPSHOT:sayhi")
[ERROR]
[ERROR] 1 error
[ERROR] role: org.apache.maven.plugin.Mojo
[ERROR] roleHint: com.homeofthewizard:spring-bridge-demo-maven-plugin:1.0-SNAPSHOT:sayhi
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginContainerException
Process finished with exit code 1
I am using maven 3.9.1
Java 11 as source and bytecode.
Am I missing something here ? Can you please help me pinpoint the issue ? 🙏
The text was updated successfully, but these errors were encountered:
Hi,
My issue may not be an issue on the plugin, but in my usage of it.
I am developping a plugin that uses JSR330 annotations.
During the "Compile" phase of maven lifecycle, I am generating at runtime some
javax.inject.Provider
classes that are tagged with@Named
JSR330 annotations and storing them in the classpath.Here is the decompiled class
During
Package
phase, the sisu-maven plugin takes them into account when indexing. I checked the file generated and all seems ok.But when I execute my plugin, the classes are not found, and the providers are not injected by sisu.
Here is my mojo:
Here is the error:
I am using maven 3.9.1
Java 11 as source and bytecode.
Am I missing something here ? Can you please help me pinpoint the issue ? 🙏
The text was updated successfully, but these errors were encountered: