Support Maven <exclusions> syntax within target <dependency> elements#2170
Support Maven <exclusions> syntax within target <dependency> elements#2170vogella wants to merge 1 commit into
Conversation
Test Results 336 files ± 0 336 suites ±0 1h 11m 59s ⏱️ + 1m 29s For more details on these failures and errors, see this check. Results for commit bd2e9b0. ± Comparison against base commit 98b66b5. ♻️ This comment has been updated with latest results. |
|
I'm missing UI integration for this feature through the target location editor and the dependency tree. Additionally we already have a way to exclude dependencies, so one would expect this code path to be enhanced instead of adding a complete new codepath. |
Once the base support is integrated I can also provide the UI integration.
I check |
21c6ca4 to
bd2e9b0
Compare
|
The bad thing with re-using the same logic: Exclusions behave globally (the same as ) once an artifact is excluded by any dependency's , it's excluded from the whole target location. Let me know if you really prefer this, I think we should better follow the standard Maven logic (and maybe retire the other global exclude logic at some point). |
Please include it here in the first place, the UI is the most important part for people to discover such functionality.
Would it not be quite confusing if one exclude dependency
m2e only follows the xml structure to make it easy to copy things from pom to target (via the clipboard) but the logic already works quite differently compared to maven. So we should more think what makes most sense here.
The general way in the past was to read old formats and transform them to the new format after saving (what also proves that a new feature is actually a super-set of the older one). So at best this would be possible here as well, what makes me lean more towards a location specific |
Can do, once you give your go for the core implementation, I can extend the UI functionality.
So the new global logic is ok? Anything else in the core structure which should be changed? If not, I can start working on the UI. |
There is an (old) open issue about that and I think the general direction is sound - but only UI integration will show how well it works out. We later will need to have similar change for Tycho but this is a second step then.
Currently the exclusion is per As mentioned the ultimate proof would be if you can transform a target using the old exclusion definition into the new more flexible form so people do not need to manually adjust their targets. |
|
I think a migration would not work correctly, we have global entries which now should move to one entry in the list. Which one? First? Last? Any? |
Please see what was written above: I don't think individual exclusions are useful - e.g. what would be the use-case for an individual exclusion? We can use the same maven syntax but should retain the exclusion to be still per target location. If there is an immediate benefit we might want to allow adding things at both places. In any case even for your current proposal the equivalent would be to add them to each individual entry consequently. |
Yes, we already agreed on this. We can use the same maven syntax but should retain the exclusion to be still per target location. If there is an immediate benefit we might want to allow adding things at both places. So the migration would be to move it to one of the entries? |
I don't understand what you mean by |
Example for entries: |
So how does this match to what you have written above:
So taking your example and transform it into a while target block would give (ignoring the fact that it sounds odd to exclude a version just to include it then in the other item) so what I proposed here (and what would be 1:1 mappable to the previous concept) For bnd instructions we even allow to specify global item and local item (that in this case then might be merged for the individual entries: |
I believe there are cases where it makes sense to exclude versions and include other ones, e.g. when one simply wants to override the version of a transitive dependency. Since Maven targets don't override dependencies like default Maven that can be wanted. Furthermore, does excluding one artifact also excludes its (transitive) dependencies, if nothing else requires them? |
Sure but not the same version what is done in the example. |
Closes #286
The m2-pde target location now accepts the standard Maven
<exclusions>/<exclusion>syntax inside each<dependency>element, in addition to the existing location-level<exclude>elements.Exclusions are per-dependency (not global) and are applied during transitive dependency collection via
MavenDependencyCollector, consistent with standard Maven semantics. The*wildcard is supported for groupId and artifactId. The format round-trips correctly throughserialize()/parse.