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

[MNG-7260] [MNG-7266] Remove maven-compat module #552

Closed
wants to merge 5 commits into from

Conversation

gnodet
Copy link
Contributor

@gnodet gnodet commented Sep 23, 2021

Following this checklist to help us incorporate your
contribution quickly and easily:

  • Make sure there is a JIRA issue filed
    for the change (usually before you start working on it). Trivial changes like typos do not
    require a JIRA issue. Your pull request should address just this issue, without
    pulling in other changes.
  • Each commit in the pull request should have a meaningful subject line and body.
  • Format the pull request title like [MNG-XXX] - Fixes bug in ApproximateQuantiles,
    where you replace MNG-XXX with the appropriate JIRA issue. Best practice
    is to use the JIRA issue title in the pull request title and in the first line of the
    commit message.
  • Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
  • Run mvn clean verify to make sure basic checks pass. A more thorough check will
    be performed on your pull request automatically.
  • You have run the Core IT successfully.

If your pull request is about ~20 lines of code you don't need to sign an
Individual Contributor License Agreement if you are unsure
please ask on the developers list.

To make clear that you license your contribution under
the Apache License Version 2.0, January 2004
you have to acknowledge this by using the following check-box.

@cstamas
Copy link
Member

cstamas commented Sep 23, 2021

Wow, massive! 31k LOC gone 😄

@gnodet gnodet mentioned this pull request Sep 24, 2021
@cstamas
Copy link
Member

cstamas commented Sep 24, 2021

Well, for a moment I was questioning my own sanity, but figured ("how does this pass" was bonging in my head). Well, you removed the module maven-compat, but you left the dependencies on it, that are coming back into build either from CI local repo or from remote RAO snapshots repo? Unsure, but one thing is certain: I did try this "at home" (remove maven-compat from build) and maven build should fail 😄

So, this is not so simple, as there are things to be reimplemented AFAIR...

@gnodet
Copy link
Contributor Author

gnodet commented Sep 24, 2021

@cstamas I've removed the remaining references. The build still passes and my local repo does not contain any trace of this module (so not downloaded). Let's see what the IT tests results are...

@cstamas
Copy link
Member

cstamas commented Sep 24, 2021

Hm, I did try removing maven-compat several months ago locally (just to see), and it was not simple back then. I might miss some more recent commits since it seems...

@rfscholte
Copy link
Contributor

Copy link
Member

@michael-o michael-o left a comment

Choose a reason for hiding this comment

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

Almost all Core ITs fail for me. Compat cannot be simply deleted w/o replacing parts used by Core.

@cstamas
Copy link
Member

cstamas commented Sep 25, 2021

Almost all Core ITs fail for me. Compat cannot be simply deleted w/o replacing parts used by Core.

One remark: maven-compat removes maven2 compatibility, hence, if any of IT uses "plugin from maven2" (think install/deploy 2.x), they will fail, no? So to say, ITs should be upgraded to use 3.x line of plugins globally (as otherwise IT is about "Maven2 support in Maven3", no?) And hence, to be able to do that, we must tackle install/deploy (and any other plugin not at 3.x version)... as install/deploy 3.x have issues with maven-plugin metadata AFAIR, so I bet 2.x of those are generally used.

@rfscholte
Copy link
Contributor

@MartinKanters and @mthmulders made a start with the 3.x implementation for these plugins.
You could also say: Maven ITs shouldn't test the logic of plugins. For most we have a mock implementation that just says: plugin x goal y executed. Could we rewrite the ITs so they don't need these plugins?

@gnodet
Copy link
Contributor Author

gnodet commented Sep 27, 2021

The first problem hit by the integration tests is that the only implementation of org.apache.maven.repository.RepositorySystem is currently in maven-compat. I've just pushed an additional commit to get rid of it.

@rfscholte
Copy link
Contributor

I wonder if the deleted files should be removed or moved to a new maven-compat3 module. I wouldn't be suprised if maven-plugins out these depend on one of these classes.

@gnodet
Copy link
Contributor Author

gnodet commented Sep 27, 2021

I wonder if the deleted files should be removed or moved to a new maven-compat3 module. I wouldn't be suprised if maven-plugins out these depend on one of these classes.

Right. I'll get back to that once I found out why the tests fail on linux/windows and not on osx...

@cstamas
Copy link
Member

cstamas commented Sep 27, 2021

I wonder if the deleted files should be removed or moved to a new maven-compat3 module. I wouldn't be suprised if maven-plugins out these depend on one of these classes.

But isn't that an indicator of our "slackness" then? Maven3 is out for 8 years and we still have (in house) plugins depending on Maven2 stuff?

@gnodet
Copy link
Contributor Author

gnodet commented Sep 27, 2021

But isn't that an indicator of our "slackness" then? Maven3 is out for 8 years and we still have (in house) plugins depending on Maven2 stuff?

Well, I think @rfscholte refers to my last commit which removes the RepositorySystem interface which had not been deprecated (no idea why). I can bring it back with no implementation (I had to move a few constants that were used in maven-core from that class to the MavenRepositorySystem), but I have no idea if this class is used outside of maven-core for now.

@cstamas
Copy link
Member

cstamas commented Sep 27, 2021

Well, I think @rfscholte refers to my last commit which removes the RepositorySystem interface which had not been deprecated (no idea why). I can bring it back with no implementation (I had to move a few constants that were used in maven-core from that class to the MavenRepositorySystem), but I have no idea if this class is used outside of maven-core for now.

In my "attempt" (to drop maven-compat) I did keep RepositorySystem as it is part of maven-core, and provided implementation for it in package org.apache.maven.bridge next to MavenRepositorySystem and reworked the two to share a LOT of common code/component.... (will try to dig up my "attempt" -- am talking from my memory only, so take this with a pinch of salt)

@mthmulders
Copy link
Contributor

@MartinKanters and @mthmulders made a start with the 3.x implementation for these plugins.

That's right. It has been lingering a bit but I was actually planning to start working on it this Wednesday. The goal is (as per this JIRA comment to move the existing "install / deploy" logic into Core, implementing it on top of Maven Resolver API. The M-I-P and M-D-P will leverage that, but they will still need a fallback (implemented with Eclipse Aether) so they are compatible with Maven 3.1 and above.

@gnodet gnodet marked this pull request as draft September 29, 2021 08:18
@gnodet
Copy link
Contributor Author

gnodet commented Sep 29, 2021

I'm having a hard time trying to understand why maven-compat is deprecated if it contains the only implementation of the RepositorySystem interface which is not deprecated. Most of the methods in this interface have been replicated in MavenRepositorySystem, but even the latest surefire uses one of the method that has no equivalent...

@rfscholte
Copy link
Contributor

IIRC @jvanzyl moved it, so maybe he remembers it. (this is also the reason why adding @deprecated is so so so important)

@cstamas
Copy link
Member

cstamas commented Sep 29, 2021

IMHO, the RepositorySystem and MavenRepositorySystem are (meant) to be the same thing (but one is v2/3 other is v3+). When I attempted to drop maven-compat, these are high level changes I went with:

  1. moved the implementation of RepositorySystem to maven-core next to MavenRepositorySystem (started reworking it w/o compat bits)
  2. refactored MavenRepositorySystem into interface and added Impl of it (a lot of static methods 😢 AFAIR).
  3. tried to have as much shared code between the two as possible, so basically I had not two but 6 or more "shared" components around these two (but as "private detail", w/o exposed ifaces and really just to share logic)
  4. lost that work on some of my laptops I wrote off (or reinstalled).... but can lend a hand a bit later on this

@gnodet
Copy link
Contributor Author

gnodet commented Sep 29, 2021

IMHO, the RepositorySystem and MavenRepositorySystem are (meant) to be the same thing (but one is v2/3 other is v3+). When I attempted to drop maven-compat, these are high level changes I went with:

  1. moved the implementation of RepositorySystem to maven-core next to MavenRepositorySystem (started reworking it w/o compat bits)
  2. refactored MavenRepositorySystem into interface and added Impl of it (a lot of static methods 😢 AFAIR).
  3. tried to have as much shared code between the two as possible, so basically I had not two but 6 or more "shared" components around these two (but as "private detail", w/o exposed ifaces and really just to share logic)
  4. lost that work on some of my laptops I wrote off (or reinstalled).... but can lend a hand a bit later on this

I went to a slightly different direction. However, I'm hitting a problem. Some integration tests fail with NoClassDefFoundError for RepositorySystemSession. The reason is that the plugin realm for org.apache.maven.plugins:maven-plugin-plugin:maven-plugin:3.6.0 contains maven-compat-3.0.jar. The classes from that jar are usually hidden by the version coming from the maven distribution, however, since I removed it, they seem to surface and cause the exception. However, I'm not sure why the RepositorySystemSession isn't available. Is it maybe not considered part of the API and hence hidden ? Maybe that was working because the bean was previously loaded from the maven-compat jar coming from the same realm...

@gnodet
Copy link
Contributor Author

gnodet commented Sep 30, 2021

The ArtifactDeployer and ArtifactInstaller, ArtifactCollector, ArtifactResolver interfaces contains various methods used in https://github.com/apache/maven-integration-testing/blob/master/core-it-support/core-it-plugins/maven-it-plugin-artifact/src/main/java/org/apache/maven/plugin/coreit and thus cause some failures in the ITs. Should I bring it back somehow or should I fix the testing plugins ? or get rid of the tests that do use indirectly those old interfaces ?

@gnodet gnodet closed this Jan 12, 2022
@michael-o
Copy link
Member

The ArtifactDeployer and ArtifactInstaller, ArtifactCollector, ArtifactResolver interfaces contains various methods used in https://github.com/apache/maven-integration-testing/blob/master/core-it-support/core-it-plugins/maven-it-plugin-artifact/src/main/java/org/apache/maven/plugin/coreit and thus cause some failures in the ITs. Should I bring it back somehow or should I fix the testing plugins ? or get rid of the tests that do use indirectly those old interfaces ?

It needs to be evaluated whether those ITs are for Maven 2, or 2. If 2 only, we need to discuss whether to remove them. If 3+ we likely need to migrate them.

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