Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 28, 2026

Gradle 9 removed LenientConfiguration.getFiles() API used by Spring Boot 2.x plugin. Spring Boot 3.x requires Java 17+, incompatible with Java 8 smoke test containers.

Changes

Gradle updates

  • Wrapper: 8.14.3 → 9.3.0
  • protobuf-gradle-plugin: 0.8.19 → 0.9.6

Smoke test JAR packaging

Replaced Spring Boot plugin with Shadow plugin in ai.smoke-test-jar.gradle.kts:

tasks.named<ShadowJar>("shadowJar") {
  mergeServiceFiles()
  
  transform(PropertiesFileTransformer::class.java) {
    paths = listOf("META-INF/spring.factories")
    mergeStrategy = "append"
  }
  
  manifest {
    attributes["Main-Class"] = project.findProperty("mainClassName") 
      ?: "com.microsoft.applicationinsights.smoketestapp.SpringBootApp"
  }
}

tasks.named<Jar>("jar") {
  enabled = false  // Prevent overwriting shadowJar output
}

Critical: Shadow's append() method concatenates files creating duplicate property keys. Spring Boot reads only first occurrence:

# Broken - duplicate keys
org.springframework.boot.autoconfigure.EnableAutoConfiguration=ActuatorConfigs...
org.springframework.boot.autoconfigure.EnableAutoConfiguration=WebMvcConfigs...

# Fixed - merged values  
org.springframework.boot.autoconfigure.EnableAutoConfiguration=ActuatorConfigs...,WebMvcConfigs...

PropertiesFileTransformer merges duplicate keys into comma-separated values, enabling all auto-configurations (ServletWebServerFactory, WebMvcMetricsAutoConfiguration, etc.).

App-specific fixes

  • JettyNativeHandler, ReadOnly: Custom main class via ext.set("mainClassName", "...")
  • DiagnosticExtension: MockExtension → compileOnly (prevents classloader conflict when extension loaded separately as agent extension)
  • NonDaemonThreads: Added spring-boot-loader dependency (TestController requires JarLauncher class to locate JAR)
Original prompt

Upgrade the project to Gradle 9


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI changed the title [WIP] Upgrade project to Gradle 9 Upgrade to Gradle 9.3.0 Jan 28, 2026
Copilot AI requested a review from xiang17 January 28, 2026 08:28
Copilot AI changed the title Upgrade to Gradle 9.3.0 Upgrade to Gradle 9 and fix smoke test Java 8 compatibility Jan 28, 2026
Copilot AI changed the title Upgrade to Gradle 9 and fix smoke test Java 8 compatibility Fix smoke test JARs missing Main-Class manifest attribute Jan 28, 2026
Copilot AI changed the title Fix smoke test JARs missing Main-Class manifest attribute Upgrade to Gradle 9 and fix smoke test JAR packaging Jan 28, 2026
Copilot AI changed the title Upgrade to Gradle 9 and fix smoke test JAR packaging Upgrade to Gradle 9.3.0 Feb 5, 2026
Copilot AI changed the title Upgrade to Gradle 9.3.0 Upgrade to Gradle 9.3.0 and migrate smoke tests from Spring Boot to Shadow plugin Feb 5, 2026
Copilot AI changed the title Upgrade to Gradle 9.3.0 and migrate smoke tests from Spring Boot to Shadow plugin Upgrade to Gradle 9.3.0 Feb 5, 2026
@xiang17 xiang17 marked this pull request as ready for review February 6, 2026 00:25
@xiang17 xiang17 merged commit 9f41c75 into main Feb 10, 2026
144 checks passed
@xiang17 xiang17 deleted the copilot/upgrade-to-gradle-9 branch February 10, 2026 21:15
@xiang17 xiang17 mentioned this pull request Feb 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants