Migrate to Gradle as build tool#540
Closed
DerDaehne wants to merge 6 commits into
Closed
Conversation
Migrate the project build system to Gradle 8.10.2 using the Micronaut application plugin and John Rengelman's Shadow plugin. Configure test JVM heap limits to avoid OutOfMemoryError, separation of unit and integration tests, dynamic Git metadata generation for VersionName, and update Dockerfile and developers guide. Co-authored-by: Gemini CLI <gemini-cli@cloudogu.com>
Update .dockerignore to allow settings.gradle, build.gradle, and the gradle wrapper files while removing obsolete Maven files. Co-authored-by: Gemini CLI <gemini-cli@cloudogu.com>
Introduce Kotlin and KAPT plugins to build.gradle for migrating Groovy code to Kotlin. Registers src/main/kotlin and configures jvmTarget 17. Co-authored-by: Gemini CLI <gemini-cli@cloudogu.com>
Convert the leaf-level Groovy enums ScmProviderType and ReturnCode to Kotlin. Configure compileGroovy and compileTestGroovy tasks in build.gradle to depend on and include compiled Kotlin classes in their classpaths, enabling seamless hybrid Groovy/Kotlin compilation. Co-authored-by: Gemini CLI <gemini-cli@cloudogu.com>
Update Jenkinsfile to use GRADLE_IMAGE (eclipse-temurin:17-jdk-alpine) and mount gradle-cache. Replace 'mvn test' and integration test calls with ./gradlew commands, update JUnit test result patterns to point to build/test-results, and apply org.sonarqube plugin in build.gradle. Co-authored-by: Gemini CLI <gemini-cli@cloudogu.com>
Change org.sonarqube plugin version in build.gradle to 7.3.1.8318, which is the correct and fully compatible version on Gradle Plugin Portal. Co-authored-by: Gemini CLI <gemini-cli@cloudogu.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR migrates the project’s build and CI workflow from Maven to Gradle (via Gradle Wrapper), while beginning the codebase transition path by moving small shared enums from Groovy to Kotlin.
Changes:
- Replaced Maven build configuration (pom + mvnw) with a Gradle build (build.gradle + settings.gradle + wrapper).
- Updated CI (Jenkinsfile) and container build (Dockerfile/.dockerignore) to run Gradle tasks and use Gradle caching.
- Migrated
ReturnCodeandScmProviderTypeenums from Groovy to Kotlin equivalents.
Reviewed changes
Copilot reviewed 16 out of 18 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/main/kotlin/com/cloudogu/gitops/config/scm/util/ScmProviderType.kt | Kotlin enum replacement for Groovy ScmProviderType. |
| src/main/kotlin/com/cloudogu/gitops/cli/ReturnCode.kt | Kotlin enum replacement for Groovy ReturnCode. |
| src/main/groovy/com/cloudogu/gitops/config/scm/util/ScmProviderType.groovy | Removes Groovy enum after Kotlin migration. |
| src/main/groovy/com/cloudogu/gitops/cli/ReturnCode.groovy | Removes Groovy enum after Kotlin migration. |
| settings.gradle | Adds Gradle settings and plugin management repositories. |
| build.gradle | Introduces Gradle build (Micronaut, Shadow, JaCoCo, Kotlin, Sonar). |
| gradlew / gradlew.bat | Adds Gradle Wrapper scripts for Unix/Windows. |
| gradle/wrapper/gradle-wrapper.properties | Pins Gradle distribution for wrapper. |
| pom.xml | Removes Maven build definition. |
| mvnw / mvnw.cmd | Removes Maven Wrapper scripts. |
| .mvn/wrapper/maven-wrapper.properties | Removes Maven wrapper properties. |
| Jenkinsfile | Switches pipeline steps from Maven to Gradle tasks and cache volumes. |
| Dockerfile | Updates multi-stage build to cache and build with Gradle (shadowJar). |
| .dockerignore | Updates docker build context allowlist for Gradle build inputs. |
| docs/Developers.md | Updates developer workflow documentation to use Gradle commands. |
Comments suppressed due to low confidence (1)
.dockerignore:30
- This comment still refers to Maven and contains a typo ("minium"). Since the build metadata is now produced via Gradle, update the wording to avoid confusion.
!gradle/
!compiler.groovy
# Including .git is risky, but required so maven can read the build number. At least keep it to a minium.
!.git/HEAD
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
200
to
204
| post { | ||
| always { | ||
| junit testResults: "**/target/failsafe-reports/TEST-*.xml", | ||
| junit testResults: "**/build/test-results/**/*.xml", | ||
| allowEmptyResults: true | ||
| } |
Comment on lines
+484
to
+488
| Or run build and run via gradle and java: | ||
|
|
||
| ````shell | ||
| mvn package -DskipTests | ||
| java -classpath target/gitops-playground-cli-0.1.jar org.codehaus.groovy.tools.GroovyStarter --main groovy.ui.GroovyMain \ | ||
| ./gradlew shadowJar | ||
| java -classpath build/libs/gitops-playground-cli-0.1-all.jar org.codehaus.groovy.tools.GroovyStarter --main groovy.ui.GroovyMain \ |
Contributor
Author
|
we will stick with maven for now. closing |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR migrates the project from Maven to Gradle as its build tool. This lays the foundation for a broader codebase transition, moving from Groovy to Kotlin.