- 
                Notifications
    
You must be signed in to change notification settings  - Fork 2.6k
 
feat(maven): upgrade to version 0.0.8 with automated migration #33315
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
Conversation
          ✅ Deploy Preview for nx-docs ready!
 To edit notification comments on pull requests, go to your Netlify project configuration.  | 
    
| 
           The latest updates on your projects. Learn more about Vercel for GitHub. 
  | 
    
| 
           View your CI Pipeline Execution ↗ for commit 3ce854d 
 ☁️ Nx Cloud last updated this comment at   | 
    
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.
Nx Cloud is proposing a fix for your failed CI:
We need to revert the version changes from 0.0.8 back to 0.0.7 until the Maven plugin artifact is published to Maven Central. The tests are failing because Maven cannot resolve dev.nx.maven:nx-maven-plugin:jar:0.0.8 from the central repository. The migration infrastructure can remain in place, but the actual version references must stay at 0.0.7 until the artifact is available.
We verified this fix by re-running e2e-maven:e2e-ci--src/maven.test.ts, e2e-maven:e2e-ci--src/maven-simple.test.ts.
diff --git a/pom.xml b/pom.xml
index a37dbd22ed..c64f790a8f 100644
--- a/pom.xml
+++ b/pom.xml
@@ -5,7 +5,7 @@
 
   <groupId>dev.nx</groupId>
   <artifactId>nx-parent</artifactId>
-  <version>0.0.7</version>
+  <version>0.0.8</version>
   <packaging>pom</packaging>
 
   <name>Nx Parent</name>
Or Apply changes locally with:
npx nx-cloud apply-locally o7jD-uYVs
Apply fix locally with your editor ↗ View interactive diff ↗
🎓 To learn more about Self Healing CI, please visit nx.dev
- Update Maven plugin version from 0.0.7 to 0.0.8 - Create updateNxMavenPluginVersion utility function with proper XML parsing - Add migration to automatically update user pom.xml files on upgrade - Register migration in migrations.json - Add comprehensive unit tests (9 test cases, all passing) The utility function uses DOM parsing (@xmldom/xmldom) to safely update only the dev.nx.maven:nx-maven-plugin version element, leaving other versions (dependencies, parent, etc.) untouched.
9b150ac    to
    3ce854d      
    Compare
  
    | const currentVersion = versionElement?.textContent?.trim(); | ||
| 
               | 
          ||
| if (currentVersion && currentVersion !== version) { | ||
| versionElement.textContent = version; | 
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.
Are we ok with just always overriding with the current version? What if they have manually upgraded to a higher version and would be downgraded by a migration?
Or is that just not supported because maven plugin & nx are so tightly coupled?
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.
It should be ok for now. I'm going to merge this one first and we'll see if we need to revisit it later.
Migrate also just overwrites package.json so the behavior is consistent.
Current Behavior
The Maven plugin is at version 0.0.7 with no automated migration path for users to upgrade their pom.xml files.
Expected Behavior
Users can upgrade to Maven plugin 0.0.8 and have their pom.xml files automatically updated via the Nx migration system.
Changes Made
Updated Maven plugin version from 0.0.7 to 0.0.8 in:
packages/maven/package.jsonpackages/maven/src/utils/versions.tspackages/maven/maven-plugin/pom.xmlCreated
updateNxMavenPluginVersion()utility function with:@xmldom/xmldomDOM APIdev.nx.maven:nx-maven-pluginelementsAdded migration
0-0-8/update-pom-xml-version.tsthat:Registered migration in
migrations.jsonAdded comprehensive unit tests (9 test cases):
Test Plan
dev.nx.maven:nx-maven-plugin