Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
/.idea/
/.idea/
/target/
/build/
/.gradle/
41 changes: 22 additions & 19 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,32 +1,35 @@
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:2.0.2.RELEASE")
}
plugins {
id 'java'
id 'eclipse'
id 'idea'
id 'org.springframework.boot' version '3.5.16'
id 'io.spring.dependency-management' version '1.1.7'
}

apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'idea'
apply plugin: 'org.springframework.boot'
apply plugin: 'io.spring.dependency-management'
group = 'org.springframework'
version = '0.1.0'

java {
toolchain {
languageVersion = JavaLanguageVersion.of(21)
}
}

bootJar {
baseName = 'gs-spring-boot'
version = '0.1.0'
archiveBaseName = 'gs-spring-boot'
}

repositories {
mavenCentral()
}

sourceCompatibility = 1.8
targetCompatibility = 1.8

dependencies {
compile("org.springframework.boot:spring-boot-starter-web")
testCompile("junit:junit")
implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'org.springframework.boot:spring-boot-starter-jdbc'

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📝 Info: properties-migrator kept as a permanent runtime dependency

spring-boot-properties-migrator is documented as a temporary aid to be removed once the upgrade is complete; keeping it as a permanent runtime/runtimeOnly dependency in both pom.xml and build.gradle:28 adds startup overhead and ships in the boot jar. Since this PR completes the 2.x -> 3.x migration and the repo has essentially no application properties (application.properties only contains a commented-out line and it sits at the repo root rather than src/main/resources), it could be dropped.

Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed — this PR finishes the 2.x → 3.x migration and there are no properties to migrate, so spring-boot-properties-migrator is dropped from both pom.xml and build.gradle.

runtimeOnly 'com.h2database:h2'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
Comment on lines 25 to +30

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 The new automated test never runs in the Gradle build

The Gradle build never tells the test runner to use the JUnit 5 engine (missing useJUnitPlatform() configuration in build.gradle:25-31), so the newly added test is silently skipped when building with Gradle.
Impact: The Gradle build reports success without ever exercising the application startup smoke test, giving false confidence in the upgrade.

Gradle defaults to the JUnit 4 framework unless the test task opts into the JUnit Platform

src/test/java/hello/ApplicationTests.java uses org.junit.jupiter.api.Test (JUnit 5). Gradle 8.x (gradle/wrapper/gradle-wrapper.properties pins 8.14.5) still defaults Test tasks to the JUnit 4 framework; the JUnit Platform is only used when useJUnitPlatform() is declared, which is why Spring Initializr-generated Gradle builds always contain tasks.named('test') { useJUnitPlatform() }. The Spring Boot Gradle plugin does not configure this for you. As a result ./gradlew test finds no JUnit 4 tests and executes nothing, while mvn verify (surefire from the Boot parent) does run the test — leaving the two builds inconsistent despite the PR's goal of keeping them in agreement.

Suggested change
sourceCompatibility = 1.8
targetCompatibility = 1.8
dependencies {
compile("org.springframework.boot:spring-boot-starter-web")
testCompile("junit:junit")
implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'org.springframework.boot:spring-boot-starter-jdbc'
runtimeOnly 'org.springframework.boot:spring-boot-properties-migrator'
runtimeOnly 'com.h2database:h2'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
dependencies {
implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'org.springframework.boot:spring-boot-starter-jdbc'
runtimeOnly 'org.springframework.boot:spring-boot-properties-migrator'
runtimeOnly 'com.h2database:h2'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
}
tasks.named('test') {
useJUnitPlatform()
}
Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not accurate — build.gradle already ends with exactly the suggested block:

tasks.named('test') {
    useJUnitPlatform()
}

The suggestion diff just stops at the dependencies block. Gradle does run the test: ./gradlew clean build writes tests="2" to build/test-results/test/*.xml, matching surefire's Tests run: 2. (Before I fixed the startup crash, ./gradlew build failed on ApplicationTests > contextLoads() FAILED, which also confirms the JUnit 5 engine is wired up.)

}

tasks.named('test') {
useJUnitPlatform()
}
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
5 changes: 3 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#Thu Mar 01 09:01:15 CST 2018
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.5-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-bin.zip
Loading