[Bug] NX fails to execute maven commands
See original GitHub issuePlugin Name and Version:
- @nxrocks/nx-spring-boot:1.3.0
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
- Create an empty NX workspace (haven’t tested on other workspace setups) with
npx create-nx-workspace@latest app
- Add the nxrocks springboot dependency
npm install --save-dev @nxrocks/nx-spring-boot
- Generate a Java Maven Springboot project
nx g @nxrocks/nx-spring-boot:app app
. Select these options: Maven, Jar, Java 11 and Java. - 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:
- Clone repository with
git clone https://github.com/Kwandes/app-sandbox.git
cd app-sandbox/app-sandbox
// nested workspace- Run
npm install
- 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:
- Created 3 years ago
- Comments:6 (2 by maintainers)
You’re welcome @Kwandes
Thank you for reporting the issue 😃
Works perfectly for both my friend and me. Thank you very much for a quick fix