question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Bug] NX fails to execute maven commands

See original GitHub issue

Plugin Name and Version:

Nx Version (nx --version):

  • 11.0.20

Angular CLI version (ng --version):

  • Not present, as the workspace was created as an empty workspace (it’s not a angular workspace)

Expected Behaviour

When I execute nx serve test-java-app against a freshly generated (with this plugin) java springboot app, I expect it to properly start the app

Actual Behaviour

When nx serve app / nx run app:run / nx buildJar app / nx buildWar app / nx buildImage app / nx buildInfo app / nx serve app commands are run against a freshly generated java app (this this plugin), the command fails with following output:

❯ nx serve test-java-app

> nx run test-java-app:serve
Executing command: ./mvnw.cmd spring-boot:run
'.' is not recognized as an internal or external command,
operable program or batch file.
Failed to execute command: ./mvnw.cmd spring-boot:run

The command fails the same when it is run from the workspace root directory, and from the directory with maven files.

When ./mvnw.cmd test-java-app is run from the directory with the maven files, the app starts properly.

Steps to reproduce the behaviour

  1. Create an empty NX workspace (haven’t tested on other workspace setups) with npx create-nx-workspace@latest app
  2. Add the nxrocks springboot dependency npm install --save-dev @nxrocks/nx-spring-boot
  3. Generate a Java Maven Springboot project nx g @nxrocks/nx-spring-boot:app app. Select these options: Maven, Jar, Java 11 and Java.
  4. Execute nx serve app from the workspace directory

Alternate way to reproduce the behaviour using existing repositories

I have a repository where the generated code exists and where the issue is present. It contains multiple apps.

  • java-app is an older variant that was generated with nx:1.2.1 , and had issues described here
  • test-java-app is a variant generated with the newest 1.3.0 version and has the bug described in this issue.

Behaviour steps will be explained using the second repo:

  1. Clone repository with git clone https://github.com/Kwandes/app-sandbox.git
  2. cd app-sandbox/app-sandbox // nested workspace
  3. Run npm install
  4. Run nx serve test-java-app

Extra notes:

  • A friend running on Windows in their own repository has also encountered this issue in a freshly generated app
  • this issue is related to #29

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
tinesoftcommented, Feb 9, 2021

You’re welcome @Kwandes

Thank you for reporting the issue 😃

1reaction
Kwandescommented, Feb 9, 2021

Works perfectly for both my friend and me. Thank you very much for a quick fix

Read more comments on GitHub >

github_iconTop Results From Across the Web

[Bug] Springboot maven app is incorrectly recognized as a ...
When nx serve app / nx run app:run / nx buildJar app / nx buildWar app / nx buildImage app / nx buildInfo...
Read more >
Failed to execute goal org.codehaus.mojo:exec-maven-plugin ...
When I tried to run the project from IDE, it was giving me same error. But when I tried running from the command...
Read more >
Failed to execute goal org.codehaus.mojo ... - Google Groups
Failed to execute goal org.codehaus.mojo:exec-maven-plugin:3.0.0:exec (default-cli) on project LFDD-master_maven: Command execution failed.
Read more >
Bug listing with status UNCONFIRMED as at 2022/12/24 17 ...
Bug:128538 - "sys-apps/coreutils: /bin/hostname should be installed from coreutils not sys-apps/net-tools" status:UNCONFIRMED resolution: severity:enhancement ...
Read more >
[JDK-8183918] Crash error in maven install - Java Bug System
Execute command "mvn clean install" ERROR MESSAGES/STACK TRACES THAT OCCUR : # # A fatal error has been detected by the Java Runtime ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found