diff --git a/package-lock.json b/package-lock.json index 6819c79..e07837c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -6258,9 +6258,9 @@ } }, "node_modules/vite": { - "version": "5.0.11", - "resolved": "https://registry.npmjs.org/vite/-/vite-5.0.11.tgz", - "integrity": "sha512-XBMnDjZcNAw/G1gEiskiM1v6yzM4GE5aMGvhWTlHAYYhxb7S3/V1s3m2LDHa8Vh6yIWYYB0iJwsEaS523c4oYA==", + "version": "5.0.12", + "resolved": "https://registry.npmjs.org/vite/-/vite-5.0.12.tgz", + "integrity": "sha512-4hsnEkG3q0N4Tzf1+t6NdN9dg/L3BM+q8SWgbSPnJvrgH2kgdyzfVJwbR1ic69/4uMJJ/3dqDZZE5/WwqW8U1w==", "dev": true, "dependencies": { "esbuild": "^0.19.3", diff --git a/src/generator/spring/template/build.gradle.kts.txt b/src/generator/spring/template/build.gradle.kts.txt index fc98368..24e1c0e 100644 --- a/src/generator/spring/template/build.gradle.kts.txt +++ b/src/generator/spring/template/build.gradle.kts.txt @@ -189,24 +189,24 @@ spotless { } kotlinGradle { target("*.gradle.kts") // default target for kotlinGradle + ktlint("1.1.1").editorConfigOverride(mapOf("indent_size" to 4, "max_line_length" to 120)) toggleOffOn("formatter:off", "formatter:on") - ktlint("0.50.1").editorConfigOverride(mapOf("indent_size" to 4, "max_line_length" to 120)) indentWithSpaces(4) + endWithNewline() trimTrailingWhitespace() } {%- if javaSelected -%} java { - palantirJavaFormat() target("src/*/java/**/*.java") - palantirJavaFormat('2.39.0').style("AOSP") + palantirJavaFormat("2.39.0").style("AOSP") removeUnusedImports() toggleOffOn("formatter:off", "formatter:on") } {%- else -%} kotlin { - ktlint("0.47.1").editorConfigOverride(mapOf("indent_size" to 4, "max_line_length" to 120)) - target("src/*/kotlin/**/*.kt") + ktlint("1.1.1").editorConfigOverride(mapOf("indent_size" to 4, "max_line_length" to 120)) toggleOffOn("formatter:off", "formatter:on") + target("src/*/kotlin/**/*.kt") indentWithSpaces(4) endWithNewline() trimTrailingWhitespace() diff --git a/src/generator/spring/template/pom.xml.txt b/src/generator/spring/template/pom.xml.txt index 1b17ed2..b994cc8 100644 --- a/src/generator/spring/template/pom.xml.txt +++ b/src/generator/spring/template/pom.xml.txt @@ -1,454 +1,477 @@ - 4.0.0 - - org.springframework.boot - spring-boot-starter-parent - 3.2.1 - - - {{ metadata.group }} - {{ metadata.artifact }} - 0.0.1-SNAPSHOT - {{ metadata.name }} - {{ metadata.description | strip | strip_html | truncate: 512 }} - - {{ jdkSourceCompatibility }} - {%- if kotlinSelected -%} - {{ kotlinPlugin }} - {%- endif -%} - {%- if haveSpringCloudDependency -%} - {{ springCloudVersion }} - {%- endif -%} - {%- if haveSpringShellDependency -%} - {{ springShellVersion }} - {%- endif -%} - {%- if haveTimeFoldSolverDependency -%} - 1.6.0 - {%- endif -%} - - - {%- if includeActuatorExplicitly -%} - - org.springframework.boot - spring-boot-starter-actuator - - {%- endif -%} - {%- if kotlinSelected -%} - - org.jetbrains.kotlin - kotlin-reflect - - - org.jetbrains.kotlin - kotlin-stdlib - - {%- if dependenciesIds contains "web" or dependenciesIds contains "webflux" -%} - - com.fasterxml.jackson.module - jackson-module-kotlin - - {%- endif -%} - {%- if dependenciesIds contains "webflux" or dependenciesIds contains "data-r2dbc" or dependenciesIds contains "data-redis-reactive" or dependenciesIds contains "rsocket" -%} - - io.projectreactor.kotlin - reactor-kotlin-extensions - - - org.jetbrains.kotlinx - kotlinx-coroutines-reactor - - {%- endif -%} - {%- endif -%} - {%- for dependency in dependencies -%} - - {{ dependency.groupId }} - {{ dependency.artifactId }} - - {%- if dependency.id == "security" and dependenciesIds contains "thymeleaf" -%} - - org.thymeleaf.extras - thymeleaf-extras-springsecurity6 - - {%- endif -%} - {%- else -%} - - org.springframework.boot - spring-boot-starter - - {%- if includeActuatorExplicitly == false -%} - - org.springframework.boot - spring-boot-starter - + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> + 4.0.0 + + org.springframework.boot + spring-boot-starter-parent + 3.2.1 + + + {{ metadata.group }} + {{ metadata.artifact }} + 0.0.1-SNAPSHOT + {{ metadata.name }} + {{ metadata.description | strip | strip_html | truncate: 512 }} + + {{ jdkSourceCompatibility }} + {%- if kotlinSelected -%} + {{ kotlinPlugin }} + {%- endif -%} + {%- if haveSpringCloudDependency -%} + {{ springCloudVersion }} + {%- endif -%} + {%- if haveSpringShellDependency -%} + {{ springShellVersion }} + {%- endif -%} + {%- if haveTimeFoldSolverDependency -%} + 1.6.0 + {%- endif -%} + + + {%- if includeActuatorExplicitly -%} + + org.springframework.boot + spring-boot-starter-actuator + + {%- endif -%} + {%- if kotlinSelected -%} + + org.jetbrains.kotlin + kotlin-reflect + + + org.jetbrains.kotlin + kotlin-stdlib + + {%- if dependenciesIds contains "web" or dependenciesIds contains "webflux" -%} + + com.fasterxml.jackson.module + jackson-module-kotlin + + {%- endif -%} + {%- if dependenciesIds contains "webflux" or dependenciesIds contains "data-r2dbc" or dependenciesIds contains "data-redis-reactive" or dependenciesIds contains "rsocket" -%} + + io.projectreactor.kotlin + reactor-kotlin-extensions + + + org.jetbrains.kotlinx + kotlinx-coroutines-reactor + + {%- endif -%} + {%- endif -%} + {%- for dependency in dependencies -%} + + {{ dependency.groupId }} + {{ dependency.artifactId }} + + {%- if dependency.id == "security" and dependenciesIds contains "thymeleaf" -%} + + org.thymeleaf.extras + thymeleaf-extras-springsecurity6 + + {%- endif -%} + {%- else -%} + + org.springframework.boot + spring-boot-starter + + {%- if includeActuatorExplicitly == false -%} + + org.springframework.boot + spring-boot-starter + + {%- endif -%} + {%- endfor -%} + {%- if dependenciesIds.size == 1 and dependenciesIds contains "timefold-solver" -%} + + org.springframework.boot + spring-boot-starter + + {%- endif -%} + {%- for developmentDependency in developmentDependencies -%} + + {{ developmentDependency.groupId }} + {{ developmentDependency.artifactId }} + runtime + true + + {%- endfor -%} + {%- for annotationDependency in annotationDependencies -%} + + {{ annotationDependency.groupId }} + {{ annotationDependency.artifactId }} + true + + {%- endfor -%} + {%- unless dependenciesIds contains "distributed-tracing" -%} + {%- if dependenciesIds contains "zipkin" -%} + + io.micrometer + micrometer-tracing-bridge-brave + + {%- endif -%} + {%- endunless -%} + {%- for runtimeDependency in runtimeDependencies -%} + + {{ runtimeDependency.groupId }} + {{ runtimeDependency.artifactId }} + runtime + + {%- if runtimeDependency.id == 'wavefront' -%} + {%- if dependenciesIds contains "zipkin" or dependenciesIds contains "distributed-tracing" -%} + + io.micrometer + micrometer-registry-wavefront + runtime + {%- endif -%} - {%- endfor -%} - {%- if dependenciesIds.size == 1 and dependenciesIds contains "timefold-solver" -%} - - org.springframework.boot - spring-boot-starter - + {%- endif -%} + {%- if dependenciesIds contains "data-r2dbc" -%} + {%- if runtimeDependency.id == "h2" -%} + + io.r2dbc + r2dbc-h2 + runtime + + {%- elsif runtimeDependency.id == "mariadb" -%} + + org.mariadb + r2dbc-mariadb + 1.1.3 + runtime + + {%- elsif runtimeDependency.id == "sqlserver" -%} + + io.r2dbc + r2dbc-mssql + 1.0.0.RELEASE + runtime + + {%- elsif runtimeDependency.id == "postgresql" -%} + + org.postgresql + r2dbc-postgresql + runtime + + {%- elsif runtimeDependency.id == "mysql" -%} + + io.asyncer + r2dbc-mysql + runtime + {%- endif -%} - {%- for developmentDependency in developmentDependencies -%} - - {{ developmentDependency.groupId }} - {{ developmentDependency.artifactId }} - runtime - true - - {%- endfor -%} - {%- for annotationDependency in annotationDependencies -%} - - {{ annotationDependency.groupId }} - {{ annotationDependency.artifactId }} - true - - {%- endfor -%} - {%- unless dependenciesIds contains "distributed-tracing" -%} - {%- if dependenciesIds contains "zipkin" -%} - - io.micrometer - micrometer-tracing-bridge-brave - - {%- endif -%} - {%- endunless -%} - {%- for runtimeDependency in runtimeDependencies -%} - - {{ runtimeDependency.groupId }} - {{ runtimeDependency.artifactId }} - runtime - - {%- if runtimeDependency.id == 'wavefront' -%} - {%- if dependenciesIds contains "zipkin" or dependenciesIds contains "distributed-tracing" -%} - - io.micrometer - micrometer-registry-wavefront - runtime - - {%- endif -%} - {%- endif -%} - {%- if dependenciesIds contains "data-r2dbc" -%} - {%- if runtimeDependency.id == "h2" -%} - - io.r2dbc - r2dbc-h2 - runtime - - {%- elsif runtimeDependency.id == "mariadb" -%} - - org.mariadb - r2dbc-mariadb - 1.1.3 - runtime - - {%- elsif runtimeDependency.id == "sqlserver" -%} - - io.r2dbc - r2dbc-mssql - 1.0.0.RELEASE - runtime - - {%- elsif runtimeDependency.id == "postgresql" -%} - - org.postgresql - r2dbc-postgresql - runtime - - {%- elsif runtimeDependency.id == "mysql" -%} - - io.asyncer - r2dbc-mysql - runtime - - {%- endif -%} - {%- endif -%} - {%- endfor -%} - {%- for compileDependency in compileDependencies -%} - - {{ compileDependency.groupId }} - {{ compileDependency.artifactId }} - {%- if compileDependency.version -%} - {{ compileDependency.version }} - {%- endif -%} - - {%- endfor -%} - {%- for testDependency in testDependencies -%} - - {{ testDependency.groupId }} - {{ testDependency.artifactId }} - {%- if testDependency.version -%} - {{ testDependency.version }} - {%- endif -%} - test - - {%- endfor -%} - - org.springframework.boot - spring-boot-starter-test - test - - - {%- if haveSpringShellDependency or haveSpringCloudDependency or haveTimeFoldSolverDependency -%} + {%- endif -%} + {%- endfor -%} + {%- for compileDependency in compileDependencies -%} + + {{ compileDependency.groupId }} + {{ compileDependency.artifactId }} + {%- if compileDependency.version -%} + {{ compileDependency.version }} + {%- endif -%} + + {%- endfor -%} + {%- for testDependency in testDependencies -%} + + {{ testDependency.groupId }} + {{ testDependency.artifactId }} + {%- if testDependency.version -%} + {{ testDependency.version }} + {%- endif -%} + test + + {%- endfor -%} + + org.springframework.boot + spring-boot-starter-test + test + + + {%- if haveSpringShellDependency or haveSpringCloudDependency or haveTimeFoldSolverDependency -%} - - - {%- if haveTimeFoldSolverDependency -%} - - ai.timefold.solver - timefold-solver-bom - ${timefold-solver.version} - pom - import - - {%- endif -%} - {%- if haveSpringShellDependency -%} - - org.springframework.shell - spring-shell-dependencies - ${spring-shell.version} - pom - import - - {%- endif -%} - {%- if haveSpringCloudDependency -%} - - org.springframework.cloud - spring-cloud-dependencies - ${spring-cloud.version} - pom - import - - {%- endif -%} - - + + + {%- if haveTimeFoldSolverDependency -%} + + ai.timefold.solver + timefold-solver-bom + ${timefold-solver.version} + pom + import + + {%- endif -%} + {%- if haveSpringShellDependency -%} + + org.springframework.shell + spring-shell-dependencies + ${spring-shell.version} + pom + import + + {%- endif -%} + {%- if haveSpringCloudDependency -%} + + org.springframework.cloud + spring-cloud-dependencies + ${spring-cloud.version} + pom + import + + {%- endif -%} + + + {%- endif -%} + + {%- if kotlinSelected -%} + ${project.basedir}/src/main/kotlin + ${project.basedir}/src/test/kotlin {%- endif -%} - - {%- if kotlinSelected -%} - ${project.basedir}/src/main/kotlin - ${project.basedir}/src/test/kotlin + + + org.springframework.boot + spring-boot-maven-plugin + {%- if haveLombok and explicitDockerImageForGradleIsRequired -%} + + + paketobuildpacks/builder-jammy-base:latest + + + + org.projectlombok + lombok + + + + {%- elsif haveLombok == false and explicitDockerImageForGradleIsRequired -%} + + + paketobuildpacks/builder-jammy-base:latest + + + {%- elsif haveLombok and explicitDockerImageForGradleIsRequired == false -%} + + + + org.projectlombok + lombok + + + {%- endif -%} - - - org.springframework.boot - spring-boot-maven-plugin - {%- if haveLombok and explicitDockerImageForGradleIsRequired -%} - - - paketobuildpacks/builder-jammy-base:latest - - - - org.projectlombok - lombok - - - - {%- elsif haveLombok == false and explicitDockerImageForGradleIsRequired -%} - - - paketobuildpacks/builder-jammy-base:latest - - - {%- elsif haveLombok and explicitDockerImageForGradleIsRequired == false -%} - - - - org.projectlombok - lombok - - - - {%- endif -%} - - {%- if kotlinSelected -%} - - org.jetbrains.kotlin - kotlin-maven-plugin - - - -Xjsr305=strict - - - spring - {%- if dependenciesIds contains "data-jpa" -%} - jpa - {%- endif -%} - - - - - org.jetbrains.kotlin - kotlin-maven-allopen - ${kotlin.version} - - {%- if dependenciesIds contains "data-jpa" -%} - - org.jetbrains.kotlin - kotlin-maven-noarg - ${kotlin.version} - - {%- endif -%} - - - {%- endif -%} - {%- for plugin in plugins -%} - {%- if plugin.id == "jacoco" -%} - - org.jacoco - jacoco-maven-plugin - {{ plugin.version }} - - - default-prepare-agent - - prepare-agent - - - - default-report - - report - - - - default-check - - check - - - - - CLASS - - - - - - generate-code-coverage-report - test - - report - - - - - {%- elsif plugin.id == "native" -%} - - org.graalvm.buildtools - native-maven-plugin - - {%- if dependenciesIds contains "data-jpa" -%} - - org.hibernate.orm.tooling - hibernate-enhance-maven-plugin - ${hibernate.version} - - - enhance - - enhance - - - true - true - true - - - - - {%- endif -%} - {%- elsif plugin.id == "graphql-code-generation" -%} - - io.github.deweyjose - graphqlcodegen-maven-plugin - 1.50 - - - dgs-codegen - - generate - - - - src/main/resources/graphql-client - - {{ metadata.group }}.{{ metadata.artifact }}.codegen - true - - - - - - org.codehaus.mojo - build-helper-maven-plugin - - - add-dgs-source - generate-sources - - add-source - - - - ${project.build.directory}/generated-sources - - - - - - {%- elsif plugin.id == "spotless" -%} - - - com.diffplug.spotless - spotless-maven-plugin - 2.42.0 - - - origin/main - - - - - - .gitattributes - .gitignore - - - - - - false - 4 - - - - - {%- if javaSelected -%} - - - 2.39.0 - - - - - - {%- else -%} - - - - {%- endif -%} - - - {%- elsif plugin.id == "sonarqubescanner" -%} - - org.sonarsource.scanner.maven - sonar-maven-plugin - 3.10.0.2594 - + + {%- if kotlinSelected -%} + + org.jetbrains.kotlin + kotlin-maven-plugin + + + -Xjsr305=strict + + + spring + {%- if dependenciesIds contains "data-jpa" -%} + jpa {%- endif -%} - {%- endfor -%} - - + + + + + org.jetbrains.kotlin + kotlin-maven-allopen + ${kotlin.version} + + {%- if dependenciesIds contains "data-jpa" -%} + + org.jetbrains.kotlin + kotlin-maven-noarg + ${kotlin.version} + + {%- endif -%} + + + {%- endif -%} + {%- for plugin in plugins -%} + {%- if plugin.id == "jacoco" -%} + + org.jacoco + jacoco-maven-plugin + {{ plugin.version }} + + + default-prepare-agent + + prepare-agent + + + + default-report + + report + + + + default-check + + check + + + + + CLASS + + + + + + generate-code-coverage-report + test + + report + + + + + {%- elsif plugin.id == "native" -%} + + org.graalvm.buildtools + native-maven-plugin + + {%- if dependenciesIds contains "data-jpa" -%} + + org.hibernate.orm.tooling + hibernate-enhance-maven-plugin + ${hibernate.version} + + + enhance + + enhance + + + true + true + true + + + + + {%- endif -%} + {%- elsif plugin.id == "graphql-code-generation" -%} + + io.github.deweyjose + graphqlcodegen-maven-plugin + 1.50 + + + dgs-codegen + + generate + + + + src/main/resources/graphql-client + + {{ metadata.group }}.{{ metadata.artifact }}.codegen + true + + + + + + org.codehaus.mojo + build-helper-maven-plugin + + + add-dgs-source + generate-sources + + add-source + + + + ${project.build.directory}/generated-sources + + + + + + {%- elsif plugin.id == "spotless" -%} + + + com.diffplug.spotless + spotless-maven-plugin + 2.42.0 + + + + + + + formatter:off + formatter:on + + + .gitattributes + .gitignore + + + + + + false + true + 4 + + + + + {%- if javaSelected -%} + + + formatter:off + formatter:on + + + 2.39.0 + + + + + + {%- else -%} + + + + 4 + 120 + + + + formatter:off + formatter:on + + + {%- endif -%} + + + + pom.xml + + + + + + {%- elsif plugin.id == "sonarqubescanner" -%} + + org.sonarsource.scanner.maven + sonar-maven-plugin + 3.10.0.2594 + + {%- endif -%} + {%- endfor -%} + + diff --git a/src/generator/spring/template/readme.md.txt b/src/generator/spring/template/readme.md.txt index bca5cd9..6f165ea 100644 --- a/src/generator/spring/template/readme.md.txt +++ b/src/generator/spring/template/readme.md.txt @@ -27,20 +27,36 @@ You can learn more about the [plugin configuration options](https://netflix.gith ## Apply Code format ### In *nix based system ```sh +{%- if buildTool == "gradle" -%} ./gradlew spotlessApply +{%- else -%} +mvn spotless:apply +{%- endif -%} ``` ### In Windows based system ```sh +{%- if buildTool == "gradle" -%} gradlew.bat spotlessApply +{%- else -%} +mvn.bat spotless:apply +{%- endif -%} ``` ## Check for Code format violation ### In *nix based system ```sh +{%- if buildTool == "gradle" -%} ./gradlew spotlessCheck +{%- else -%} +mvn spotless:check +{%- endif -%} ``` ### In Windows based system ```sh +{%- if buildTool == "gradle" -%} gradlew.bat spotlessCheck +{%- else -%} +mvn.bat spotless:check +{%- endif -%} ``` {%- endif -%}