tinesoft / nxrocks

Set of Nx plugins to enhance your Nx workspace (even more!)
MIT License
307 stars 34 forks source link

[Bug] Unable to create new Spring Boot application with the latest version of NX #238

Open Divaaaaaan opened 2 days ago

Divaaaaaan commented 2 days ago

Plugin Name

@nxrocks/nx-spring-boot

Nx Report



 NX   Report complete - copy this into the issue template

Node           : 20.18.0
OS             : linux-x64
Native Target  : x86_64-linux
bun            : 1.1.30

nx             : 20.0.0
@nx/js         : 20.0.0
@nx/eslint     : 20.0.0
@nx/workspace  : 20.0.0
@nx/angular    : 20.0.0
@nx/devkit     : 20.0.0
@nx/vite       : 20.0.0
@nx/web        : 20.0.0
@nx/webpack    : 20.0.0
typescript     : 5.6.3
---------------------------------------
Community plugins:
@analogjs/content             : 1.8.2
@analogjs/platform            : 1.8.2
@analogjs/router              : 1.8.2
@analogjs/vite-plugin-angular : 1.8.2
@nxrocks/nx-spring-boot       : 10.2.6

### Expected Behaviour

Create a project using `nx g @nxrocks/nx-spring-boot:project`.

### Actual Behaviour

```~/Workspace/Work/Bedrock git:[main] bunx nx g @nxrocks/nx-spring-boot:project test --verbose

 NX  Generating @nxrocks/nx-spring-boot:project

✔ What kind of project are you generating? · application
✔ Which build system would you like to use? · maven-project
✔ Which packaging would you like to use? · jar
✔ Which version of Java would you like to use? · 22
✔ Which language would you like to use? · java
✔ What groupId would you like to use? · com.test
✔ What artifactId would you like to use? · test
✔ What package name would you like to use? · com.test.api

 NX   Cannot read properties of undefined (reading 'replace')

TypeError: Cannot read properties of undefined (reading 'replace')
    at removeWindowsDriveLetter (/home/user/Workspace/Work/Bedrock/node_modules/nx/src/utils/path.js:9:27)
    at normalizePath (/home/user/Workspace/Work/Bedrock/node_modules/nx/src/utils/path.js:16:12)
    at determineProjectNameAndRootOptions (/home/user/Workspace/Work/Bedrock/node_modules/@nx/devkit/src/generators/project-name-and-root-utils.js:10:58)
    at normalizeOptions (/home/user/Workspace/Work/Bedrock/node_modules/@nxrocks/nx-spring-boot/src/generators/project/lib/normalize-options.js:6:144)
    at projectGenerator (/home/user/Workspace/Work/Bedrock/node_modules/@nxrocks/nx-spring-boot/src/generators/project/generator.js:9:64)
    at /home/user/Workspace/Work/Bedrock/node_modules/nx/src/command-line/generate/generate.js:238:32
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async handleErrors (/home/user/Workspace/Work/Bedrock/node_modules/nx/src/utils/handle-errors.js:9:24)
    at async Object.handler (/home/user/Workspace/Work/Bedrock/node_modules/nx/src/command-line/generate/command-object.js:14:22)

### Steps to reproduce the behaviour

1. Create new nx workspace with "none" preset
2. Install @nxrocks/nx-spring-boot
3. Try and create a spring boot application
Divaaaaaan commented 2 days ago

It seems like the options.directory value is null when logging out the options in normalize-options.js

tinesoft commented 2 days ago

Hi @Divaaaaaan

Thanks for reporting this, I'll have a look and provide an update soonish.

Stay tuned!

Divaaaaaan commented 2 days ago

Hi @tinesoft

Cool no worries, did some investigating quick and it seems like the structure might have changed as the options for the generator doesn't seem to be passed through anymore. In the interim, I just updated that file to use options.name as the directory as well which is working but hope this helps make the checking on your side quicker and easier.

Divaaaaaan commented 1 day ago

@tinesoft Just an update, seems like things are not playing well together when I edited the file :sweat_smile: so will wait for the update rather before continuing.

WodenWang820118 commented 1 day ago

Having a look at the Nx plugin registry, it supports the Nx version between 16 and 18. When will the plugin be updated accordingly? Let me know if I can help upgrading.