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

ASF GitHub Bot commented on MNG-8134:
-------------------------------------

gnodet commented on PR #1559:
URL: https://github.com/apache/maven/pull/1559#issuecomment-2158446053

   > I'd shamefully copy a new `DependencySet` wrapper idea to avoid to have to 
inject a map or a list which are rarely what is needed so a think wrapper 
enabling to lookup what is needed (with filter + default collectors support).
   > 
   > That said I don't know if we need an injection or just this wrapper being 
accessible from the project - I have a few cases where the scope is configured 
in the mojo so the injection can need an expression to work (+-0 to make it 
working or just rely on v4 project).
   
   If you want the wrapper, you can inject the `DependencyResolverResult` class 
from the API which provides everything.  The other ones are just to simplify 
for simple use cases. 
   
   For the expression, I thought about it, but I'm not sure that's easily 
feasible, nor worth it.  The API is quite easily usable, it would just save two 
lines:
   ```
           PathScope ps = 
session.getService(PathScopeRegistry.class).require(pathScope);
           DependencyResolverResult res = 
session.getService(DependencyResolver.class).resolve(session, project, ps);
   ```
   and the benefit of having it statically defined (so that we can compute 
exactly what is needed in advance) would be lost.
   Another possibility would be for the mojo to define multiple resolutions:
   ```
       @Resolution(pathScope = "main-compile")
       Map<PathType, List<Path>> compilePaths;
   
       @Resolution(pathScope = "main-test")
       Map<PathType, List<Path>> testPaths;
   ```
   




> Provide an annotation that can be used to inject dependencies 
> resolution/collection in mojos
> --------------------------------------------------------------------------------------------
>
>                 Key: MNG-8134
>                 URL: https://issues.apache.org/jira/browse/MNG-8134
>             Project: Maven
>          Issue Type: Task
>            Reporter: Guillaume Nodet
>            Priority: Major
>             Fix For: 4.0.0
>
>
> See 
> https://github.com/apache/maven-plugin-tools/pull/286#discussion_r1620871349



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to