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

Plugin uses Maven 2 API, requires still outdated Maven 3.0.0-API and will break in Maven 4 (soon to be released) #1651

Closed
7 of 10 tasks
bmarwell opened this issue Mar 23, 2023 · 12 comments
Assignees

Comments

@bmarwell
Copy link
Contributor

bmarwell commented Mar 23, 2023

Warning when building with Maven 3.9.1:

[WARNING] Parameter 'artifactRepository' is deprecated core expression; Avoid use of ArtifactRepository type. If you need access to local repository, switch to '${repositorySystemSession}' expression and get LRM from it instead.

${repositorySystemSession} is available with Maven 3.2.5, which is the minimum needed version for the other maven plugins anyway.

  • Remove outdated maven 2 api from org.codehaus (basicPluginSupport)
  • Remove use of ArtifactRepository
  • Use at least maven 3.2.5
  • Sync all maven versions. Currently requirement is set to 3.0.0, API used is 2.0, Maven imported is 3.8.6, annotations is even yet another version!
  • Add tests with maven 4-Alpha versions (extend the build matrix)
  • Define a default value for runtimeVersion, so build doesn't just break without parameters.
  • set maven-core scope to provided
  • replace @Component(role = AntHelper.class) AntHelper ant in AbstractLibertySupport
  • make ...Support classes abstract. The will inherit from AbstractMojo but will not have an executable goal on their own.
  • replace AntHelper
bmarwell added a commit to bmarwell/ci.maven that referenced this issue Mar 23, 2023
@bmarwell bmarwell changed the title [DEPRECATION] [WARNING] Parameter 'artifactRepository' is deprecated core expression; Avoid use of ArtifactRepository type. If you need access to local repository, switch to '${repositorySystemSession}' expression and get LRM from it instead. Plugin uses Maven 2 API, requires still outdated Maven 3.0.0-API and will break in Maven 4 (soon to be released) Mar 24, 2023
bmarwell added a commit to bmarwell/ci.maven that referenced this issue Mar 24, 2023
bmarwell added a commit to bmarwell/ci.maven that referenced this issue Mar 24, 2023
bmarwell added a commit to bmarwell/ci.maven that referenced this issue Mar 24, 2023
bmarwell added a commit to bmarwell/ci.maven that referenced this issue Mar 24, 2023
bmarwell added a commit to bmarwell/ci.maven that referenced this issue Mar 24, 2023
bmarwell added a commit to bmarwell/ci.maven that referenced this issue Mar 24, 2023
bmarwell added a commit to bmarwell/ci.maven that referenced this issue Mar 24, 2023
bmarwell added a commit to bmarwell/ci.maven that referenced this issue Mar 28, 2023
@cherylking
Copy link
Member

@bmarwell Do all org.codehaus packages need to be removed? If so, what is the replacement for org.codehaus.plexus:plexus-utils?

@cherylking cherylking self-assigned this Apr 19, 2023
@gnodet
Copy link

gnodet commented Apr 19, 2023

@bmarwell Do all org.codehaus packages need to be removed? If so, what is the replacement for org.codehaus.plexus:plexus-utils?

plexus-utils can be used. However, some helper methods can be better replaced with JDK methods.

@bmarwell
Copy link
Contributor Author

bmarwell commented May 3, 2023

Here's some more information about the compatibility matrix: https://gist.github.com/cstamas/b0605a9fad09de4adcbd4444888baa4c

This plugin will already not work with the Maven 4 pre-releaes.

@bmarwell
Copy link
Contributor Author

bmarwell commented May 3, 2023

Related commit in another plugin for reference: policeman-tools/forbidden-apis#230

@cherylking
Copy link
Member

@bmarwell Can you help point out what further changes I need to make for this plugin to be compatible with Maven 4 considering the changes I already merged in PRs #1662 and #1663 ?

@bmarwell
Copy link
Contributor Author

bmarwell commented May 3, 2023

Haven't seen you previous commits. Will look into them later! Thanks for working on it!

@cherylking
Copy link
Member

Haven't seen you previous commits. Will look into them later! Thanks for working on it!

I could also produce a snapshot for you to try if that would be helpful. Let me know.

@bmarwell
Copy link
Contributor Author

bmarwell commented May 5, 2023

Yes, I'd love to test that!

@cherylking
Copy link
Member

@bmarwell There is a 3.8-SNAPSHOT published to Sonatype. Please give it a try and let me know of any problems you have with it. TIA

@bmarwell
Copy link
Contributor Author

bmarwell commented May 5, 2023

Hey!

So, I tested 3.8-SNAPSHOT (not 3.8.0-SNAPSHOT btw?) with maven 3.9.1 and 4.0.0-alpha5.

Both work fine now. The error is gone:
[WARNING] Parameter 'artifactRepository' is deprecated core expression; Avoid use of ArtifactRepository type. If you need access to local repository, switch to '${repositorySystemSession}' expression and get LRM from it instead.

Btw: The nice thing about maven 4 is that you can just run liberty:dev on just a single reactor module. Consider https://github.com/bmarwell/diceroll-prepare (not publicly until now, I am using this to prepare a talk).
Until now you had to run mvn liberty:dev -pl rest -am (and it will compile everything along the way). That is, if you don't use mvn install, which you should not in most projects, of course.
Now with maven 4 you can just run: mvn liberty:dev -pl rest and it will figure out the rest itself. In my case, I had compiled the artifacts earlier using mvn compile and then it just works! :)

So, yes, looks good from here from the first two tests. 👍🏻

@bmarwell
Copy link
Contributor Author

bmarwell commented May 5, 2023

I can confirm mvn4 + liberty:devc is working as well: bmarwell/diceroll-prepare#50

You can close this issue and #1660 as "delivered".

Great work! I have been there, replacing all the ant tasks and other stuff was quite a lot of work. Although I did push too many commits into a single PR, I hope some of them were useful to you.

Thanks! 🙏🏻

@cherylking
Copy link
Member

Great work! I have been there, replacing all the ant tasks and other stuff was quite a lot of work. Although I did push too many commits into a single PR, I hope some of them were useful to you.

@bmarwell Thank you Ben! I absolutely used your PR to guide my changes. It was very helpful.

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 a pull request may close this issue.

3 participants