You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by GitBox <gi...@apache.org> on 2023/01/04 14:55:21 UTC

[GitHub] [maven] laeubi opened a new pull request, #948: MNG-7662 - Allow Graphbuilder to use session scoped components

laeubi opened a new pull request, #948:
URL: https://github.com/apache/maven/pull/948

   Following this checklist to help us incorporate your
   contribution quickly and easily:
   
    - [x] Make sure there is a [JIRA issue](https://issues.apache.org/jira/browse/MNG-7662) filed
          for the change (usually before you start working on it).  Trivial changes like typos do not
          require a JIRA issue. Your pull request should address just this issue, without
          pulling in other changes.
    - [x] Each commit in the pull request should have a meaningful subject line and body.
    - [x] Format the pull request title like `[MNG-XXX] SUMMARY`,
          where you replace `MNG-XXX` and `SUMMARY` with the appropriate JIRA issue.
    - [x] Also format the first line of the commit message like `[MNG-XXX] SUMMARY`.
          Best practice is to use the JIRA issue title in both the pull request title and in the first line of the commit message.
    - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
    - [x] Run `mvn clean verify` to make sure basic checks pass. A more thorough check will
          be performed on your pull request automatically.
    - [ ] You have run the [Core IT][core-its] successfully.
   
   If your pull request is about ~20 lines of code you don't need to sign an
   [Individual Contributor License Agreement](https://www.apache.org/licenses/icla.pdf) if you are unsure
   please ask on the developers list.
   
   To make clear that you license your contribution under
   the [Apache License Version 2.0, January 2004](http://www.apache.org/licenses/LICENSE-2.0)
   you have to acknowledge this by using the following check-box.
   
    - [x] I hereby declare this contribution to be licenced under the [Apache License Version 2.0, January 2004](http://www.apache.org/licenses/LICENSE-2.0)
   
    - [ ] In any other case, please file an [Apache Individual Contributor License Agreement](https://www.apache.org/licenses/icla.pdf).
   
   [core-its]: https://maven.apache.org/core-its/core-it-suite/
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [maven] laeubi commented on pull request #948: MNG-7662 - Allow Graphbuilder to use session scoped components

Posted by GitBox <gi...@apache.org>.
laeubi commented on PR #948:
URL: https://github.com/apache/maven/pull/948#issuecomment-1371842124

   @gnodet if you have an idea how to rewrite `DefaultMaven` that way it would be fine I think, I just don't know if it is possible as `DefaultMaven` is "special" in the way how it setup the session/scopes as part of the execute .... I think actually all references in `DefaultMaven` should probably be lazy until first access but wanted to keep this focused to the minimum...


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [maven] laeubi commented on pull request #948: MNG-7662 - Allow Graphbuilder to use session scoped components

Posted by GitBox <gi...@apache.org>.
laeubi commented on PR #948:
URL: https://github.com/apache/maven/pull/948#issuecomment-1371283602

   @michael-o can you probably take a look?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [maven] gnodet commented on pull request #948: [MNG-7662] Allow Graphbuilder to use session scoped components

Posted by "gnodet (via GitHub)" <gi...@apache.org>.
gnodet commented on PR #948:
URL: https://github.com/apache/maven/pull/948#issuecomment-1403326872

   > @gnodet I would be fine with a better solution, will #950 be included in Maven 3.9.0?
   
   If someone has the time to investigate and finalise the PR, I assume it could, though I'd rather target it for 4.x.  I'm not planning to work on it in the short term though.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [maven] laeubi commented on pull request #948: MNG-7662 - Allow Graphbuilder to use session scoped components

Posted by GitBox <gi...@apache.org>.
laeubi commented on PR #948:
URL: https://github.com/apache/maven/pull/948#issuecomment-1371290310

   > Um, this looks wrong to me.... I guess this is to have injected some components that are session scoped?
   
   Yes as described in the JIRA ticket
   
   > But why not use `Provider<X>` for components that are session scoped instead, as that will throw anyway if invoked out of session....
   
   Mostly because consumers should not need to know how the component is implemented, beside this I never got `Provider<X>` working (Maven 3.8.x) the build always complains something can not be injected. But maybe DefaultMavenComponent should all be `Provider<X>` ones so this do not conflict with implementation details?
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [maven] laeubi commented on pull request #948: MNG-7662 - Allow Graphbuilder to use session scoped components

Posted by GitBox <gi...@apache.org>.
laeubi commented on PR #948:
URL: https://github.com/apache/maven/pull/948#issuecomment-1371875965

   > Fwiw, I've just tested the injection of `javax.inject.Provider<GraphBuilder>` on master and it seems to work well...
   
   Do you like to submit a PR for this? This seems to be the easiest solution I think for now.... If it also works for 3.9.x I would be fine for this to be packported instead of my suggestion.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [maven] gnodet commented on pull request #948: MNG-7662 - Allow Graphbuilder to use session scoped components

Posted by GitBox <gi...@apache.org>.
gnodet commented on PR #948:
URL: https://github.com/apache/maven/pull/948#issuecomment-1372252880

   Also, there is an existing workaround which I think I've used somewhere, but I can't recall where exactly.
   The idea is to define two beans:
   ```
   @Named
   @Singleton
   class MyLazyGraphBuilder implements GraphBuilder {
       @Inject
       private final PlexusContainer container;
       private GraphBuilder delegate() {
          return container.lookup(GraphBuilder.class, "myGraphBuilder");
       }
       Result<? extends ProjectDependencyGraph> build(MavenSession session) {
           return delegate().build(session);
       }
   }
   
   @Named("myGraphBuilder")
   @SessionScoped
   class MyGraphBuilder implements GraphBuilder {
       ...
   }
   ```
   
   I still think this should be done automatically, but not sure I'll have the time to dig much into sisu/guice...
   
   It may be preferable to use the workaround which will work on any maven version imho.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [maven] laeubi commented on pull request #948: [MNG-7662] Allow Graphbuilder to use session scoped components

Posted by "laeubi (via GitHub)" <gi...@apache.org>.
laeubi commented on PR #948:
URL: https://github.com/apache/maven/pull/948#issuecomment-1403320132

   @gnodet I would be fine with a better solution, will #950 be included in Maven 3.9.0?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [MNG-7662] Allow Graphbuilder to use session scoped components [maven]

Posted by "gnodet (via GitHub)" <gi...@apache.org>.
gnodet closed pull request #948: [MNG-7662] Allow Graphbuilder to use session scoped components
URL: https://github.com/apache/maven/pull/948


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [maven] gnodet commented on pull request #948: MNG-7662 - Allow Graphbuilder to use session scoped components

Posted by GitBox <gi...@apache.org>.
gnodet commented on PR #948:
URL: https://github.com/apache/maven/pull/948#issuecomment-1371873677

   > > Um, this looks wrong to me.... I guess this is to have injected some components that are session scoped?
   > 
   > Yes as described in the JIRA ticket
   > 
   > > But why not use `Provider<X>` for components that are session scoped instead, as that will throw anyway if invoked out of session....
   > 
   > Mostly because consumers should not need to know how the component is implemented, beside this I never got `Provider<X>` working (Maven 3.8.x) the build always complains something can not be injected. But maybe DefaultMavenComponent should all be `Provider<X>` ones so this do not conflict with implementation details?
   > 
   > I tried for example:
   > 
   > ```
   > @Requirement( hint = GraphBuilder.HINT )
   > private Provider<GraphBuilder> graphBuilder;
   > ```
   > 
   > but the build fails with obscure errors...
   
   Fwiw, I've just tested the injection of `javax.inject.Provider<GraphBuilder>` on master and it seems to work well...


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [MNG-7662] Allow Graphbuilder to use session scoped components [maven]

Posted by "gnodet (via GitHub)" <gi...@apache.org>.
gnodet commented on PR #948:
URL: https://github.com/apache/maven/pull/948#issuecomment-1801675320

   Superseded by #950 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [maven] laeubi commented on pull request #948: MNG-7662 - Allow Graphbuilder to use session scoped components

Posted by GitBox <gi...@apache.org>.
laeubi commented on PR #948:
URL: https://github.com/apache/maven/pull/948#issuecomment-1372300641

   > Also, there is an existing workaround which I think I've used somewhere, but I can't recall where exactly.
   
   This seems simlar to my aproach here, jsut that I more liek to fix it in maven itself than in my beans :-)
   
   > I still think this should be done automatically, but not sure I'll have the time to dig much into sisu/guice...
   
   maybe but I must confess that lazy lookup here seems easier ...
   
   > It may be preferable to use the workaround which will work on any maven version imho.
   
   I already have some workarounds, bt my goal i to get it fixed instead of running into the same issues again afterwards.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [maven] gnodet commented on pull request #948: MNG-7662 - Allow Graphbuilder to use session scoped components

Posted by GitBox <gi...@apache.org>.
gnodet commented on PR #948:
URL: https://github.com/apache/maven/pull/948#issuecomment-1373699754

   > > Also, there is an existing workaround which I think I've used somewhere, but I can't recall where exactly.
   > 
   > This seems simlar to my aproach here, jsut that I more liek to fix it in maven itself than in my beans :-)
   > 
   > > I still think this should be done automatically, but not sure I'll have the time to dig much into sisu/guice...
   > 
   > maybe but I must confess that lazy lookup here seems easier ...
   > 
   > > It may be preferable to use the workaround which will work on any maven version imho.
   > 
   > I already have some workarounds, bt my goal i to get it fixed instead of running into the same issues again afterwards.
   
   I think the [`SessionScoped`](https://github.com/apache/maven/blob/master/maven-core/src/main/java/org/apache/maven/session/scope/internal/SessionScope.java) class (and execution scope) could be a good candidate to implement transparent proxying.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [maven] gnodet commented on pull request #948: MNG-7662 - Allow Graphbuilder to use session scoped components

Posted by GitBox <gi...@apache.org>.
gnodet commented on PR #948:
URL: https://github.com/apache/maven/pull/948#issuecomment-1376836725

   > > > Also, there is an existing workaround which I think I've used somewhere, but I can't recall where exactly.
   > > 
   > > 
   > > This seems simlar to my aproach here, jsut that I more liek to fix it in maven itself than in my beans :-)
   > > > I still think this should be done automatically, but not sure I'll have the time to dig much into sisu/guice...
   > > 
   > > 
   > > maybe but I must confess that lazy lookup here seems easier ...
   > > > It may be preferable to use the workaround which will work on any maven version imho.
   > > 
   > > 
   > > I already have some workarounds, bt my goal i to get it fixed instead of running into the same issues again afterwards.
   > 
   > I think the [`SessionScoped`](https://github.com/apache/maven/blob/master/maven-core/src/main/java/org/apache/maven/session/scope/internal/SessionScope.java) class (and execution scope) could be a good candidate to implement transparent proxying.
   
   See #950 @laeubi 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [maven] gnodet commented on pull request #948: MNG-7662 - Allow Graphbuilder to use session scoped components

Posted by GitBox <gi...@apache.org>.
gnodet commented on PR #948:
URL: https://github.com/apache/maven/pull/948#issuecomment-1371831631

   Would it be possible to have scopes behave in a usual CDI way ? I.e. you should be able to inject a `@SessionScoped` bean into a `@Singleton` and the DI framework should wrap it in a proxy and fail _at use time_ if the bean is used outside of the session, but not at injection time.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [maven] cstamas commented on pull request #948: MNG-7662 - Allow Graphbuilder to use session scoped components

Posted by GitBox <gi...@apache.org>.
cstamas commented on PR #948:
URL: https://github.com/apache/maven/pull/948#issuecomment-1371286830

   Um, this looks wrong to me.... I guess this is to have injected some components that are session scoped? But why not use `Provider<X>` for components that are session scoped instead, as that will throw anyway if invoked out of session....


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org