Skip to content
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

[MASSEMBLY-1008] Fix transitive dependencies resolving with required scope #166

Merged
merged 5 commits into from
Jan 30, 2024

Conversation

cstamas
Copy link
Member

@cstamas cstamas commented Nov 15, 2023

This IT demonstrates how assembly plugin (among others) does it wrongly, as the plugin code probably originates from Maven2 times.

What happens:

  • "single" mojo resolves test project dependencies (see Mojo annotations)
  • then it reads assembly descriptor (so it only learns now what user wants)
  • then uses resolved project dependencies to deliver descriptor contents

But, here is a problem that IT demonstrates: the delivered list of files are NOT runtime scoped, they are "test scope filtered for runtime leaves" which is not the same thing. By the way, dependency plugin demonstrates same behavior: wrongly assumes that "test" graph is super set of "runtime" tree, but that is not true nor was never true since Maven3 (resolver), it was true ONLY in Maven2 times.

The proper runtime graph of IT project as shown by resolver is this:

prompt> graph test:massembly-1008:jar:1
[INFO] Collecting test:massembly-1008:jar:1
[INFO] 
[INFO] test:massembly-1008:jar:1
[INFO] \- com.google.inject:guice:jar:6.0.0 [compile]
[INFO]    +- javax.inject:javax.inject:jar:1 [compile]
[INFO]    +- jakarta.inject:jakarta.inject-api:jar:2.0.1 [compile]
[INFO]    +- aopalliance:aopalliance:jar:1.0 [compile]
[INFO]    \- com.google.guava:guava:jar:31.0.1-jre [compile]
[INFO]       +- com.google.guava:failureaccess:jar:1.0.1 [compile]
[INFO]       +- com.google.guava:listenablefuture:jar:9999.0-empty-to-avoid-conflict-with-guava [compile]
[INFO]       +- com.google.code.findbugs:jsr305:jar:3.0.2 [compile]
[INFO]       +- org.checkerframework:checker-qual:jar:3.12.0 [compile]
[INFO]       +- com.google.errorprone:error_prone_annotations:jar:2.7.1 [compile]
[INFO]       \- com.google.j2objc:j2objc-annotations:jar:1.3 [compile]
prompt> 

@cstamas cstamas self-assigned this Nov 15, 2023
pom.xml Outdated Show resolved Hide resolved
cstamas and others added 3 commits December 25, 2023 13:12
This IT demonstrates how assembly plugin (among others)
does wrongly, the code probably originates from Maven2
times.

What happens:
* "single" mojo resolves test project dependencies
* then it reads assembly descriptor
* then uses project dependencies to deliver descriptor contents

But, here is a problem that IT demonstrates: the delivered list
of files are NOT runtime scoped, they are "test scope filtered
for runtime leaves" which is not the same thing. By the way,
dependency plugin demonstrates same behaviour, wrongly assumes
that "test" graph is larger "runtime" tree, but that is not true
nor was never true since Maven3 (resolver), it was true ONLY in
Maven2 times.
@slawekjaranowski slawekjaranowski changed the title [MASSEMBLY-1008] Wrong use of dependency scopes [MASSEMBLY-1008] Fix transitive dependencies resolving with required scope Dec 27, 2023
@slawekjaranowski
Copy link
Member

@cstamas please look - build pass

@slawekjaranowski slawekjaranowski self-assigned this Dec 27, 2023
@slawekjaranowski
Copy link
Member

@cstamas - kindly reminder

@cstamas
Copy link
Member Author

cstamas commented Jan 8, 2024

LGTM (cannot approve as I opened this PR 😄 )

@slawekjaranowski slawekjaranowski merged commit 36ebace into master Jan 30, 2024
44 checks passed
@slawekjaranowski slawekjaranowski deleted the massembly-1008 branch January 30, 2024 19:46
@cstamas
Copy link
Member Author

cstamas commented Jan 30, 2024

🎆

@cstamas
Copy link
Member Author

cstamas commented Jan 30, 2024

Thanks @slawekjaranowski , jotted down several 🍻 for you once we meet

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants