Skip to content

Upgrade to Gradle 9.3.0 and migrate smoke tests from Spring Boot to Shadow plugin#4604

Draft
Copilot wants to merge 9 commits intomainfrom
copilot/upgrade-to-gradle-9
Draft

Upgrade to Gradle 9.3.0 and migrate smoke tests from Spring Boot to Shadow plugin#4604
Copilot wants to merge 9 commits intomainfrom
copilot/upgrade-to-gradle-9

Conversation

Copy link
Contributor

Copilot AI commented Jan 28, 2026

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

Changes

Gradle version

  • Wrapper: 8.14.3 → 9.3.0
  • protobuf-gradle-plugin: 0.8.19 → 0.9.6 (Gradle 9 compatibility)

Smoke test JAR packaging (ai.smoke-test-jar.gradle.kts)

Replaced Spring Boot plugin with Shadow plugin:

tasks.named<ShadowJar>("shadowJar") {
  archiveClassifier.set("")
  mergeServiceFiles()
  
  // PropertiesFileTransformer merges duplicate keys into single comma-separated values
  // Critical for Spring Boot auto-configuration (EnableAutoConfiguration key)
  transform(PropertiesFileTransformer::class.java) {
    paths = listOf("META-INF/spring.factories")
    mergeStrategy = "append"
  }
  
  manifest {
    attributes["Main-Class"] = project.findProperty("mainClassName") 
      ?: "com.microsoft.applicationinsights.smoketestapp.SpringBootApp"
  }
}

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

App-specific fixes

  • JettyNativeHandler, ReadOnly: Custom main classes via ext.set("mainClassName", "...")
  • DiagnosticExtension: MockExtension → compileOnly (prevents classloader conflict when loaded separately as agent extension)
  • NonDaemonThreads: Added spring-boot-loader dependency (TestController locates JAR via JarLauncher class), exception handling for network failures

Technical details

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

# Before (broken)
org.springframework.boot.autoconfigure.EnableAutoConfiguration=ActuatorConfigs...
org.springframework.boot.autoconfigure.EnableAutoConfiguration=WebMvcConfigs...  # ignored!

# After (fixed)
org.springframework.boot.autoconfigure.EnableAutoConfiguration=ActuatorConfigs...,WebMvcConfigs...

Without merged auto-configuration, critical beans like ServletWebServerFactory and WebMvcMetricsAutoConfiguration aren't registered, causing startup and Micrometer failures.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • www.bing.com
    • Triggering command: /opt/java/openjdk/bin/java java -javaagent:/applicationinsights-agent.jar -jar /NonDaemonThreads-3.7.7-SNAPSHOT.jar okhttp3 (dns block)
    • Triggering command: /opt/java/openjdk/bin/java java -javaagent:/applicationinsights-agent.jar -jar /NonDaemonThreads-3.7.7-SNAPSHOT.jar okhttp3 c1c93a3e44035f56cbfc1a2eaa9723c62cf52156d2b8f0d94a6/config.json (dns block)
    • Triggering command: /opt/java/openjdk/bin/java java -javaagent:/applicationinsights-agent.jar -jar /NonDaemonThreads-3.7.7-SNAPSHOT.jar okhttp3 ACCEPT y es ntime.v2.task/mobash (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

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
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.

2 participants