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
23 changes: 23 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Build
on: [push, pull_request]
jobs:
maven:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
distribution: temurin
java-version: '17'
cache: maven
- run: mvn -B -V clean package
gradle:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
distribution: temurin
java-version: '17'
- uses: gradle/actions/setup-gradle@v3
- run: ./gradlew -V clean bootJar
Comment on lines +14 to +23

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: Gradle CI job skips dependency caching that the Maven job enables

The maven job sets cache: maven on setup-java, but the gradle job relies solely on gradle/actions/setup-gradle@v3. That action does provide Gradle caching by default, so this is not broken, but the asymmetry (no cache: gradle on setup-java) is worth noting if build time matters.

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.

Intentional: gradle/actions/setup-gradle@v3 already caches Gradle dependencies, so adding cache: gradle to setup-java would be redundant.

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: Gradle CI job only builds bootJar, so test compilation is never exercised

The Maven job runs clean package (compiles and runs tests), but the Gradle job runs only clean bootJar, which never resolves testCompileClasspath or compiles test sources. Any future test-scope dependency problem (e.g. testImplementation("junit:junit") losing BOM-managed versioning) would go undetected in CI. Using ./gradlew build would keep the two jobs symmetric.

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.

The workflow content is specified for this upgrade, and the repo has no test sources at all (surefire logs No tests to run), so bootJar vs build makes no practical difference here. Reasonable follow-up once tests exist.

2 changes: 1 addition & 1 deletion .mvn/wrapper/maven-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1 +1 @@
distributionUrl=https://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.3.9/apache-maven-3.3.9-bin.zip
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.6/apache-maven-3.9.6-bin.zip
26 changes: 18 additions & 8 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ buildscript {
mavenCentral()
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:2.0.2.RELEASE")
classpath("org.springframework.boot:spring-boot-gradle-plugin:2.7.18")
classpath("io.spring.gradle:dependency-management-plugin:1.0.15.RELEASE")
}
}

Expand All @@ -14,19 +15,28 @@ apply plugin: 'org.springframework.boot'
apply plugin: 'io.spring.dependency-management'

bootJar {
baseName = 'gs-spring-boot'
version = '0.1.0'
archiveBaseName = 'gs-spring-boot'
archiveVersion = '0.1.0'
}
Comment thread
devin-ai-integration[bot] marked this conversation as resolved.

repositories {
mavenCentral()
}

sourceCompatibility = 1.8
targetCompatibility = 1.8
java {
toolchain {
languageVersion = JavaLanguageVersion.of(17)
}
}

dependencies {
compile("org.springframework.boot:spring-boot-starter-web")
testCompile("junit:junit")
tasks.withType(JavaCompile) {
options.release = 17
}

dependencies {
implementation("org.springframework.boot:spring-boot-starter-web")
implementation("org.springframework.boot:spring-boot-starter-jdbc")
implementation("javax.annotation:javax.annotation-api:1.3.2")
runtimeOnly("com.h2database:h2")
testImplementation("junit:junit")
}
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.4-bin.zip
Empty file modified gradlew
100644 → 100755
Empty file.
Empty file modified mvnw
100644 → 100755
Empty file.
27 changes: 19 additions & 8 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,16 @@

<groupId>org.springframework</groupId>
<artifactId>gs-spring-boot</artifactId>
<packaging>pom</packaging>
<packaging>jar</packaging>
<version>0.1.0</version>

<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.0.2.RELEASE</version>
<version>2.7.18</version>
</parent>

<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-properties-migrator</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
Expand All @@ -32,15 +27,31 @@
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
</dependency>
Comment on lines 27 to 29

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: Maven and Gradle builds differ in H2 dependency scope

pom.xml declares com.h2database:h2 in default (compile) scope while build.gradle:40 uses runtimeOnly. No source references H2 classes directly, so both work, but keeping the two build files aligned (e.g. <scope>runtime</scope> in Maven) avoids divergence between the packaged artifacts.

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.

Leaving Maven at compile scope for now — this PR is scoped to the JDK 17 / Boot 2.7.18 upgrade and both builds package H2 identically today. Worth aligning in a follow-up.

<dependency>
<groupId>javax.annotation</groupId>
<artifactId>javax.annotation-api</artifactId>
<version>1.3.2</version>
</dependency>
Comment on lines +30 to +34

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: Unused javax.annotation-api dependency pinned in both builds

No source file under src/main/java references javax.annotation (verified by grep). Since Spring Boot 2.7 still targets Java EE javax.* and the JDK 17 removal of java.xml.ws.annotation only matters when the code actually uses @Resource/@PostConstruct, this explicit 1.3.2 pin is dead weight and an unmanaged version that will drift from Boot's BOM.

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.

The javax.annotation-api:1.3.2 pin is an explicit requirement of this upgrade (a standing decision to keep the javax.* namespace explicitly available rather than implicitly), so it stays even though no source references it today.

</dependencies>

<properties>
<java.version>1.8</java.version>
<java.version>17</java.version>
<maven.compiler.release>17</maven.compiler.release>
<maven-compiler-plugin.version>3.13.0</maven-compiler-plugin.version>
<maven-surefire-plugin.version>3.5.6</maven-surefire-plugin.version>

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔍 surefire version property is declared but no plugin pins it

maven-surefire-plugin.version is set to 3.5.6, which overrides the Spring Boot parent's managed surefire version. Worth confirming that surefire 3.5.6 is actually released and compatible with the pinned parent, since no <plugin> entry in the build makes the override explicit and a bad value would only surface at test time (this project currently has no tests).

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.

Confirmed: surefire 3.5.6 resolves and runs under the 2.7.18 parent — the verified build logs --- surefire:3.5.6:test (default-test) @ gs-spring-boot ---. The pin is intentional (a standing version decision for this upgrade), so no explicit <plugin> entry needed.

</properties>


<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>${maven-compiler-plugin.version}</version>
<configuration>
<release>${maven.compiler.release}</release>
</configuration>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
Expand Down
22 changes: 17 additions & 5 deletions src/main/java/hello/Application.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,13 @@
import org.springframework.context.annotation.Bean;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.web.client.RestTemplate;
import org.springframework.web.client.RestClientException;

@SpringBootApplication
public class Application implements CommandLineRunner {

private static final Logger log = LoggerFactory.getLogger(Application.class);
private static final String QUOTERS_URL = "http://gturnquist-quoters.cfapps.io/api/random";

public static void main(String[] args) {

Expand All @@ -36,8 +38,7 @@ public static void main(String[] args) {
}

RestTemplate restTemplate = new RestTemplate();
Comment on lines 38 to 40

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: Quote is still fetched twice on startup

main calls logRandomQuote after SpringApplication.run has already executed the CommandLineRunner bean that does the same fetch, so the (now warning-only) remote call happens twice per startup. The description acknowledges the duplicated WARN; removing the main-side call and the ad-hoc new RestTemplate() would avoid an unnecessary outbound request on every boot.

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.

Intentional — calling the quote fetch from both main and the CommandLineRunner is an explicit requirement of this upgrade, preserving the original program's behaviour. Now that it only WARNs, the duplicate outbound call is harmless.

Quote quote = restTemplate.getForObject("http://gturnquist-quoters.cfapps.io/api/random", Quote.class);
log.info(quote.toString());
logRandomQuote(restTemplate);
}


Expand All @@ -49,12 +50,23 @@ public RestTemplate restTemplate(RestTemplateBuilder builder) {
@Bean
public CommandLineRunner run(RestTemplate restTemplate) throws Exception {
return args -> {
Quote quote = restTemplate.getForObject(
"http://gturnquist-quoters.cfapps.io/api/random", Quote.class);
log.info(quote.toString());
logRandomQuote(restTemplate);
};
}

private static void logRandomQuote(RestTemplate restTemplate) {
try {
Quote quote = restTemplate.getForObject(QUOTERS_URL, Quote.class);
if (quote == null) {
log.warn("Unable to retrieve random quote from {}", QUOTERS_URL);
} else {
log.info(quote.toString());
}
} catch (RestClientException ex) {
log.warn("Unable to retrieve random quote from {}", QUOTERS_URL, ex);
}
}
Comment thread
devin-ai-integration[bot] marked this conversation as resolved.


@Autowired
JdbcTemplate jdbcTemplate;
Expand Down
Loading