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

This PR makes Shrinkwrap be buildable with latest Maven4 #375

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

cstamas
Copy link
Contributor

@cstamas cstamas commented Dec 21, 2024

Also fixes the shrinkwrap maven-plugin that exploded in Maven4.

Build with

[cstamas@angeleyes resolver (make-it-build-with-maven4)]$ mvn -v
Apache Maven 4.0.0-rc-3-SNAPSHOT (575ad3719c79b061c78d531ec9d29793f159c2ec)
Maven home: /home/cstamas/Tools/maven/apache-maven-4.0.0-rc-3-SNAPSHOT
Java version: 21.0.5, vendor: Eclipse Adoptium, runtime: /home/cstamas/.sdkman/candidates/java/21.0.5-tem
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "6.12.5-200.fc41.x86_64", arch: "amd64", family: "unix"
[cstamas@angeleyes resolver (make-it-build-with-maven4)]$ 

Results:

[INFO] --------------------------------------------------------------------------------------------------------------------------
[INFO] Reactor Summary for ShrinkWrap Resolver Aggregator 3.3.4-SNAPSHOT:
[INFO] 
[INFO] ShrinkWrap Resolver Bill of Materials ................................................................ SUCCESS [  0.162 s]
[INFO] ShrinkWrap Resolver Aggregator ....................................................................... SUCCESS [  1.113 s]
[INFO] Shrinkwrap Resolver Build Resources .................................................................. SUCCESS [  0.264 s]
[INFO] ShrinkWrap Resolver API .............................................................................. SUCCESS [  1.319 s]
[INFO] ShrinkWrap Resolver SPI .............................................................................. SUCCESS [  1.017 s]
[INFO] ShrinkWrap Resolver Maven API ........................................................................ SUCCESS [  2.421 s]
[INFO] ShrinkWrap Resolver Maven SPI ........................................................................ SUCCESS [  0.624 s]
[INFO] ShrinkWrap Resolver Maven Archive API ................................................................ SUCCESS [  0.714 s]
[INFO] ShrinkWrap Resolver Maven Implementation ............................................................. SUCCESS [ 37.225 s]
[INFO] ShrinkWrap Resolver Maven Archive SPI ................................................................ SUCCESS [  0.667 s]
[INFO] ShrinkWrap Resolver Maven Archive Implementation ..................................................... SUCCESS [ 11.159 s]
[INFO] ShrinkWrap Resolver Embedded Maven API ............................................................... SUCCESS [  0.998 s]
[INFO] ShrinkWrap Resolver Embedded Maven Implementation .................................................... SUCCESS [ 56.377 s]
[INFO] ShrinkWrap Resolver Dependency Chain ................................................................. SUCCESS [  0.038 s]
[INFO] ShrinkWrap Resolver Maven Plugin ..................................................................... SUCCESS [ 19.579 s]
[INFO] ShrinkWrap Resolver Gradle Impl ...................................................................... SUCCESS [01:28 min]
[INFO] ShrinkWrap Resolver Embedded Gradle Archive API ...................................................... SUCCESS [  0.547 s]
[INFO] ShrinkWrap Resolver Embedded Gradle Archive Implementation ........................................... SUCCESS [  4.976 s]
[INFO] ShrinkWrap Resolver Gradle Dependency Chain .......................................................... SUCCESS [  0.057 s]
[INFO] --------------------------------------------------------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] --------------------------------------------------------------------------------------------------------------------------
[INFO] Total time:  03:48 min
[INFO] Finished at: 2024-12-21T21:00:18+01:00
[INFO] --------------------------------------------------------------------------------------------------------------------------
[cstamas@angeleyes resolver (make-it-build-with-maven4)]$

Also fixes the shrinkwrap maven-plugin that exploded in
Maven4.
@lprimak
Copy link
Contributor

lprimak commented Dec 21, 2024

Strong -1.
This removes ability to run tests from subdirectories.
This also breaks compatibility with Maven 4 alphas and betas before beta-3 for any build

@cstamas
Copy link
Contributor Author

cstamas commented Dec 21, 2024

Shrinkwrap was not buildable with Maven4 at all, and after fixing resolver, the maven-plugin ITs exploded as well. This fixes all of that, now it can be built with Maven4. Since Shrinkwrap is a Maven3 project (is built against Maven3 APIs not Maven4 APIs) it still works "as with Maven3". This part is unchanged.

@lprimak
Copy link
Contributor

lprimak commented Dec 21, 2024

The point is to use new features that maven 4 provides, not necessarily make it buildable with maven 4
When Maven 4 is released, and mima is compatible with it, then the maven 4 APIs can be used to replace the current functionality, not before.

Also, all the new features are behind feature flags and can be disabled if necessary by the users.

Copy link
Contributor

@lprimak lprimak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These changes need to be deferred until Mima is available in maven 4 and thus reactor subprojects can be tested without install

@cstamas
Copy link
Contributor Author

cstamas commented Dec 22, 2024

The point is to use new features that maven 4 provides, not necessarily make it buildable with maven 4 When Maven 4 is released, and mima is compatible with it, then the maven 4 APIs can be used to replace the current functionality, not before

The code dropped here was a hack violating all the Maven principles and was not "using new Maven4 features at all", it was going for its internals, and it makes this code fragile and just bad. Again, Shrinkwrap is a Maven3 lib (just like MIMA the bridge is), and there is no place for "tricks" to reach (in very bad way) for Maven4 internals at all. It works with Maven3 and it works with Maven4 in very same way (as Maven4 offers Maven3 backward compatibility). Running a Maven3 codebase with Maven4 as runtime will not "magically" make the codebase Maven4 codebase.

@lprimak
Copy link
Contributor

lprimak commented Dec 22, 2024

It's a hack in the same way sun.misc.Unsafe is a hack. It's a way to get the needed functionality done. Just like with Unsafe, when the needed functionality is provided by the Maven team, then the switch could be made.
Until then, the direct filesystem usage is the only way to go, just like Unsafe is today.

You have a different view on this, as a maven developer, I understand that.
However, from the users' perspective, the main advantage of maven 4 is the ability to run modules independently of project root. Major feature that's been missing in ShrinkWrap is ability to run tests in sub-projects
Maven 4 enables this, and pretty much is the only advantage that ShrinkWrap can make use of.
It's a great enhancer of developer experience, and literally saved jus me, hours of work / waiting.

Trying to remove a major feature because it's "not to your liking" is just silly, especially when I asked,
6 months ago, and was told from the beginning it was OK do it this way.

@petrberan
Copy link
Member

Hi @cstamas @lprimak

First of all, thank you both for looking into this, happy to see this project being noticed. Unfortunately I've returned from PTO to go on another, so I'll take a better look at this issue in ~2 weeks.

I'll try to provide some insight into Resolver at the current state in the meantime. With Maven 4 happening it is a good opportunity to finally move this project from JDK 8 to JDK 17, which I would love to do once I'm back from PTO and my time allows me to commit more to Shrinkwrap once again. Before that happens, changes in Resolver were to support new Maven 4 features provided they don't break backward compatibility.

Once I'm back I'll finally rename this branch to main and create new maintenance 3.x branch for supporting Maven 3, with main supporting Maven 4. Hope this somewhat brought some light into the current state what to expect from next development

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.

3 participants