-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[MNG-8134] Add a @Resolution annotation to mojos to inject project dependencies collection / resolution result #1559
Conversation
Can a mojo have 2 or more fields annotated like this? |
Yes, the mojo descriptor contains a |
This then opens interesting possibilities for Mojos... |
5377f97
to
d6857d7
Compare
The v4api IT in apache/maven-plugin-tools#295 adds a field with the |
I'd shamefully copy a new 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 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:
and the benefit of having it statically defined (so that we can compute exactly what is needed in advance) would be lost.
|
f43d279
to
4f4e42d
Compare
9bb6f67
to
ea215b7
Compare
…pendencies collection / resolution result
I'm not sure I get it, this should be 1-1 with the programmatic flavor IMHO so either it is cached in the impl and it is always computed in advanced somehow - or there is no pitfall computing it lazily more exactly - or it will be wrong if computed in advanced and a mojo modifies the current scope for next mojo 🤔 I assume - but not sure at all - you speak about adding more concurrency or something like that but I'm not sure we can do it more than the resolution requested by the mojo itself - which needs to move to a list of custom string I guess now. |
The fact that we statically know that a given mojo execution will require the project dependencies will be helpful if we can implement the fully concurrent lifecycle. My goal would be to have a builder which goes down to the phase or mojo level : all mojos executions should be able to run concurrently and ordered according to the actual dependencies specified between projects. My assumption is that "Project A depends on Project B" has no direct impact on the build order. It only has an effect if a mojo execution actually requires the dependencies of project A. This is currently not really needed, because we build a given project completely before building another one. |
@gnodet ok, if we mix it with the binding/phase - execution has it - later it will work, 👍, thanks. |
When injecting into a field, we can use a single |
JIRA issue: https://issues.apache.org/jira/browse/MNG-8134
The apache/maven-plugin-tools#295 PR updates m-plugin-p to generate the correct descriptor and modifies the v4 IT to make sure this new annotation works correctly.
In short, a mojo could be defined as:
and the mojo would be injected with the resolved dependencies for the
main-compile
path scope.