Created
March 2, 2022 13:56
-
-
Save jsrois/7b12a6eaf48f609ad638f3d401acb02d to your computer and use it in GitHub Desktop.
How to compile and copy the frontend build to the resources folder in a spring boot project
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // include in `build.gradle` | |
| // using `apply from: 'frontend.gradle'` | |
| node { | |
| nodeProjectDir = file("./frontend-app") | |
| } | |
| task buildFrontendApp(type: NpmTask) { | |
| args = ['run', 'build'] | |
| } | |
| task copyFrontendApp(type: Copy) { | |
| dependsOn('buildFrontendApp') | |
| from('./frontend-app/build') | |
| into("./src/main/resources/static") | |
| } | |
| buildFrontendApp.dependsOn npmInstall | |
| processResources.dependsOn copyFrontendApp | |
| copyFrontendApp.dependsOn buildFrontendApp | |
| build.dependsOn copyFrontendApp |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Also add the
node-gradleplugin to thebuild.gradlefile using