Skip to content
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

[Bug] Springboot maven app is incorrectly recognized as a gradle app #29

Closed
Kwandes opened this issue Jan 17, 2021 · 2 comments
Closed
Assignees
Labels

Comments

@Kwandes
Copy link

Kwandes commented Jan 17, 2021

Plugin Name and Version:

  • 1.2.1

Nx Version (nx --version):

  • 11.1.5

Angular CLI version (ng --version):

  • 11.0.4

Operating System:

  • Windows 10 20H2

Project setup:

  • Springboot app generated with nxrocks 1.2.1, type: Maven

Expected Behaviour

When nx serve app / nx run app:run / nx buildJar app / nx buildWar app / nx buildImage app / nx buildInfo app commands are run, a mvaen equivalent should be executed and the command should complete successfully.

Actual Behaviour

When nx serve app / nx run app:run / nx buildJar app / nx buildWar app / nx buildImage app / nx buildInfo app commands are run, a gradle equivalent is run (for nx serve app the command is ./gradlew.cmd bootRun), which fails due to the project not having gradle configured (I presume).

If I navigate to Java project root directory and run mvnw spring-boot:run, the application starts successfully.

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 two repositories where I have this bug (and no repositories where it works).
Both contain a description of how they were set up in docs/setup-guide.md

Behaviour steps will be explained using the second repo:

  1. Clone repository with git clone https://github.com/treecreate/webstore.git
  2. cd webstore
  3. Run npm install
  4. Run nx serve api

Extra notes:

I was able to reproduce the bug on my laptop running Windows 10 2004.

@tinesoft tinesoft self-assigned this Jan 18, 2021
@tinesoft tinesoft added 🐛 bug Something isn't working @nxrocks/nx-spring-boot labels Jan 18, 2021
@tinesoft
Copy link
Owner

Hi @Kwandes

Thank you for reporting the issue. I was able to reproduce it on my windows 10 machine (which is a good sign 😄 ). I will now look into a fix. Stay tuned!

Cheers

@tinesoft
Copy link
Owner

Hi @Kwandes,

Looking at the 2 repos you mentioned in your first comment, I noticed that the Maven Wrapper (./mvnw) located at the root of the generated spring boot app, is not executable as it should.... which is causing the issue. Indeed, with current implementation of the plugin, the project build system is determined by trying to execute the ./mvnw --version command.

I wasn't able to reproduce the "non executable" ./mvnw on a new project generated from a empty Nx workspace...

Anyway, in the upcoming version of the plugin, I have improved the way the build system is determined
so hopefully, this should not happen again.

Feel free to re-open, or to file another issue if it does.

Cheers

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants