You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Jose Montoya (Jira)" <ji...@apache.org> on 2019/08/19 16:02:00 UTC

[jira] [Comment Edited] (MNG-6739) JSR 330 not picking up Guice Custom Bindings

    [ https://issues.apache.org/jira/browse/MNG-6739?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16910507#comment-16910507 ] 

Jose Montoya edited comment on MNG-6739 at 8/19/19 4:01 PM:
------------------------------------------------------------

A little more debug suggests that the issue is that {{org.eclipse.sisu.space.SpaceScanner#accept(org.eclipse.sisu.space.SpaceVisitor)}} fails when accepting the class because down the call stack {{org.eclipse.sisu.space.URLClassSpace#loadClass}} throws a {{TypeNotPresentException}} when trying to load {{com.google.inject.AbstractModule}}

I thiiink that's because of 

{noformat}
[DEBUG] Importing foreign packages into class realm plugin>com.jam01.test:printer-maven-plugin:1.0-SNAPSHOT
[DEBUG]   Imported:  < maven.api
[DEBUG] Populating class realm plugin>com.jam01.test:printer-maven-plugin:1.0-SNAPSHOT
[DEBUG]   Included: com.jam01.test:printer-maven-plugin:jar:1.0-SNAPSHOT
[DEBUG]   Included: org.codehaus.plexus:plexus-utils:jar:1.1
[DEBUG] Configuring mojo com.jam01.test:printer-maven-plugin:1.0-SNAPSHOT:print from plugin realm ClassRealm[plugin>com.jam01.test:printer-maven-plugin:1.0-SNAPSHOT, parent: sun.misc.Launcher$AppClassLoader@7852e922]
{noformat}

What I'm getting out of that message is that {{DefaultRealmManager}}(?) is not including the Guice libraries...?



was (Author: jam01):
A little more debug suggests that the issue is that when org.eclipse.sisu.space.SpaceScanner#accept(org.eclipse.sisu.space.SpaceVisitor) fails when accepting the class because down the call stack org.eclipse.sisu.space.URLClassSpace#loadClass throws a TypeNotPresentException when trying to load com.google.inject.AbstractModule.

I thiiink that's because of 
```
[DEBUG] Importing foreign packages into class realm plugin>com.jam01.test:printer-maven-plugin:1.0-SNAPSHOT
[DEBUG]   Imported:  < maven.api
[DEBUG] Populating class realm plugin>com.jam01.test:printer-maven-plugin:1.0-SNAPSHOT
[DEBUG]   Included: com.jam01.test:printer-maven-plugin:jar:1.0-SNAPSHOT
[DEBUG]   Included: org.codehaus.plexus:plexus-utils:jar:1.1
[DEBUG] Configuring mojo com.jam01.test:printer-maven-plugin:1.0-SNAPSHOT:print from plugin realm ClassRealm[plugin>com.jam01.test:printer-maven-plugin:1.0-SNAPSHOT, parent: sun.misc.Launcher$AppClassLoader@7852e922]
```

What I'm getting out of that message is that DefaultRealmManager(?) is not including the Guice libraries...?

> JSR 330 not picking up Guice Custom Bindings
> --------------------------------------------
>
>                 Key: MNG-6739
>                 URL: https://issues.apache.org/jira/browse/MNG-6739
>             Project: Maven
>          Issue Type: Bug
>          Components: Plugins and Lifecycle
>    Affects Versions: 3.6.0
>            Reporter: Jose Montoya
>            Priority: Major
>
> See: [https://maven.apache.org/maven-jsr330.html] and [https://wiki.eclipse.org/Sisu/PlexusMigration]
> These docs state that Guice Modules annotated with `@Named` will be loaded and configured automatically by Sisu. I think the actual loading is done by `org.eclipse.sisu.space.QualifiedTypeBinder` but it only seems to work when running tests via the `maven-plugin-testing-harness` and not when actually running the plugin.
> I've tried to add various different artifacts to compilation including `sisu.inject`, `sisu.inject.extender` and `plexus-container-default` but cannot get the Modules to be loaded, and consequently the Mojo fails to instantiate with com.google.inject.ProvisionException: Unable to provision.
> I'm working on a simple project to reproduce, I'll update the ticket with a link to it. If I can provide more information, or if I'm just missing something simple please let me know. Thanks
> EDIT: Here's the repo [https://github.com/jam01/maven-plugin-jsr330-issue]
>  ```
>  mvn clean install
>  mvn com.jam01.test:printer-maven-plugin:print
>  ```



--
This message was sent by Atlassian Jira
(v8.3.2#803003)