chore(repo): use @nx/maven to build @nx/maven#33412
chore(repo): use @nx/maven to build @nx/maven#33412
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
✅ Deploy Preview for nx-docs ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
View your CI Pipeline Execution ↗ for commit f0f336c
☁️ Nx Cloud last updated this comment at |
c1afe9d to
e5817c2
Compare
2811980 to
4085a8e
Compare
pnpm-lock.yaml
Outdated
| '@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]))) |
There was a problem hiding this comment.
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.jsonThe lockfile must be regenerated to match the version specified in package.json to ensure consistent installations across environments.
Spotted by Graphite Agent
Is this helpful? React 👍 or 👎 to let us know.
4085a8e to
2e912b4
Compare
.github/workflows/ci.yml
Outdated
| - name: Show project graph | ||
| run: npx nx show project nx-maven-plugin | jq .targets.test | ||
|
|
There was a problem hiding this comment.
for sure once debugging is done I'll remove it 👍
There was a problem hiding this comment.
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.
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
There was a problem hiding this comment.
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.
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
a3618d2 to
702c1a9
Compare
There was a problem hiding this comment.
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.
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
There was a problem hiding this comment.
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.
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
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.
Co-authored-by: MaxKless <[email protected]>
Co-authored-by: MaxKless <[email protected]>
This reverts commit c49b726.
This reverts commit e497d6c.
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.
…sOn" This reverts commit e1ac12c.
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.
This reverts commit 583574a.
There was a problem hiding this comment.
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.
🔔 Heads up, your workspace has pending recommendations ↗ to auto-apply fixes for similar failures.
🎓 Learn more about Self-Healing CI on nx.dev
Current Behavior
there is an
installtarget calling./mvnwdirectlyExpected Behavior
we use the
@nx/mavenplugin for generating maven targets