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;
   ```
   


-- 
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-unsubscr...@maven.apache.org

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

Reply via email to