diff --git a/src/main/java/tech/jhipster/lite/generator/server/springboot/thymeleaf/domain/SpringBootThymeleafModuleFactory.java b/src/main/java/tech/jhipster/lite/generator/server/springboot/thymeleaf/domain/SpringBootThymeleafModuleFactory.java
index 4884d10c0d4..61e0528b427 100644
--- a/src/main/java/tech/jhipster/lite/generator/server/springboot/thymeleaf/domain/SpringBootThymeleafModuleFactory.java
+++ b/src/main/java/tech/jhipster/lite/generator/server/springboot/thymeleaf/domain/SpringBootThymeleafModuleFactory.java
@@ -18,7 +18,7 @@ public JHipsterModule buildModule(JHipsterModuleProperties properties) {
return moduleBuilder(properties)
.javaDependencies()
.addDependency(SPRING_GROUP, artifactId("spring-boot-starter-thymeleaf"))
- .addDependency(groupId("nz.net.ultraq.thymeleaf"), artifactId("thymeleaf-layout-dialect"))
+ .addDependency(javaDependency().groupId("nz.net.ultraq.thymeleaf").artifactId("thymeleaf-layout-dialect").versionSlug("thymeleaf-layout-dialect.version").build())
.and()
.build();
//@formatter:on
diff --git a/src/main/java/tech/jhipster/lite/generator/server/webjars/application/WebjarsApplicationService.java b/src/main/java/tech/jhipster/lite/generator/server/webjars/application/WebjarsApplicationService.java
index 1707ecd6c87..141e3c594cf 100644
--- a/src/main/java/tech/jhipster/lite/generator/server/webjars/application/WebjarsApplicationService.java
+++ b/src/main/java/tech/jhipster/lite/generator/server/webjars/application/WebjarsApplicationService.java
@@ -14,7 +14,15 @@ public WebjarsApplicationService() {
webjarsModuleFactory = new WebjarsModuleFactory();
}
- public JHipsterModule buildWebjarsModule(JHipsterModuleProperties properties) {
- return webjarsModuleFactory.buildModule(properties);
+ public JHipsterModule buildWebjarsLocatorModule(JHipsterModuleProperties properties) {
+ return webjarsModuleFactory.buildWebjarsLocatorModule(properties);
+ }
+
+ public JHipsterModule buildWebjarsHtmxModule(JHipsterModuleProperties properties) {
+ return webjarsModuleFactory.buildWebjarsHtmxModule(properties);
+ }
+
+ public JHipsterModule buildWebjarsAlpineJSModule(JHipsterModuleProperties properties) {
+ return webjarsModuleFactory.buildWebjarsAlpineJSModule(properties);
}
}
diff --git a/src/main/java/tech/jhipster/lite/generator/server/webjars/domain/WebjarsModuleFactory.java b/src/main/java/tech/jhipster/lite/generator/server/webjars/domain/WebjarsModuleFactory.java
index a1f60bae600..73331fa625d 100644
--- a/src/main/java/tech/jhipster/lite/generator/server/webjars/domain/WebjarsModuleFactory.java
+++ b/src/main/java/tech/jhipster/lite/generator/server/webjars/domain/WebjarsModuleFactory.java
@@ -9,15 +9,40 @@
public class WebjarsModuleFactory {
+ private static final String PROPERTIES_FIELD = "properties";
private static final GroupId WEBJARS_GROUP = groupId("org.webjars");
+ private static final GroupId WEBJARS_NPM_GROUP = groupId("org.webjars.npm");
- public JHipsterModule buildModule(JHipsterModuleProperties properties) {
- Assert.notNull("properties", properties);
+ public JHipsterModule buildWebjarsLocatorModule(JHipsterModuleProperties properties) {
+ Assert.notNull(PROPERTIES_FIELD, properties);
//@formatter:off
return moduleBuilder(properties)
.javaDependencies()
- .addDependency(WEBJARS_GROUP, artifactId("webjars-locator"))
+ .addDependency(javaDependency().groupId(WEBJARS_GROUP).artifactId("webjars-locator").versionSlug("webjars-locator.version").build())
+ .and()
+ .build();
+ //@formatter:on
+ }
+
+ public JHipsterModule buildWebjarsHtmxModule(JHipsterModuleProperties properties) {
+ Assert.notNull(PROPERTIES_FIELD, properties);
+ //@formatter:off
+ return moduleBuilder(properties)
+ .javaDependencies()
+ .addDependency(javaDependency().groupId(WEBJARS_NPM_GROUP).artifactId("htmx.org").versionSlug("htmx-webjars.version").build())
+ .and()
+ .build();
+ //@formatter:on
+ }
+
+ public JHipsterModule buildWebjarsAlpineJSModule(JHipsterModuleProperties properties) {
+ Assert.notNull(PROPERTIES_FIELD, properties);
+
+ //@formatter:off
+ return moduleBuilder(properties)
+ .javaDependencies()
+ .addDependency(javaDependency().groupId(WEBJARS_NPM_GROUP).artifactId("alpinejs").versionSlug("alpinejs-webjars.version").build())
.and()
.build();
//@formatter:on
diff --git a/src/main/java/tech/jhipster/lite/generator/server/webjars/infrastructure/primary/WebjarsModuleConfiguration.java b/src/main/java/tech/jhipster/lite/generator/server/webjars/infrastructure/primary/WebjarsModuleConfiguration.java
index b221ca2ae2e..78f26b482c1 100644
--- a/src/main/java/tech/jhipster/lite/generator/server/webjars/infrastructure/primary/WebjarsModuleConfiguration.java
+++ b/src/main/java/tech/jhipster/lite/generator/server/webjars/infrastructure/primary/WebjarsModuleConfiguration.java
@@ -1,7 +1,6 @@
package tech.jhipster.lite.generator.server.webjars.infrastructure.primary;
-import static tech.jhipster.lite.generator.slug.domain.JHLiteModuleSlug.SPRING_BOOT_THYMELEAF;
-import static tech.jhipster.lite.generator.slug.domain.JHLiteModuleSlug.WEBJARS;
+import static tech.jhipster.lite.generator.slug.domain.JHLiteModuleSlug.*;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@@ -13,17 +12,49 @@
@Configuration
class WebjarsModuleConfiguration {
+ private static final String SERVER_TAG = "server";
+ private static final String WEB_TAG = "web";
+ private static final String WEBJARS_GROUP = "WebJars";
+
@Bean
- public JHipsterModuleResource webjarsModule(WebjarsApplicationService webjarsModule) {
+ public JHipsterModuleResource webjarsLocatorModule(WebjarsApplicationService webjarsModule) {
return JHipsterModuleResource
.builder()
- .slug(WEBJARS)
+ .slug(WEBJARS_LOCATOR)
.propertiesDefinition(
JHipsterModulePropertiesDefinition.builder().addBasePackage().addProjectBaseName().addConfigurationFormat().build()
)
- .apiDoc("WebJars", "Add WebJars to the project")
+ .apiDoc(WEBJARS_GROUP, "Add webjars locator to the project")
.organization(JHipsterModuleOrganization.builder().addDependency(SPRING_BOOT_THYMELEAF).build())
- .tags("server", "web")
- .factory(webjarsModule::buildWebjarsModule);
+ .tags(SERVER_TAG, WEB_TAG)
+ .factory(webjarsModule::buildWebjarsLocatorModule);
+ }
+
+ @Bean
+ public JHipsterModuleResource webjarsHtmxModule(WebjarsApplicationService webjarsModule) {
+ return JHipsterModuleResource
+ .builder()
+ .slug(HTMX_WEBJARS)
+ .propertiesDefinition(
+ JHipsterModulePropertiesDefinition.builder().addBasePackage().addProjectBaseName().addConfigurationFormat().build()
+ )
+ .apiDoc(WEBJARS_GROUP, "Add HTMX webjar to the project")
+ .organization(JHipsterModuleOrganization.builder().addDependency(WEBJARS_LOCATOR).build())
+ .tags(SERVER_TAG, WEB_TAG)
+ .factory(webjarsModule::buildWebjarsHtmxModule);
+ }
+
+ @Bean
+ public JHipsterModuleResource webjarsAlpineJSModule(WebjarsApplicationService webjarsModule) {
+ return JHipsterModuleResource
+ .builder()
+ .slug(ALPINE_JS_WEBJARS)
+ .propertiesDefinition(
+ JHipsterModulePropertiesDefinition.builder().addBasePackage().addProjectBaseName().addConfigurationFormat().build()
+ )
+ .apiDoc(WEBJARS_GROUP, "Add alpine.js webjar to the project")
+ .organization(JHipsterModuleOrganization.builder().addDependency(WEBJARS_LOCATOR).build())
+ .tags(SERVER_TAG, WEB_TAG)
+ .factory(webjarsModule::buildWebjarsAlpineJSModule);
}
}
diff --git a/src/main/java/tech/jhipster/lite/generator/slug/domain/JHLiteModuleSlug.java b/src/main/java/tech/jhipster/lite/generator/slug/domain/JHLiteModuleSlug.java
index 3b62dc41be1..dab3fdec7b9 100644
--- a/src/main/java/tech/jhipster/lite/generator/slug/domain/JHLiteModuleSlug.java
+++ b/src/main/java/tech/jhipster/lite/generator/slug/domain/JHLiteModuleSlug.java
@@ -118,7 +118,9 @@ public enum JHLiteModuleSlug implements JHipsterModuleSlugFactory {
SPRINGDOC_OAUTH_2_AUTH_0("springdoc-oauth2-auth0"),
SPRINGDOC_OAUTH_2_OKTA("springdoc-oauth2-okta"),
SPRINGDOC_WEBFLUX_OPENAPI("springdoc-webflux-openapi"),
- WEBJARS("webjars"),
+ WEBJARS_LOCATOR("webjars-locator"),
+ HTMX_WEBJARS("htmx-webjars"),
+ ALPINE_JS_WEBJARS("alpinejs-webjars"),
SVELTE_CORE("svelte-core"),
TYPESCRIPT("typescript"),
VUE_CORE("vue-core"),
diff --git a/src/main/resources/generator/dependencies/pom.xml b/src/main/resources/generator/dependencies/pom.xml
index 723971a7b8c..3d8a63459ca 100644
--- a/src/main/resources/generator/dependencies/pom.xml
+++ b/src/main/resources/generator/dependencies/pom.xml
@@ -51,6 +51,8 @@
4.3.1.0
3.3.0
0.50
+ 1.9.9
+ 3.13.3
@@ -272,6 +274,16 @@
webjars-locator
${webjars-locator.version}
+
+ org.webjars.npm
+ htmx.org
+ ${htmx-webjars.version}
+
+
+ org.webjars.npm
+ alpinejs
+ ${alpinejs-webjars.version}
+
nz.net.ultraq.thymeleaf
thymeleaf-layout-dialect
diff --git a/src/test/features/server/webjars/webjars.feature b/src/test/features/server/webjars/webjars.feature
index f4fc3cacdc3..dde882d4259 100644
--- a/src/test/features/server/webjars/webjars.feature
+++ b/src/test/features/server/webjars/webjars.feature
@@ -5,5 +5,25 @@ Feature: WebJars module
| maven-java |
| spring-boot |
| spring-boot-thymeleaf |
- | webjars |
+ | webjars-locator |
Then I should have "webjars-locator" in "pom.xml"
+
+ Scenario: Should add HTMX webjar
+ When I apply modules to default project
+ | maven-java |
+ | spring-boot |
+ | spring-boot-thymeleaf |
+ | webjars-locator |
+ | htmx-webjars |
+ Then I should have "htmx.org" in "pom.xml"
+
+ Scenario: Should add alpine.js webjar
+ When I apply modules to default project
+ | maven-java |
+ | spring-boot |
+ | spring-boot-thymeleaf |
+ | webjars-locator |
+ | alpinejs-webjars |
+ Then I should have "alpinejs" in "pom.xml"
+
+
diff --git a/src/test/java/tech/jhipster/lite/generator/server/springboot/thymeleaf/domain/SpringBootThymeleafModuleFactoryTest.java b/src/test/java/tech/jhipster/lite/generator/server/springboot/thymeleaf/domain/SpringBootThymeleafModuleFactoryTest.java
index 2921edad299..eedbf657098 100644
--- a/src/test/java/tech/jhipster/lite/generator/server/springboot/thymeleaf/domain/SpringBootThymeleafModuleFactoryTest.java
+++ b/src/test/java/tech/jhipster/lite/generator/server/springboot/thymeleaf/domain/SpringBootThymeleafModuleFactoryTest.java
@@ -42,6 +42,7 @@ void shouldCreateSpringBootThymeleafModule() {
nz.net.ultraq.thymeleaf
thymeleaf-layout-dialect
+ ${thymeleaf-layout-dialect.version}
"""
);
diff --git a/src/test/java/tech/jhipster/lite/generator/server/webjars/domain/WebjarsModuleFactoryTest.java b/src/test/java/tech/jhipster/lite/generator/server/webjars/domain/WebjarsModuleFactoryTest.java
index a00d37c0c5b..3634af3492e 100644
--- a/src/test/java/tech/jhipster/lite/generator/server/webjars/domain/WebjarsModuleFactoryTest.java
+++ b/src/test/java/tech/jhipster/lite/generator/server/webjars/domain/WebjarsModuleFactoryTest.java
@@ -16,14 +16,14 @@ class WebjarsModuleFactoryTest {
private static final WebjarsModuleFactory factory = new WebjarsModuleFactory();
@Test
- void shouldCreateWebjarsModule() {
+ void shouldCreateWebjarsLocatorModule() {
JHipsterModuleProperties properties = JHipsterModulesFixture
.propertiesBuilder(TestFileUtils.tmpDirForTest())
.basePackage("com.jhipster.test")
.projectBaseName("myapp")
.build();
- JHipsterModule module = factory.buildModule(properties);
+ JHipsterModule module = factory.buildWebjarsLocatorModule(properties);
assertThatModuleWithFiles(module, pomFile())
.hasFile("pom.xml")
@@ -32,6 +32,53 @@ void shouldCreateWebjarsModule() {
org.webjars
webjars-locator
+ ${webjars-locator.version}
+
+ """
+ );
+ }
+
+ @Test
+ void shouldCreateHtmxWebjarsModule() {
+ JHipsterModuleProperties properties = JHipsterModulesFixture
+ .propertiesBuilder(TestFileUtils.tmpDirForTest())
+ .basePackage("com.jhipster.test")
+ .projectBaseName("myapp")
+ .build();
+
+ JHipsterModule module = factory.buildWebjarsHtmxModule(properties);
+
+ assertThatModuleWithFiles(module, pomFile())
+ .hasFile("pom.xml")
+ .containing(
+ """
+
+ org.webjars.npm
+ htmx.org
+ ${htmx-webjars.version}
+
+ """
+ );
+ }
+
+ @Test
+ void shouldCreateAlpineJSWebjarsModule() {
+ JHipsterModuleProperties properties = JHipsterModulesFixture
+ .propertiesBuilder(TestFileUtils.tmpDirForTest())
+ .basePackage("com.jhipster.test")
+ .projectBaseName("myapp")
+ .build();
+
+ JHipsterModule module = factory.buildWebjarsAlpineJSModule(properties);
+
+ assertThatModuleWithFiles(module, pomFile())
+ .hasFile("pom.xml")
+ .containing(
+ """
+
+ org.webjars.npm
+ alpinejs
+ ${alpinejs-webjars.version}
"""
);
diff --git a/tests-ci/generate.sh b/tests-ci/generate.sh
index 9c29892c197..95e534197b6 100755
--- a/tests-ci/generate.sh
+++ b/tests-ci/generate.sh
@@ -418,7 +418,10 @@ elif [[ $application == 'thymeleafapp' ]]; then
spring_boot_mvc
sonar_back
- applyModules "spring-boot-thymeleaf"
+ applyModules \
+ "spring-boot-thymeleaf" \
+ "webjars-locator" \
+ "htmx-webjars"
else
echo "*** Unknown configuration..."