Skip to content

chore(repo): use @nx/maven to build @nx/maven#33412

Open
MaxKless wants to merge 24 commits intomasterfrom
use-maven-plugin
Open

chore(repo): use @nx/maven to build @nx/maven#33412
MaxKless wants to merge 24 commits intomasterfrom
use-maven-plugin

Conversation

@MaxKless
Copy link
Collaborator

@MaxKless MaxKless commented Nov 7, 2025

Current Behavior

there is an install target calling ./mvnw directly

Expected Behavior

we use the @nx/maven plugin for generating maven targets

@MaxKless MaxKless requested review from a team, FrozenPandaz and vsavkin as code owners November 7, 2025 16:14
@vercel
Copy link

vercel bot commented Nov 7, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
nx-dev Ready Ready Preview Jan 16, 2026 4:12pm

Request Review

@netlify
Copy link

netlify bot commented Nov 7, 2025

Deploy Preview for nx-docs ready!

Name Link
🔨 Latest commit f0f336c
🔍 Latest deploy log https://app.netlify.com/projects/nx-docs/deploys/69b44d30f7fe8d000870c353
😎 Deploy Preview https://deploy-preview-33412--nx-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@nx-cloud
Copy link
Contributor

nx-cloud bot commented Nov 7, 2025

View your CI Pipeline Execution ↗ for commit f0f336c

Command Status Duration Result
nx affected --targets=lint,test,build,e2e,e2e-c... ❌ Failed 22m 50s View ↗
nx run-many -t check-imports check-lock-files c... ✅ Succeeded 4m 11s View ↗
nx-cloud record -- nx-cloud conformance:check ✅ Succeeded 8s View ↗
nx-cloud record -- nx format:check ✅ Succeeded 1s View ↗
nx-cloud record -- nx sync:check ✅ Succeeded <1s View ↗

☁️ Nx Cloud last updated this comment at 2026-03-13 18:13:13 UTC

nx-cloud[bot]

This comment was marked as outdated.

nx-cloud[bot]

This comment was marked as outdated.

nx-cloud[bot]

This comment was marked as outdated.

nx-cloud[bot]

This comment was marked as outdated.

pnpm-lock.yaml Outdated
Comment on lines +595 to +597
'@nx/maven':
specifier: 22.1.0-rc.2
version: 22.1.0-rc.2([email protected](@swc-node/[email protected](@swc/[email protected](@swc/[email protected]))(@swc/[email protected])([email protected]))(@swc/[email protected](@swc/[email protected])))
Copy link
Contributor

Choose a reason for hiding this comment

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

Version mismatch detected: package.json specifies @nx/maven: 22.1.0-rc.3 but pnpm-lock.yaml has locked version 22.1.0-rc.2. This mismatch will cause the wrong version to be installed.

# Fix by running:
pnpm install
# This will update the lockfile to match package.json

The lockfile must be regenerated to match the version specified in package.json to ensure consistent installations across environments.

Spotted by Graphite Agent

Fix in Graphite


Is this helpful? React 👍 or 👎 to let us know.

nx-cloud[bot]

This comment was marked as outdated.

nx-cloud[bot]

This comment was marked as outdated.

Comment on lines +95 to +97
- name: Show project graph
run: npx nx show project nx-maven-plugin | jq .targets.test

Copy link
Member

Choose a reason for hiding this comment

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

Remove?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

for sure once debugging is done I'll remove it 👍

nx-cloud[bot]

This comment was marked as outdated.

Copy link
Contributor

@nx-cloud nx-cloud bot left a comment

Choose a reason for hiding this comment

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

Important

At least one additional CI pipeline execution has run since the conclusion below was written and it may no longer be applicable.

Nx Cloud is proposing a fix for your failed CI:

These changes fix the e2e test failure by updating the test expectations to align with the PR's intent of using simple artifactId names instead of full Maven coordinates. The test was expecting project graph nodes named 'com.example:app' but the new implementation uses just 'app', causing the test to fail when verifying dependencies.

Note

We are verifying this fix by re-running e2e-maven:e2e-ci--src/maven.test.ts.

diff --git a/e2e/maven/src/maven.test.ts b/e2e/maven/src/maven.test.ts
index 812ab78da9..42b04eaf85 100644
--- a/e2e/maven/src/maven.test.ts
+++ b/e2e/maven/src/maven.test.ts
@@ -71,15 +71,15 @@ describe('Maven', () => {
     const graph = readJson('graph.json');
 
     // Check that dependencies exist in the graph
-    const appDeps = graph.graph.dependencies['com.example:app'];
+    const appDeps = graph.graph.dependencies['app'];
     expect(appDeps).toContainEqual({
-      source: 'com.example:app',
-      target: 'com.example:lib',
+      source: 'app',
+      target: 'lib',
       type: 'static',
     });
     expect(appDeps).toContainEqual({
-      source: 'com.example:app',
-      target: `com.example:${mavenProjectName}`,
+      source: 'app',
+      target: mavenProjectName,
       type: 'static',
     });
   });

🔔 Heads up, your workspace has pending recommendations ↗ to auto-apply fixes for similar failures.

Apply fix via Nx Cloud  Reject fix via Nx Cloud


Or Apply changes locally with:

npx nx-cloud apply-locally ccqO-gSLE

Apply fix locally with your editor ↗   View interactive diff ↗



🎓 Learn more about Self-Healing CI on nx.dev

Copy link
Contributor

@nx-cloud nx-cloud bot left a comment

Choose a reason for hiding this comment

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

Important

At least one additional CI pipeline execution has run since the conclusion below was written and it may no longer be applicable.

Nx Cloud is proposing a fix for your failed CI:

Our changes fix the test failure by correcting the Nx command syntax from run mvn:compile app to run app:mvn:compile. When using colon-based target prefixes, Nx requires the format project:prefix:goal, not prefix:goal project, which was causing the "Cannot find project 'mvn'" error.

Note

We are verifying this fix by re-running e2e-maven:e2e-ci--src/maven.test.ts.

diff --git a/e2e/maven/src/maven.test.ts b/e2e/maven/src/maven.test.ts
index 87b664439b..97050d89a5 100644
--- a/e2e/maven/src/maven.test.ts
+++ b/e2e/maven/src/maven.test.ts
@@ -118,7 +118,7 @@ describe('Maven', () => {
     expect(output).toContain('- mvn:install-ci:');
 
     // Verify prefixed target works
-    const buildOutput = runCLI('run mvn:compile app --no-batch');
+    const buildOutput = runCLI('run app:mvn:compile --no-batch');
     expect(buildOutput).toContain('BUILD SUCCESS');
   });
 });

🔔 Heads up, your workspace has pending recommendations ↗ to auto-apply fixes for similar failures.

Apply fix via Nx Cloud  Reject fix via Nx Cloud


Or Apply changes locally with:

npx nx-cloud apply-locally TDXS-4pyH

Apply fix locally with your editor ↗   View interactive diff ↗



🎓 Learn more about Self-Healing CI on nx.dev

Copy link
Contributor

@nx-cloud nx-cloud bot left a 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 add a "Bootstrap Maven plugin" step to the CI workflow that builds and installs dev.nx.maven:nx-maven-plugin:0.0.15 to the local .m2 repository before any Nx commands run. This fixes the format:check and sync:check failures caused by the @nx/maven plugin (newly added to nx.json) being unable to resolve the Maven plugin during project graph processing. Without this step, every Nx command fails immediately because the plugin jar is not in Maven Central and not pre-installed on the CI runner.

Note

We are verifying this fix by re-running a subset of the 2 failed tasks that were analyzed.

diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 041af81b..9e885e1b 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -77,6 +77,9 @@ jobs:
           pnpm install --frozen-lockfile
           pnpm playwright install --with-deps
 
+      - name: Bootstrap Maven plugin
+        run: ./mvnw install -pl dev.nx.maven:nx-maven-plugin -am -DskipTests
+
       - name: Nx Report
         run:
           pnpm nx report

🔔 Heads up, your workspace has pending recommendations ↗ to auto-apply fixes for similar failures.

Apply fix via Nx Cloud  Reject fix via Nx Cloud


Or Apply changes locally with:

npx nx-cloud apply-locally 3ZpQ-ZoO1

Apply fix locally with your editor ↗   View interactive diff ↗



🎓 Learn more about Self-Healing CI on nx.dev

Copy link
Contributor

@nx-cloud nx-cloud bot left a comment

Choose a reason for hiding this comment

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

Important

At least one additional CI pipeline execution has run since the conclusion below was written and it may no longer be applicable.

Nx Cloud is proposing a fix for your failed CI:

We add a "Bootstrap Maven plugin" step to the CI workflow that builds and installs dev.nx.maven:nx-maven-plugin:0.0.15 to the local .m2 repository before any Nx commands run. This fixes the format:check and sync:check failures caused by the @nx/maven plugin (newly added to nx.json) being unable to resolve the Maven plugin during project graph processing. Without this step, every Nx command fails immediately because the plugin jar is not in Maven Central and not pre-installed on the CI runner.

Tip

We verified this fix by re-running nx-cloud record -- nx sync:check.

diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 041af81b..9e885e1b 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -77,6 +77,9 @@ jobs:
           pnpm install --frozen-lockfile
           pnpm playwright install --with-deps
 
+      - name: Bootstrap Maven plugin
+        run: ./mvnw install -pl dev.nx.maven:nx-maven-plugin -am -DskipTests
+
       - name: Nx Report
         run:
           pnpm nx report

🔔 Heads up, your workspace has pending recommendations ↗ to auto-apply fixes for similar failures.

Apply fix via Nx Cloud  Reject fix via Nx Cloud


Or Apply changes locally with:

npx nx-cloud apply-locally 3ZpQ-ZoO1

Apply fix locally with your editor ↗   View interactive diff ↗



🎓 Learn more about Self-Healing CI on nx.dev

MaxKless and others added 24 commits March 13, 2026 11:41
Switch the Maven projects (batch-runner, batch-runner-adapters, shared,
maven-plugin) to use the @nx/maven plugin's inferred targets instead of
manual run-commands. Introduces nx-parent-pom to avoid circular deps,
adds explicit project names, and configures mvn-package goals for the
adapter shaded JARs.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
- Simplify e2e-maven implicit deps to just @nx/maven
- Add adapter provided deps in batch-runner pom.xml for dependency inference
- Use ^mvn:package in legacy-post-build instead of explicit project refs
- Remove redundant projectType, tags, and implicit deps from sub-projects
The CI variant targets don't inherit overrides from their base
targets, so the custom shade goals need to be specified separately.
Avoids colon parsing ambiguity with `nx run app:mvn:compile` by using
`nx run mvn:compile app` instead.
The mvn:verify-ci target conflicts with the build target's ^mvn:package
dependency, causing jar plugin to fail when shade already replaced the
artifact.
Switch from ^mvn:package to ^mvn:package-ci so the build target uses
the same CI pipeline as mvn:verify-ci, avoiding duplicate jar plugin
invocations that conflict with the shade plugin.
Shared is consumed via the shade plugin, not from the local Maven repo.
Install was causing failures when build state incorrectly recorded
target/classes as the main artifact.
Maven build state carries project.artifact.file between task
invocations, causing jar:jar to fail when it finds the artifact
already set from a previous run or cache restore.
Copy link
Contributor

@nx-cloud nx-cloud bot left a comment

Choose a reason for hiding this comment

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

Nx Cloud has identified a flaky task in your failed CI:

🔂 Since the failure was identified as flaky, we triggered a CI rerun by adding an empty commit to this branch.

Nx Cloud View detailed reasoning in Nx Cloud ↗

🔔 Heads up, your workspace has pending recommendations ↗ to auto-apply fixes for similar failures.


🎓 Learn more about Self-Healing CI on nx.dev

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 this pull request may close these issues.

3 participants