Skip to content

Commit

Permalink
Merge pull request #25502 from mshima/spring-boot-dependencies-bom
Browse files Browse the repository at this point in the history
Use spring-boot-dependencies's managed dependencies
  • Loading branch information
DanielFran authored Mar 16, 2024
2 parents 73586fe + aa943c0 commit 7e3cc32
Show file tree
Hide file tree
Showing 12 changed files with 11 additions and 109 deletions.
18 changes: 0 additions & 18 deletions generators/app/__snapshots__/generator.spec.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -467,7 +467,6 @@ exports[`generator - app with default config should match snapshot 1`] = `
],
"javaDependencies": {
"archunit-junit5": "'ARCHUNIT-JUNIT-5-VERSION'",
"awaitility": "'AWAITILITY-VERSION'",
"blockhound-junit-platform": "'BLOCKHOUND-JUNIT-PLATFORM-VERSION'",
"checkstyle": "'CHECKSTYLE-VERSION'",
"checksum-maven-plugin": "'CHECKSUM-MAVEN-PLUGIN-VERSION'",
Expand All @@ -483,17 +482,14 @@ exports[`generator - app with default config should match snapshot 1`] = `
"gradle-liquibase": "'GRADLE-LIQUIBASE-VERSION'",
"gradle-modernizer-plugin": "'GRADLE-MODERNIZER-PLUGIN-VERSION'",
"gradle-sonarqube": "'GRADLE-SONARQUBE-VERSION'",
"h2": "'H-2-VERSION'",
"hazelcast-hibernate53": "'HAZELCAST-HIBERNATE-53-VERSION'",
"hazelcast-spring": "'HAZELCAST-SPRING-VERSION'",
"jackson-databind-nullable": "'JACKSON-DATABIND-NULLABLE-VERSION'",
"jacoco-maven-plugin": "'JACOCO-MAVEN-PLUGIN-VERSION'",
"jaxb-runtime": "'JAXB-RUNTIME-VERSION'",
"jhipster-dependabot": "'JHIPSTER-DEPENDABOT-VERSION'",
"jib-maven-plugin": "'JIB-MAVEN-PLUGIN-VERSION'",
"junit-platform-launcher": "'JUNIT-PLATFORM-LAUNCHER-VERSION'",
"lifecycle-mapping": "'LIFECYCLE-MAPPING-VERSION'",
"liquibase": "'LIQUIBASE-VERSION'",
"mapstruct": "'MAPSTRUCT-VERSION'",
"maven-antrun-plugin": "'MAVEN-ANTRUN-PLUGIN-VERSION'",
"maven-checkstyle-plugin": "'MAVEN-CHECKSTYLE-PLUGIN-VERSION'",
Expand All @@ -518,9 +514,7 @@ exports[`generator - app with default config should match snapshot 1`] = `
"spotless-gradle-plugin": "'SPOTLESS-GRADLE-PLUGIN-VERSION'",
"spotless-maven-plugin": "'SPOTLESS-MAVEN-PLUGIN-VERSION'",
"spring-boot": "'SPRING-BOOT-VERSION'",
"spring-pulsar": "'SPRING-PULSAR-VERSION'",
"typesafe": "'TYPESAFE-VERSION'",
"validation-api": "'VALIDATION-API-VERSION'",
},
"javaPackageSrcDir": "src/main/java/com/mycompany/myapp/",
"javaPackageTestDir": "src/test/java/com/mycompany/myapp/",
Expand Down Expand Up @@ -1038,7 +1032,6 @@ exports[`generator - app with gateway should match snapshot 1`] = `
],
"javaDependencies": {
"archunit-junit5": "'ARCHUNIT-JUNIT-5-VERSION'",
"awaitility": "'AWAITILITY-VERSION'",
"blockhound-junit-platform": "'BLOCKHOUND-JUNIT-PLATFORM-VERSION'",
"checkstyle": "'CHECKSTYLE-VERSION'",
"checksum-maven-plugin": "'CHECKSUM-MAVEN-PLUGIN-VERSION'",
Expand All @@ -1054,17 +1047,14 @@ exports[`generator - app with gateway should match snapshot 1`] = `
"gradle-liquibase": "'GRADLE-LIQUIBASE-VERSION'",
"gradle-modernizer-plugin": "'GRADLE-MODERNIZER-PLUGIN-VERSION'",
"gradle-sonarqube": "'GRADLE-SONARQUBE-VERSION'",
"h2": "'H-2-VERSION'",
"hazelcast-hibernate53": "'HAZELCAST-HIBERNATE-53-VERSION'",
"hazelcast-spring": "'HAZELCAST-SPRING-VERSION'",
"jackson-databind-nullable": "'JACKSON-DATABIND-NULLABLE-VERSION'",
"jacoco-maven-plugin": "'JACOCO-MAVEN-PLUGIN-VERSION'",
"jaxb-runtime": "'JAXB-RUNTIME-VERSION'",
"jhipster-dependabot": "'JHIPSTER-DEPENDABOT-VERSION'",
"jib-maven-plugin": "'JIB-MAVEN-PLUGIN-VERSION'",
"junit-platform-launcher": "'JUNIT-PLATFORM-LAUNCHER-VERSION'",
"lifecycle-mapping": "'LIFECYCLE-MAPPING-VERSION'",
"liquibase": "'LIQUIBASE-VERSION'",
"mapstruct": "'MAPSTRUCT-VERSION'",
"maven-antrun-plugin": "'MAVEN-ANTRUN-PLUGIN-VERSION'",
"maven-checkstyle-plugin": "'MAVEN-CHECKSTYLE-PLUGIN-VERSION'",
Expand All @@ -1089,9 +1079,7 @@ exports[`generator - app with gateway should match snapshot 1`] = `
"spotless-gradle-plugin": "'SPOTLESS-GRADLE-PLUGIN-VERSION'",
"spotless-maven-plugin": "'SPOTLESS-MAVEN-PLUGIN-VERSION'",
"spring-boot": "'SPRING-BOOT-VERSION'",
"spring-pulsar": "'SPRING-PULSAR-VERSION'",
"typesafe": "'TYPESAFE-VERSION'",
"validation-api": "'VALIDATION-API-VERSION'",
},
"javaPackageSrcDir": "src/main/java/com/mycompany/myapp/",
"javaPackageTestDir": "src/test/java/com/mycompany/myapp/",
Expand Down Expand Up @@ -1609,7 +1597,6 @@ exports[`generator - app with microservice should match snapshot 1`] = `
],
"javaDependencies": {
"archunit-junit5": "'ARCHUNIT-JUNIT-5-VERSION'",
"awaitility": "'AWAITILITY-VERSION'",
"blockhound-junit-platform": "'BLOCKHOUND-JUNIT-PLATFORM-VERSION'",
"checkstyle": "'CHECKSTYLE-VERSION'",
"checksum-maven-plugin": "'CHECKSUM-MAVEN-PLUGIN-VERSION'",
Expand All @@ -1625,17 +1612,14 @@ exports[`generator - app with microservice should match snapshot 1`] = `
"gradle-liquibase": "'GRADLE-LIQUIBASE-VERSION'",
"gradle-modernizer-plugin": "'GRADLE-MODERNIZER-PLUGIN-VERSION'",
"gradle-sonarqube": "'GRADLE-SONARQUBE-VERSION'",
"h2": "'H-2-VERSION'",
"hazelcast-hibernate53": "'HAZELCAST-HIBERNATE-53-VERSION'",
"hazelcast-spring": "'HAZELCAST-SPRING-VERSION'",
"jackson-databind-nullable": "'JACKSON-DATABIND-NULLABLE-VERSION'",
"jacoco-maven-plugin": "'JACOCO-MAVEN-PLUGIN-VERSION'",
"jaxb-runtime": "'JAXB-RUNTIME-VERSION'",
"jhipster-dependabot": "'JHIPSTER-DEPENDABOT-VERSION'",
"jib-maven-plugin": "'JIB-MAVEN-PLUGIN-VERSION'",
"junit-platform-launcher": "'JUNIT-PLATFORM-LAUNCHER-VERSION'",
"lifecycle-mapping": "'LIFECYCLE-MAPPING-VERSION'",
"liquibase": "'LIQUIBASE-VERSION'",
"mapstruct": "'MAPSTRUCT-VERSION'",
"maven-antrun-plugin": "'MAVEN-ANTRUN-PLUGIN-VERSION'",
"maven-checkstyle-plugin": "'MAVEN-CHECKSTYLE-PLUGIN-VERSION'",
Expand All @@ -1660,9 +1644,7 @@ exports[`generator - app with microservice should match snapshot 1`] = `
"spotless-gradle-plugin": "'SPOTLESS-GRADLE-PLUGIN-VERSION'",
"spotless-maven-plugin": "'SPOTLESS-MAVEN-PLUGIN-VERSION'",
"spring-boot": "'SPRING-BOOT-VERSION'",
"spring-pulsar": "'SPRING-PULSAR-VERSION'",
"typesafe": "'TYPESAFE-VERSION'",
"validation-api": "'VALIDATION-API-VERSION'",
},
"javaPackageSrcDir": "src/main/java/com/mycompany/myapp/",
"javaPackageTestDir": "src/test/java/com/mycompany/myapp/",
Expand Down
9 changes: 3 additions & 6 deletions generators/liquibase/generator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ export default class LiquibaseGenerator extends BaseEntityChangesGenerator {
properties: [
{ property: 'liquibase-plugin.hibernate-dialect' },
{ property: 'liquibase-plugin.driver' },
{ property: 'h2.version', value: application.javaDependencies.h2 },
{ property: 'h2.version', value: application.springBootDependencies!.h2 },
{ inProfile: 'dev', property: 'liquibase-plugin.hibernate-dialect', value: applicationAny.devHibernateDialect },
{ inProfile: 'prod', property: 'liquibase-plugin.hibernate-dialect', value: applicationAny.prodHibernateDialect },
{ inProfile: 'dev', property: 'liquibase-plugin.driver', value: applicationAny.devJdbcDriver },
Expand All @@ -355,7 +355,7 @@ export default class LiquibaseGenerator extends BaseEntityChangesGenerator {
properties: [
{ inProfile: 'no-liquibase', property: 'profile.no-liquibase', value: ',no-liquibase' },
{ property: 'profile.no-liquibase' },
{ property: 'liquibase.version', value: application.javaDependencies.liquibase },
{ property: 'liquibase.version', value: application.springBootDependencies!.liquibase },
{ property: 'liquibase-plugin.url' },
{ property: 'liquibase-plugin.username' },
{ property: 'liquibase-plugin.password' },
Expand Down Expand Up @@ -446,10 +446,7 @@ export default class LiquibaseGenerator extends BaseEntityChangesGenerator {

source.addGradleProperty?.({ property: 'liquibaseTaskPrefix', value: 'liquibase' });
source.addGradleProperty?.({ property: 'liquibasePluginVersion', value: application.javaDependencies['gradle-liquibase'] });
source.addGradleProperty?.({ property: 'liquibaseVersion', value: application.javaDependencies.liquibase });
if (application.databaseTypeSql && !application.reactive) {
source.addGradleProperty?.({ property: 'liquibaseHibernate6Version', value: application.javaDependencies.liquibase });
}
source.addGradleProperty?.({ property: 'liquibaseVersion', value: application.springBootDependencies!.liquibase });

source.applyFromGradle?.({ script: 'gradle/liquibase.gradle' });
source.addGradlePlugin?.({ id: 'org.liquibase.gradle' });
Expand Down
5 changes: 0 additions & 5 deletions generators/liquibase/support/maven-plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,6 @@ export default function mavenPluginContent({
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
<version>\${spring-boot.version}</version>
</dependency>
<dependency>
<groupId>jakarta.validation</groupId>
<artifactId>jakarta.validation-api</artifactId>
<version>\${validation-api.version}</version>
</dependency>` : ''}${devDatabaseTypeH2Any? `
<dependency>
<groupId>com.h2database</groupId>
Expand Down
14 changes: 2 additions & 12 deletions generators/liquibase/templates/gradle/liquibase.gradle.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ dependencies {
liquibaseRuntime "info.picocli:picocli:<%- javaDependencies.picocli %>"
<%_ if (databaseTypeSql && !reactive) { _%>
liquibaseRuntime "org.liquibase.ext:liquibase-hibernate6:${liquibaseHibernate6Version}"
liquibaseRuntime "org.liquibase.ext:liquibase-hibernate6:${liquibaseVersion}"
<%_ } _%>
<%_ if (databaseTypeSql) { _%>
<%_ if (prodDatabaseType !== devDatabaseType) { _%>
Expand All @@ -26,7 +26,7 @@ dependencies {
<%_ } _%>
<%_ if (prodDatabaseTypeMssql) { _%>
liquibaseRuntime "com.microsoft.sqlserver:mssql-jdbc"
liquibaseRuntime "org.liquibase.ext:liquibase-mssql:<%- javaDependencies.liquibase %>"
liquibaseRuntime "org.liquibase.ext:liquibase-mssql:${liquibaseVersion}"
<%_ } _%>
<%_ if (prodDatabaseTypeOracle) { _%>
liquibaseRuntime "com.oracle.database.jdbc:ojdbc8"
Expand Down Expand Up @@ -93,16 +93,6 @@ liquibase {

liquibaseDiff.dependsOn compileJava
liquibaseDiffChangelog.dependsOn compileJava

configurations {
all {
resolutionStrategy {
// Inherited version from Spring Boot can't be used because of regressions:
// To be removed as soon as spring-boot use the same version
force 'org.liquibase:liquibase-core:<%- javaDependencies.liquibase %>'
}
}
}
<%_ if (backendTypeSpringBoot) { _%>
ext {
Expand Down
36 changes: 0 additions & 36 deletions generators/server/resources/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,23 +9,17 @@
<properties>
<!-- Dependency versions -->
<archunit-junit5.version>1.2.1</archunit-junit5.version>
<awaitility.version>4.2.0</awaitility.version>
<blockhound-junit-platform.version>1.0.8.RELEASE</blockhound-junit-platform.version>
<commons-beanutils.version>1.9.4</commons-beanutils.version>
<gatling.version>3.10.4</gatling.version>
<h2.version>2.2.224</h2.version>
<hazelcast-hibernate53.version>5.1.0</hazelcast-hibernate53.version>
<hazelcast-spring.version>5.3.6</hazelcast-spring.version>
<jackson-databind-nullable.version>0.2.6</jackson-databind-nullable.version>
<jaxb-runtime.version>4.0.5</jaxb-runtime.version>
<junit-platform-launcher.version>1.10.2</junit-platform-launcher.version>
<liquibase.version>4.26.0</liquibase.version>
<mapstruct.version>1.5.5.Final</mapstruct.version>
<micrometer-context-propagation.version>1.1.1</micrometer-context-propagation.version>
<picocli.version>4.7.5</picocli.version>
<spring-pulsar.version>0.2.0</spring-pulsar.version>
<typesafe.version>1.4.3</typesafe.version>
<validation-api.version>3.0.2</validation-api.version>

<!-- Plugin versions -->
<checkstyle.version>10.14.1</checkstyle.version>
Expand Down Expand Up @@ -88,46 +82,21 @@
<artifactId>gatling-charts-highcharts</artifactId>
<version>${gatling.version}</version>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<version>${h2.version}</version>
</dependency>
<dependency>
<groupId>io.projectreactor.tools</groupId>
<artifactId>blockhound-junit-platform</artifactId>
<version>${blockhound-junit-platform.version}</version>
</dependency>
<dependency>
<groupId>jakarta.validation</groupId>
<artifactId>jakarta.validation-api</artifactId>
<version>${validation-api.version}</version>
</dependency>
<dependency>
<groupId>io.micrometer</groupId>
<artifactId>context-propagation</artifactId>
<version>${micrometer-context-propagation.version}</version>
</dependency>
<dependency>
<groupId>org.awaitility</groupId>
<artifactId>awaitility</artifactId>
<version>${awaitility.version}</version>
</dependency>
<dependency>
<groupId>org.glassfish.jaxb</groupId>
<artifactId>jaxb-runtime</artifactId>
<version>${jaxb-runtime.version}</version>
</dependency>
<dependency>
<groupId>org.junit.platform</groupId>
<artifactId>junit-platform-launcher</artifactId>
<version>${junit-platform-launcher.version}</version>
</dependency>
<dependency>
<groupId>org.liquibase</groupId>
<artifactId>liquibase-core</artifactId>
<version>${liquibase.version}</version>
</dependency>
<dependency>
<groupId>org.mapstruct</groupId>
<artifactId>mapstruct</artifactId>
Expand All @@ -138,11 +107,6 @@
<artifactId>picocli</artifactId>
<version>${picocli.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.pulsar</groupId>
<artifactId>spring-pulsar-spring-cloud-stream-binder</artifactId>
<version>${spring-pulsar.version}</version>
</dependency>
<dependency>
<groupId>org.openapitools</groupId>
<artifactId>jackson-databind-nullable</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion generators/server/templates/build.gradle.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ dependencies {
<%_ } _%>
implementation "org.apache.commons:commons-lang3"
<%_ if (searchEngineElasticsearch) { _%>
testImplementation "org.awaitility:awaitility:${awaitilityVersion}"
testImplementation "org.awaitility:awaitility"
<%_ } _%>
<%_ if (databaseTypeSql && !reactive) { _%>
implementation "org.hibernate.orm:hibernate-core"
Expand Down
6 changes: 0 additions & 6 deletions generators/server/templates/gradle.properties.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,6 @@ blockhoundJunitPlatformVersion=<%- javaDependencies['blockhound-junit-platform']
junitPlatformLauncherVersion=<%- javaDependencies['junit-platform-launcher'] %>
<%_ } _%>

<%_ if (databaseTypeSql) { _%>
jaxbRuntimeVersion=<%- javaDependencies['jaxb-runtime'] %>
<%_ } _%>
<%_ if (databaseTypeCassandra) { _%>
# The cassandra driver version should match the one managed by
# https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-dependencies/<%- javaDependencies['spring-boot'] %>
Expand All @@ -62,9 +59,6 @@ openapiPluginVersion=<%- javaDependencies['openapi-generator-maven-plugin'] %>
gradleEnterprisePluginVersion=<%- javaDependencies['gradle-enterprise'] %>
gradleCommonCustomUserDataPluginVersion=<%- javaDependencies['common-custom-user-data-gradle-plugin'] %>
<%_ } _%>
<%_ if (searchEngineElasticsearch) { _%>
awaitilityVersion=<%- javaDependencies.awaitility %>
<%_ } _%>

# jhipster-needle-gradle-property - JHipster will add additional properties here

Expand Down
10 changes: 1 addition & 9 deletions generators/spring-cloud-stream/generators/pulsar/generator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,7 @@ export default class PulsarGenerator extends BaseApplicationGenerator {
},
applyPulsarGradleConventionPlugin({ source, application }) {
if (application.buildToolGradle) {
const { javaDependencies } = application;
source.addGradlePlugin?.({ id: 'jhipster.pulsar-conventions' });
source.addGradleDependencyCatalogVersion?.({ name: 'pulsar-spring', version: javaDependencies?.['spring-pulsar'] });
source.addGradleBuildSrcDependencyCatalogVersion?.({ name: 'pulsar-spring', version: javaDependencies?.['spring-pulsar'] });
}
},
addPulsarMavenDependencies({ application, source }) {
Expand All @@ -72,12 +69,7 @@ export default class PulsarGenerator extends BaseApplicationGenerator {
properties: [{ property: 'spring-pulsar.version', value: javaDependencies?.['spring-pulsar'] }],
dependencies: [
{ groupId: 'org.springframework.cloud', artifactId: 'spring-cloud-stream' },
{
groupId: 'org.springframework.pulsar',
artifactId: 'spring-pulsar-spring-cloud-stream-binder',
// eslint-disable-next-line no-template-curly-in-string
version: '${spring-pulsar.version}',
},
{ groupId: 'org.springframework.cloud', artifactId: 'spring-cloud-stream-binder-pulsar' },
{ groupId: 'org.testcontainers', artifactId: 'junit-jupiter', scope: 'test' },
{ groupId: 'org.testcontainers', artifactId: 'testcontainers', scope: 'test' },
{ groupId: 'org.testcontainers', artifactId: 'pulsar', scope: 'test' },
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
dependencies {
implementation "org.springframework.cloud:spring-cloud-stream"
implementation ("org.springframework.pulsar:spring-pulsar-spring-cloud-stream-binder:${libs.versions.spring.pulsar.get()}") {
exclude group: 'org.springframework.boot', module: 'spring-boot-starter'
}
implementation "org.springframework.cloud:spring-cloud-stream-binder-pulsar"
testImplementation "org.testcontainers:junit-jupiter"
testImplementation "org.testcontainers:pulsar"
testImplementation "org.testcontainers:testcontainers"
Expand Down
7 changes: 0 additions & 7 deletions generators/spring-data-elasticsearch/generator.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,6 @@ export default class ElasticsearchGenerator extends BaseApplicationGenerator {
},
addDependencies({ application, source }) {
if (application.buildToolMaven) {
source.addMavenProperty?.({
property: 'awaitility.version',
value: application.javaDependencies.awaitility,
});

source.addMavenDependency?.([
{
groupId: 'org.springframework.boot',
Expand All @@ -94,8 +89,6 @@ export default class ElasticsearchGenerator extends BaseApplicationGenerator {
{
groupId: 'org.awaitility',
artifactId: 'awaitility',
// eslint-disable-next-line no-template-curly-in-string
version: '${awaitility.version}',
scope: 'test',
},
{
Expand Down
2 changes: 1 addition & 1 deletion generators/spring-data-relational/generator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ export default class SqlGenerator extends BaseApplicationGenerator<SpringBootGen
const { reactive, javaDependencies, packageFolder, springBootDependencies } = application;
const applicationAny = application as any;
const { prodDatabaseType } = applicationAny;
source.addMavenDefinition?.(getCommonMavenDefinition({ javaDependencies }));
source.addMavenDefinition?.(getCommonMavenDefinition({ springBootDependencies }));

if (reactive) {
source.addMavenDefinition?.(getReactiveMavenDefinition({ javaDependencies }));
Expand Down
7 changes: 2 additions & 5 deletions generators/spring-data-relational/internal/dependencies.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,8 @@ const databaseArtifactForDB: Record<string, DatabaseArtifact> = {

export const getDatabaseDriverForDatabase = (databaseType: string) => databaseArtifactForDB[databaseType];

export const getCommonMavenDefinition = ({ javaDependencies }: { javaDependencies: Record<string, string> }) => ({
properties: [
{ property: 'jaxb-runtime.version', value: javaDependencies['jaxb-runtime'] },
{ property: 'validation-api.version', value: javaDependencies['validation-api'] },
],
export const getCommonMavenDefinition = ({ springBootDependencies }: { springBootDependencies: Record<string, string> }) => ({
properties: [{ property: 'jaxb-runtime.version', value: springBootDependencies['glassfish-jaxb'] }],
dependencies: [
{ groupId: 'com.zaxxer', artifactId: 'HikariCP' },
{ groupId: 'com.fasterxml.jackson.module', artifactId: 'jackson-module-jaxb-annotations' },
Expand Down

0 comments on commit 7e3cc32

Please sign in to comment.