From 3ab5a12d973a0160fbf17be3612c0323cbb7d4ef Mon Sep 17 00:00:00 2001 From: Yannick Lamprecht Date: Thu, 26 Sep 2024 00:16:28 +0200 Subject: [PATCH 1/3] add webjars locator dependencies and configure resource chain --- app/build.gradle.kts | 2 ++ .../com/github/devcordde/pluginjamsystem/conf/WebConfig.java | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 27270ef..8c368e9 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -35,6 +35,8 @@ dependencies { implementation("org.thymeleaf.extras:thymeleaf-extras-springsecurity6") implementation("org.springframework.boot:spring-boot-starter-oauth2-client") implementation("com.google.code.findbugs:jsr305:3.0.2") + implementation("org.webjars:webjars-locator:0.52") + implementation("org.webjars:webjars-locator-core:0.59") compileOnly("org.springframework.boot:spring-boot-configuration-processor") annotationProcessor("org.springframework.boot:spring-boot-configuration-processor") diff --git a/app/src/main/java/com/github/devcordde/pluginjamsystem/conf/WebConfig.java b/app/src/main/java/com/github/devcordde/pluginjamsystem/conf/WebConfig.java index 39ccf2d..c8032a3 100644 --- a/app/src/main/java/com/github/devcordde/pluginjamsystem/conf/WebConfig.java +++ b/app/src/main/java/com/github/devcordde/pluginjamsystem/conf/WebConfig.java @@ -32,6 +32,10 @@ public WebConfig(@Qualifier("user-resolver") HandlerMethodArgumentResolver userA public void addResourceHandlers(ResourceHandlerRegistry registry) { registry.addResourceHandler("/**") .addResourceLocations(CLASSPATH_RESOURCE_LOCATIONS); + registry + .addResourceHandler("/webjars/**") + .addResourceLocations("/webjars/") + .resourceChain(true); } @Override From 90fe1537e21d24856cfe8c0a03eb80dfc3efaeb0 Mon Sep 17 00:00:00 2001 From: Yannick Lamprecht Date: Thu, 26 Sep 2024 00:30:35 +0200 Subject: [PATCH 2/3] migrate frontend dependencies to webjars --- app/build.gradle.kts | 13 +++++++++++++ app/src/main/resources/templates/index.html | 11 +++++------ 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 8c368e9..ea292f1 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -35,9 +35,22 @@ dependencies { implementation("org.thymeleaf.extras:thymeleaf-extras-springsecurity6") implementation("org.springframework.boot:spring-boot-starter-oauth2-client") implementation("com.google.code.findbugs:jsr305:3.0.2") + implementation("org.webjars:webjars-locator:0.52") implementation("org.webjars:webjars-locator-core:0.59") + runtimeOnly("org.webjars.npm:vue:2.7.16") { + exclude(group = "org.webjars.npm", module = "vue__compiler-sfc") + } + runtimeOnly("org.webjars.npm:vuetify:2.7.0") + runtimeOnly("org.webjars.npm:vue-router:3.5.3") + implementation("org.webjars:material-design-icons:4.0.0") + + + + + + compileOnly("org.springframework.boot:spring-boot-configuration-processor") annotationProcessor("org.springframework.boot:spring-boot-configuration-processor") diff --git a/app/src/main/resources/templates/index.html b/app/src/main/resources/templates/index.html index 7517c6f..2be67a7 100644 --- a/app/src/main/resources/templates/index.html +++ b/app/src/main/resources/templates/index.html @@ -4,16 +4,15 @@ Title - - + + - - - - + + +
From 4d932759196214b7d878f263adcbbbf0619f641d Mon Sep 17 00:00:00 2001 From: Yannick Lamprecht Date: Thu, 26 Sep 2024 01:30:10 +0200 Subject: [PATCH 3/3] migrating to version catalog --- app/build.gradle.kts | 49 ++++++--------------- app/gradle/libs.versions.toml | 80 +++++++++++++++++++++++++++++++++++ 2 files changed, 93 insertions(+), 36 deletions(-) create mode 100644 app/gradle/libs.versions.toml diff --git a/app/build.gradle.kts b/app/build.gradle.kts index ea292f1..1cd9ff8 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -1,8 +1,8 @@ plugins { - id("org.springframework.boot") version "3.3.4" - id("io.spring.dependency-management") version "1.1.6" + alias(libs.plugins.spring.boot) + alias(libs.plugins.spring.dependency.management) java - id("com.github.ben-manes.versions") version "0.51.0" + alias(libs.plugins.dependency.version.checker) } group = "com.github.devcordde" @@ -19,47 +19,24 @@ repositories { mavenCentral() } -dependencyManagement { - imports { - mavenBom("org.springframework.boot:spring-boot-dependencies:3.3.4") - } -} - dependencies { - implementation("org.springframework.boot:spring-boot-starter-web") - implementation("org.springframework.boot:spring-boot-starter-webflux") - implementation("org.springframework.boot:spring-boot-starter-actuator") - implementation("org.springframework.boot:spring-boot-starter-data-jpa") - implementation("org.springframework.boot:spring-boot-starter-security") - implementation("org.springframework.boot:spring-boot-starter-thymeleaf") - implementation("org.thymeleaf.extras:thymeleaf-extras-springsecurity6") - implementation("org.springframework.boot:spring-boot-starter-oauth2-client") - implementation("com.google.code.findbugs:jsr305:3.0.2") + implementation(platform(libs.spring.boot.dependencies)) + implementation(libs.bundles.spring.boot.starter) + implementation(libs.find.bugs) - implementation("org.webjars:webjars-locator:0.52") - implementation("org.webjars:webjars-locator-core:0.59") + implementation(libs.bundles.webjars.locator) - runtimeOnly("org.webjars.npm:vue:2.7.16") { + runtimeOnly(libs.bundles.webjars.dependencies) { exclude(group = "org.webjars.npm", module = "vue__compiler-sfc") } - runtimeOnly("org.webjars.npm:vuetify:2.7.0") - runtimeOnly("org.webjars.npm:vue-router:3.5.3") - implementation("org.webjars:material-design-icons:4.0.0") - - - - - - compileOnly("org.springframework.boot:spring-boot-configuration-processor") - annotationProcessor("org.springframework.boot:spring-boot-configuration-processor") + compileOnly(libs.spring.boot.configuration.processors) + annotationProcessor(libs.spring.boot.configuration.processors) - developmentOnly("org.springframework.boot:spring-boot-devtools") - runtimeOnly("com.h2database:h2") - runtimeOnly("org.postgresql:postgresql") + developmentOnly(libs.spring.boot.devtools) + runtimeOnly(libs.bundles.databases) - testImplementation("org.springframework.boot:spring-boot-starter-test") - testImplementation("org.springframework.security:spring-security-test") + testImplementation(libs.bundles.spring.test) } tasks { diff --git a/app/gradle/libs.versions.toml b/app/gradle/libs.versions.toml new file mode 100644 index 0000000..9e2ae22 --- /dev/null +++ b/app/gradle/libs.versions.toml @@ -0,0 +1,80 @@ +[versions] + + +spring-dependency-management = "1.1.6" +dependency-version-checker = "0.51.0" + + +spring-boot = "3.3.4" +jsr = "3.0.2" + +webjars-locator = "0.52" +webjars-locator-core = "0.59" + +vue = "2.7.16" +vue-router = "3.5.3" +vuetify = "2.7.0" +material-design-icons = "4.0.0" + + +[libraries] + +find-bugs = { group = "com.google.code.findbugs", name = "jsr305", version.ref = "jsr" } + +webjars-locator = { group = "org.webjars", name = "webjars-locator", version.ref = "webjars-locator" } +webjars-locator-core = { group = "org.webjars", name = "webjars-locator-core", version.ref = "webjars-locator-core" } + +vue = { group = "org.webjars.npm", name = "vue", version.ref = "vue" } +vuetify = { group = "org.webjars.npm", name = "vuetify", version.ref = "vuetify" } +vue-router = { group = "org.webjars.npm", name = "vue-router", version.ref = "vue-router" } +material-icons = { group = "org.webjars", name = "material-design-icons", version.ref = "material-design-icons" } + +spring-boot-dependencies = { group = "org.springframework.boot", name = "spring-boot-dependencies", version.ref = "spring-boot" } + +spring-boot-starter-web = { group = "org.springframework.boot", name = "spring-boot-starter-web" } +spring-boot-starter-webflux = { group = "org.springframework.boot", name = "spring-boot-starter-webflux" } +spring-boot-starter-actuator = { group = "org.springframework.boot", name = "spring-boot-starter-actuator" } +spring-boot-starter-data-jpa = { group = "org.springframework.boot", name = "spring-boot-starter-data-jpa" } +spring-boot-starter-security = { group = "org.springframework.boot", name = "spring-boot-starter-security" } +spring-boot-starter-thymeleaf = { group = "org.springframework.boot", name = "spring-boot-starter-thymeleaf" } +spring-boot-starter-oauth2-client = { group = "org.springframework.boot", name = "spring-boot-starter-oauth2-client" } + +thymeleaf-extras-springsecurity = { group = "org.thymeleaf.extras", name = "thymeleaf-extras-springsecurity6" } + +h2 = { group = "com.h2database", name = "h2"} +postgresql = { group = "org.postgresql", name = "postgresql"} + +spring-boot-configuration-processors = { group = "org.springframework.boot", name = "spring-boot-configuration-processor" } + +spring-boot-devtools = { group = "org.springframework.boot", name = "spring-boot-devtools"} + + +spring-boot-starter-test = { group = "org.springframework.boot", name = "spring-boot-starter-test"} +spring-security-test = { group = "org.springframework.security", name = "spring-security-test"} + + +[bundles] +spring-boot-starter = [ + "spring-boot-starter-actuator", + "spring-boot-starter-data-jpa", + "spring-boot-starter-oauth2-client", + "spring-boot-starter-security", + "spring-boot-starter-thymeleaf", + "spring-boot-starter-web", + "spring-boot-starter-webflux", + "thymeleaf-extras-springsecurity" +] + +databases = [ "h2", "postgresql"] + +spring-test = ["spring-boot-starter-test", "spring-security-test"] + +webjars-locator = ["webjars-locator", "webjars-locator-core"] +webjars-dependencies = ["vue-router", "vuetify", "vue", "material-icons"] + + +[plugins] + +spring-boot = { id = "org.springframework.boot", version.ref = "spring-boot" } +spring-dependency-management = { id = "io.spring.dependency-management", version.ref = "spring-dependency-management" } +dependency-version-checker = { id = "com.github.ben-manes.versions", version.ref = "dependency-version-checker" }