-
Notifications
You must be signed in to change notification settings - Fork 348
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
Maven: Resolve artifactId properties before downloading versions #4404
Maven: Resolve artifactId properties before downloading versions #4404
Conversation
In fact such placeholder cause other issues when some recipes When testing type: specs.openrewrite.org/v1beta/recipe
name: io.jenkins.tools.pluginmodernizer.UpgradeParentVersion
recipeList:
- org.openrewrite.maven.UpgradeParentVersion:
groupId: org.jenkins-ci.plugins
artifactId: plugin
newVersion: 4.X I got some result that OpenRewrite is moving some dependency on dependencyManagement even if they are managed by the pom. Probably because the resolution with placeholder doesn't happen correctly <parent>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>plugin</artifactId>
- <version>4.86</version>
+ <version>4.87</version>
<relativePath />
</parent>
<groupId>io.jenkins.plugins</groupId>
@@ -39,6 +39,11 @@
<dependencyManagement>
<dependencies>
<dependency>
+ <groupId>io.jenkins.plugins</groupId>
+ <artifactId>asm-api</artifactId>
+ <version>9.7-33.v4d23ef79fcc8</version>
+ </dependency>
+ <dependency>
<groupId>io.jenkins.tools.bom</groupId>
<artifactId>bom-${jenkins.baseline}.x</artifactId>
<version>3271.vf18ea_cb_9edfb_</version> If I change my pom bom artifact to <artifactId>bom-2.440.x</artifactId> Everything is back to normal @@ -4,7 +4,7 @@ io.jenkins.tools.pluginmodernizer.UpgradeParentVersion
<parent>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>plugin</artifactId>
- <version>4.86</version>
+ <version>4.87</version>
<relativePath />
</parent>
<groupId>io.jenkins.plugins</groupId> |
Some other occurence caused by the placeholder
|
Is it something we can move on or is prefereble to have a general solution like #4527 I'm asking because we are movin now from a new recommanded version (from 2.440 to 2.452) and we are seeing more and more failing due to the new archetype
Thanks! |
Thanks for this contribution! |
What's changed?
Support changing managed maven dependencies with artifactIds that include properties.
What's your motivation?
Jenkins has moved to a model where a bom is now defined like
This breaks the org.openrewrite.jenkins.ModernizePlugin recipe. Attempting to use an artifactId with a property fails to resolve:
jenkinsci/archetypes#737
Anyone you would like to review specifically?
@timtebeek and I briefly talked about this on OSS Slack.
Have you considered any alternatives or workarounds?
I made an attempt to fix this in the
MavenPomDownloader
in sghill@941e1ee. It didn't work because the set of resolved poms through this codepath is always empty.Since this is valid maven, I think it'd be nice if this were universally supported instead of just fixed in this one recipe. I'm not quite sure how to go about making it more universal.
Any additional context
This is more for discussion than an implementation I feel strongly about. My ideal end state is for the
ModernizePlugin
recipe to compose these building blocks to extract ajenkins.baseline
property and use it in multiple places, just like the updated plugin archetype.Checklist