[ ] Replace hard coded target/ path in modules for the variable ${project.build.directory}
[ ] Implement the option to add imports using the GradlePlugin API in the build.gradle.kts (how it should be)
[ ] Implement the option to add new configurations at the end of tasks.test in the build.gradle.kts (the modules jacoco and jacoco-with-min-coverage-check already need this, but it replaces the complete taks.test configuration) - how it should be
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 the package.json
npm run test from the package.json
add the frontend build project inside the .jar
To test the sample:
./gradlew clean build --no-daemon --info (will generate the .jar at build/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.
Vue works with the Maven front-end plugin; it adds the static folder with Vue files directly to the .jar without extra configuration.
Prerequisites
target/
path in modules for the variable${project.build.directory}
GradlePlugin
API in thebuild.gradle.kts
(how it should be)tasks.test
in thebuild.gradle.kts
(the modulesjacoco
andjacoco-with-min-coverage-check
already need this, but it replaces the complete taks.test configuration) - how it should beThis sample implemented the following features which is going to be handle by this issue:
build
foldernpm install
npm run build
from thepackage.json
npm run test
from thepackage.json
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:
build.gradle.kts
, and also make sure thatnpm run build
runs before thetasks.bootJar
task, which is responsible for generating the .jar.