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

[EXPERIMENT] Expose depMgr to use with Maven #1000

Closed

Conversation

cstamas
Copy link
Member

@cstamas cstamas commented Feb 16, 2023

We have 3 of them, but we use always "classic" that behaves like Maven2 (with all it's shortocomings!).

Changes:

  • change default depMgr Maven uses from "classic" to "default"
  • expose config for all 3 of them

This is just an experiment for issues like:

Adds -Dmaven.resolver.dependencyManager param with accepted values "classic" (the default every Maven3 used so far), "default" and "transitive".

Values are:

  • "classic" (default in all Maven 3.x releases so far) org.eclipse.aether.util.graph.manager.ClassicDependencyManager
  • "default" (never used) org.eclipse.aether.util.graph.manager.DefaultDependencyManager
  • "transitive" (never used) org.eclipse.aether.util.graph.manager.TransitiveDependencyManager

Reproducer output with 3 of them:

[cstamas@urnebes usage]$ mvn dependency:tree -Dmaven.resolver.dependencyManager=transitive
[INFO] Scanning for projects...
[INFO] 
[INFO] ---------------------< arcomp.maven_example:usage >---------------------
[INFO] Building usage 1
[INFO]   from pom.xml
[INFO] --------------------------------[ jar ]---------------------------------
[INFO] 
[INFO] --- dependency:2.8:tree (default-cli) @ usage ---
[INFO] arcomp.maven_example:usage:jar:1
[INFO] \- arcomp.maven_example:module:jar:1:compile
[INFO]    \- org.apache.logging.log4j:log4j-slf4j18-impl:jar:2.13.3:compile
[INFO]       +- org.slf4j:slf4j-api:jar:1.7.30:compile
[INFO]       +- org.apache.logging.log4j:log4j-api:jar:2.13.3:compile
[INFO]       \- org.apache.logging.log4j:log4j-core:jar:2.13.3:runtime
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  0.764 s
[INFO] Finished at: 2023-02-16T12:58:22+01:00
[INFO] ------------------------------------------------------------------------
[cstamas@urnebes usage]$ mvn dependency:tree -Dmaven.resolver.dependencyManager=default
[INFO] Scanning for projects...
[INFO] 
[INFO] ---------------------< arcomp.maven_example:usage >---------------------
[INFO] Building usage 1
[INFO]   from pom.xml
[INFO] --------------------------------[ jar ]---------------------------------
[INFO] 
[INFO] --- dependency:2.8:tree (default-cli) @ usage ---
[INFO] arcomp.maven_example:usage:jar:1
[INFO] \- arcomp.maven_example:module:jar:1:compile
[INFO]    \- org.apache.logging.log4j:log4j-slf4j18-impl:jar:2.13.3:compile
[INFO]       +- org.slf4j:slf4j-api:jar:1.7.30:compile
[INFO]       +- org.apache.logging.log4j:log4j-api:jar:2.13.3:compile
[INFO]       \- org.apache.logging.log4j:log4j-core:jar:2.13.3:runtime
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  0.643 s
[INFO] Finished at: 2023-02-16T12:58:27+01:00
[INFO] ------------------------------------------------------------------------
[cstamas@urnebes usage]$ mvn dependency:tree -Dmaven.resolver.dependencyManager=classic
[INFO] Scanning for projects...
[INFO] 
[INFO] ---------------------< arcomp.maven_example:usage >---------------------
[INFO] Building usage 1
[INFO]   from pom.xml
[INFO] --------------------------------[ jar ]---------------------------------
[INFO] 
[INFO] --- dependency:2.8:tree (default-cli) @ usage ---
[INFO] arcomp.maven_example:usage:jar:1
[INFO] \- arcomp.maven_example:module:jar:1:compile
[INFO]    \- org.apache.logging.log4j:log4j-slf4j18-impl:jar:2.13.3:compile
[INFO]       +- org.slf4j:slf4j-api:jar:1.8.0-beta4:compile                  <!-- BAD
[INFO]       +- org.apache.logging.log4j:log4j-api:jar:2.13.3:compile
[INFO]       \- org.apache.logging.log4j:log4j-core:jar:2.13.3:runtime
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  0.671 s
[INFO] Finished at: 2023-02-16T12:58:32+01:00
[INFO] ------------------------------------------------------------------------
[cstamas@urnebes usage]$ mvn dependency:tree                       <---- this PR changes to "transitive"
[INFO] Scanning for projects...
[INFO] 
[INFO] ---------------------< arcomp.maven_example:usage >---------------------
[INFO] Building usage 1
[INFO]   from pom.xml
[INFO] --------------------------------[ jar ]---------------------------------
[INFO] 
[INFO] --- dependency:2.8:tree (default-cli) @ usage ---
[INFO] arcomp.maven_example:usage:jar:1
[INFO] \- arcomp.maven_example:module:jar:1:compile
[INFO]    \- org.apache.logging.log4j:log4j-slf4j18-impl:jar:2.13.3:compile
[INFO]       +- org.slf4j:slf4j-api:jar:1.7.30:compile
[INFO]       +- org.apache.logging.log4j:log4j-api:jar:2.13.3:compile
[INFO]       \- org.apache.logging.log4j:log4j-core:jar:2.13.3:runtime
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  0.662 s
[INFO] Finished at: 2023-02-16T12:58:39+01:00
[INFO] ------------------------------------------------------------------------
[cstamas@urnebes usage]$ 

We have 3 of them, but we use always "classic" that behaves
like Maven2 (with all it's shortocomings!).
@cstamas
Copy link
Member Author

cstamas commented Feb 16, 2023

locally ran Maven 3.9.x w/PR in IT suite with different depMgrs as default:
"default":

[ERROR] Failures: 
[ERROR]   MavenIT0011DefaultVersionByDependencyManagementTest.testit0011:61->AbstractMavenIntegrationTestCase.assertTrue:693 [org.apache.maven.its.it0011:a:jar:0.1] ==> expected: <true> but was: <false>
[ERROR]   MavenITmng4720DependencyManagementExclusionMergeTest.testit:74->AbstractMavenIntegrationTestCase.assertTrue:693 [classes, a-0.1.jar, c-0.1.jar] ==> expected: <true> but was: <false>
[ERROR] Errors: 
[ERROR]   MavenIT0199CyclicImportScopeTest.testit0199:43->build:54 » Verification Exit code was non-zero: 1; command line and log = 
[ERROR]   MavenITmng3259DepsDroppedInMultiModuleBuildTest.testitMNG3259:66 » Verification Exit code was non-zero: 1; command line and log =
[INFO] 
[ERROR] Tests run: 885, Failures: 2, Errors: 2, Skipped: 80

Errors are compilation errors in ITs, hence this depMgr did not do everything as expected.

"transitive":

[ERROR] Failures: 
[ERROR]   MavenITmng4720DependencyManagementExclusionMergeTest.testit:74->AbstractMavenIntegrationTestCase.assertTrue:693 [classes, a-0.1.jar, c-0.1.jar] ==> expected: <true> but was: <false>
[INFO] 
[ERROR] Tests run: 885, Failures: 1, Errors: 0, Skipped: 80

This IT for issue https://issues.apache.org/jira/browse/MNG-4720 tests exactly was issue https://issues.apache.org/jira/browse/MNG-7003 is about (and is Maven2 way, differently resolves project and dependencies).

@cstamas
Copy link
Member Author

cstamas commented Jan 8, 2024

Superseded by #1357

@cstamas cstamas closed this Jan 8, 2024
@cstamas cstamas deleted the maven-3.9.x-experiment-depMgr branch January 8, 2024 11:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant