Add missing gradle frontend server plugin
renanfranca opened this issue Β· comments
Prerequisites
This sample implemented the following features which is going to be handle by this issue:
- install the npm inside the
build
folder npm install
npm run build
from thepackage.json
npm run test
from thepackage.json
- add the frontend build project inside the .jar
To test the sample:
./gradlew clean build --no-daemon --info
(will generate the .jar atbuild/libs
folder)java -jar build/libs/jhipster-sample-application-0.0.1-SNAPSHOT.jar
(access the frontend at http://localhost:8080)docker compose -f src/main/docker/sonar.yml up -d
and./gradlew clean build sonar --info
(all frontend tests will be at sonar with 100% coverage)
Sharing what I learned after a long time dedicated:
- Angular doesn't work with the Maven front-end plugin or with Gradle edit: when run the generated .jar.. This was fixed at this issue
- Vue works with the Maven front-end plugin; it adds the
target/classes/static
folder with Vue files directly to the .jar without extra configuration. - Vue on Gradle doesn't automatically add the static folder to the .jar. You need to explicitly define this in
build.gradle.kts
, and also make sure thatnpm run build
runs before thetasks.bootJar
task, which is responsible for generating the .jar.
@murdos and @atomfrede: please let me know WDYT ;)
I will try to do a proper review later today. Thanks for putting the efforts into this π
@renanfranca Looks quite fine from what I can tell. For the node/npm tasks you might consider defining proper inputs and outputs to make caching (both local or via develocity) possible
Thank you for the feedback π
For the node/npm tasks you might consider defining proper inputs and outputs to make caching (both local or via develocity) possible
Can you detail which inputs and outputs (local/develocity)?
- Angular doesn't work with the Maven front-end plugin or with Gradle edit: when run the generated .jar. I didn't try react
I tried gradle with vue and react as frontend and they are working with the implementation at draft pull request #9825
I tried angular and it isn't working. I have to look into it.
I am in the process of removing gradleapp
from generator.sh
and replacing it with fullapp
using the Gradle build tool. To see the steps I need to take to accomplish this, please check out this pull request.
Edit: I am going to do this in another issue/pull request to separate things
You can claim the bounty of this ticket @renanfranca , in addition of the specific ones in each PRs , as it was a huge work to improve gradle support
Thanks so much for your work
You can claim the bounty of this ticket @renanfranca , in addition of the specific ones in each PRs , as it was a huge work to improve gradle support
Thanks so much for your work
Thank you very much for the support and recognition. The quality of the code will continue to be my priority πβοΈ
@pascalgrimaud: Bounty Claimed https://opencollective.com/generator-jhipster/expenses/204898. Thanks π π
@renanfranca : approved