Closed mattagohni closed 2 years ago
Hi @mattagohni
Thanks for using the plugin and for reporting this issue. As you said, this may be a general problem on Spring Boot side. I'm monitoring the original issue to see if I need to take some actions or not.
Stay tuned
I discovered this Nx plugin the other day, only got to play with it now though.. experiencing the same issue here with two Spring web app projects: one intended as a "standalone" jar
, another as a "deployable" war
.
searching for more info on the core error message, I noticed a comment from @wilkinsona (Spring member) where he's asking:
[snip] can you please help us to understand your use case for calling the
spring-boot:repackage
goal in isolation rather than relying upon it being bound to thepackage
phase?
this prompted me to go try the typical clean
and package
goals workflow from within each Nx workspace app folder, which works exactly as expected, both with the bundled mvnw
and with my globally installed 3.6.3
version.
my environment:
19043.1348
14.16.1
(installed via coreybutler/nvm-windows
) with npm@6.14.12
@nrwl/cli@13.2.2
(global and local)@angular/cli@13.0.3
(wasn't installed, is now, made no difference)now for the ultimate clincher: I am a JS dev (in a broad sense), not a Java dev.. so firstly, a monstrous thank you for making it so easy for someone like me to even get this far with creating Java apps. projects like Nx and plugins like this make it so much easier to learn new things. ๐๐ผ
either way, I'm curious now: would this not perhaps be "solved" by making the nx run <app-name>:buildJar
and nx run <app-name>:buildJar
commands execute mvn package
instead of mvn spring-boot:repackage
? or would this have other side effects in the workflow?
lastly, on a semi-related note: since this plugin can generate an application explicitly configured either for war
or jar
outputs, would it not be simpler to replace (wrap?) the buildJar
and buildWar
plugin executors with just build
, and getting the "jar or war" output details from the project config..? ๐ค
Hi @ZaLiTHkA
Thanks for using the plugin and for your interest, I'm glad it is useful to you ๐
The reason why I chose the repackage
goal, was because it is present in both maven
and gradle
plugins for Spring Boot, whereas the default package
goal only exists for Maven.
Besides, the documentation didn't clearly mention that repackage
was not meant to be used directly....
In light with the last information, I will update the plugin to use package
(resp. build
) to build the artifact for Maven (resp. Gradle). That should fix this issue.
Also, your suggestion of using a single build
executor (that would alias current buildJar/buildWar) is totally valid ๐๐พ
I will add this feature as well.
Stay tuned
thanks @tinesoft, that all sounds pretty awesome.. I must say, I was "thinking out loud" there more than anything else. my personal experience is quite limited with Maven and Gradle, mostly just from tweaking generated build files.
in my mind, the idea of keeping a Java-powered API, a JS-powered static site, and [insert favourite project here] in a single monorepo, with the ability to control the build process from one common system (aka: nx
) is a developer's dream... Nrwl may have created Nx itself, but it's projects like this one that provide the real power. so, thank you very much for that!
feel free to ping me if you need a hand with testing anything, insomnia gives me lots of time to play with things like this... ๐คฃ
:tada: This issue has been resolved in version @nxrocks/nx-spring-boot-v4.0.0 :tada:
The release is available on:
Your semantic-release bot :package::rocket:
:tada: This issue has been resolved in version @nxrocks/nx-melos-v1.0.0 :tada:
The release is available on:
Your semantic-release bot :package::rocket:
:tada: This issue has been resolved in version 1.0.0 :tada:
The release is available on:
Your semantic-release bot :package::rocket:
Plugin Name and Version: @nxrocks/nx-spring-boot@1.3.1
Nx Version (
nx --version
): 11.3.0Angular CLI version (
ng --version
): 11.3.0Expected Behaviour
when
is executed the SpringBoot Application is
repackaged
successfully.Actual Behaviour
Steps to reproduce the behaviour
nx buildJar <SpringBootApp>
More Information
./mvnw spring-boot:repackage
directly in the folder of the springBootApp the same happens./mvnw clean install spring-boot:repackage
the repackage is done successfully