fix(build): package frontend assets through Gradle resources
- Backend packaging: - make `processResources` include the built frontend dist as an explicit `static/` resource input instead of relying on a manual copy into Gradle's output directory - keep `bootJar` as the source of truth for bundling `static/index.html` into the application jar - Docker build: - pass the frontend dist location into Gradle with `-PfrontendDistDir=/tmp/frontend-dist` - remove the ad hoc copy into `build/resources/main/static` before `bootJar` - Validation: - verify `processResources` emits `build/resources/main/static/index.html` when given a frontend dist directory - keep `git diff --check` clean for the touched packaging files
This commit is contained in:
@@ -10,6 +10,9 @@ plugins {
|
||||
group = 'org.booklore'
|
||||
version = '0.0.1-SNAPSHOT'
|
||||
|
||||
def frontendDistDir = providers.gradleProperty('frontendDistDir')
|
||||
.orElse("${rootDir}/../booklore-ui/dist/booklore/browser")
|
||||
|
||||
java {
|
||||
toolchain {
|
||||
languageVersion = JavaLanguageVersion.of(25)
|
||||
@@ -141,6 +144,16 @@ jacocoTestReport {
|
||||
}
|
||||
}
|
||||
|
||||
tasks.named('processResources') {
|
||||
def frontendResourcesDir = providers.provider { file(frontendDistDir.get()) }
|
||||
inputs.dir(frontendResourcesDir)
|
||||
.withPropertyName('frontendDistDir')
|
||||
.optional()
|
||||
from(frontendResourcesDir) {
|
||||
into 'static'
|
||||
}
|
||||
}
|
||||
|
||||
bootRun {
|
||||
def debug = System.getenv('REMOTE_DEBUG_ENABLED')
|
||||
if (debug.equals("true")) {
|
||||
@@ -150,4 +163,4 @@ bootRun {
|
||||
|
||||
bootJar {
|
||||
mainClass = 'org.booklore.BookloreApplication'
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user