-
Notifications
You must be signed in to change notification settings - Fork 84
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
Remove old and deprecated items, use Resolver API #336
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
da0439a
Make up some years of debt
cstamas e2395de
One IT fails
cstamas 16a31e6
Merge remote-tracking branch 'origin/master' into make-up-10-years
slawekjaranowski 20b8c1d
Use also project artifacts in createFlattenedDependenciesAll
slawekjaranowski 968bbd7
Skip IT flatten-dependency-all-depmgnt-optional for Maven < 3.5.2
slawekjaranowski File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
src/it/projects/flatten-dependency-all-depmgnt-optional/invoker.properties
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# Test fails on Maven < 3.5.2 | ||
invoker.maven.version = 3.5.2+ |
262 changes: 135 additions & 127 deletions
262
src/main/java/org/codehaus/mojo/flatten/FlattenMojo.java
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@cstamas I use
maven-artifact-transfer
in one of the Maven plugins maintained by the Jenkins project and I was unaware that it was deprecated. If it is, what is its replacement and how should I migrate?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@basil MAT was introduced to make transition from
org.sonatype.aether
Java package toorg.eclipse.aether
possible, and did it by use of Java reflection. This change happened when Aether (today Resolver) moved from Sonatype to Eclipse, between Maven 3.0 and Maven 3.1 (then it moved to ASF, but ASF got permission to use org.eclipse.aether package). The resolver packages will not be changed (for example to org.apache.maven.resolver) UNTIL resolver is also made "hidden" by Maven (like all of it's internals), and the new Maven4 API becomes the ONLY way to interact with Maven (and Resolver).This is to happen in far future, as similarly like Maven 3.x supported 2.x and 3.x plugins, Maven 4.x will support 4.x (the new API) and 3.x (current, 3.1+ "API") plugins, hence the cut-oif is expected maybe in Maven 5, still undecided (but also is safely far in future).
Hence, if you do NOT support Maven 3.0.x anymore (hopefully not, even ASF raised the bar to 3.2.5, that is still almost 10 years of history), all you have to do is to use Resolver classes "directly", just like this PR does.
Ironically, this "direct use" of resolver classes was considered "bad practice" due Maven 3.0/Maven 3.1 transition fiasco (as plugins became "maven 3.0 only" or "maven 3.1 only", depending on which packages they used), and this got "imprinted" into maven devs, while this is actually NOT true from the moment you declare "supported" Maven versions as
[3.1,)
(3.1 and onwards). It was almost full 13 years since release of 3.0, Maven Project dropped support for Maven 3.0.x since long time as well. And similar resolver package change is not gonna happen in long term, again, probably in Maven 5 or so.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we release mat? I found it useful for code simplification
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, our minimum Maven version is 3.81 so I filed jenkinsci/maven-hpi-plugin#469. I appreciate your explanation. I have inherited several old Maven plugins and have been trying to modernize them, but it has been very challenging for me since I am an outsider to the Maven developer community and these transitions are not documented very well. That makes your explanation particularly helpful. Thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you accept to not support Maven 3.0.x line (and anything older), it is totally safe to go for "direct use" of Resolver classes. Maven 4 introduces "new API" that will coexists with "old Maven 3.1+ API (am including resolver API here as well)" during Maven 4.x lifespan to offer transition period. It will be "cut off" (still undecided) probably in Maven 5, when the "new API" becomes the only way to interact with Maven, while all of it's internals and guts (unlike today, where you can access or inject just anything from Maven) becomes hidden from plugins.
Still, to be on safe side, please read this https://maven.apache.org/resolver/api-compatibility.html
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Problem with MAT is that it uses Maven2
ArtifactRepository
type for a local repository of "modern maven3 library" (org.sonatype or org.eclipse, does not matter). See issues:https://issues.apache.org/jira/browse/MNG-7706
https://issues.apache.org/jira/browse/MNG-7663