AD SPACE AVAILABLE · BRAND PARTNERS WELCOME

How Software Engineering Teams Use Amazon Q Developer Transformation to Automatically Upgrade Legacy Java 8 and 11 Applications to Java 17 and 21

Bruno Ribeiro · 365Finds Editorial
Indexed 88,650 Wiki articles

Put 365 Wiki to work with your AI

Copy the prompt below, paste it into the AI you already use, then ask your question.

Download full Skill

Try it with the prompt first. If you use 365 Wiki often, install the full 365Wiki Skill so you do not have to paste it again. No regular AI? Gemini or Microsoft Copilot on the web will work.

365Wiki Skill

Modernizing legacy Java enterprise applications has long been one of the most dreaded assignments in software engineering. Teams inherit dozens of business-critical microservices frozen in time on Java 8 or Java 11. Everyone recognizes the mounting liabilities: public Long-Term Support (LTS) has expired, security vulnerabilities accumulate in unpatched transitive dependencies, and major ecosystem frameworks have moved on. Upgrading to Spring Boot 3 requires Java 17 as an absolute baseline, while simultaneously imposing the breaking Jakarta EE namespace transition (javax.* to jakarta.*).

Until recently, upgrading fifty legacy microservices meant burning months of engineering capacity. Developers sat through grueling cycles of updating Maven POMs, replacing deprecated standard library APIs, resolving classpath clashes, and debugging compiler breaks across hundreds of thousands of lines of boilerplate. At 365Finds, we look at technical debt governance through an operational lens: manual language upgrades are low-leverage, error-prone, and demoralizing for senior backend teams.

Amazon Q Developer offers an autonomous alternative through its native Code Transformation Agent. Rather than acting as a standard generative AI autocomplete assistant that merely suggests code snippets, Amazon Q Developer Transformation runs an end-to-end, multi-phase agentic pipeline. It builds the local baseline, constructs an abstract dependency graph, applies semantic AST transforms in an isolated cloud environment, and runs automated build-and-test loops to repair compilation breaks before generating a clean Git diff.

Here is 365Finds' technical guide to how engineering teams architect, configure, and review automated Java 8 and 11 upgrades to Java 17 and 21 using Amazon Q Developer.


Why Legacy Java Migrations Break: The Three Roadblocks

To understand why Amazon Q Developer's agentic architecture works, one must first confront why manual Java migrations fail in practice.

Migration ChallengeTechnical ImpactTypical Manual Failure Mode
The Jakarta EE SplitJava EE moved to Eclipse Foundation; packages transitioned from javax.* to jakarta.* (Servlet, JPA, Bean Validation)Missing imports, broken annotations at runtime, incompatible third-party libraries
Spring Boot 3 BaselineSpring Framework 6 and Spring Boot 3 dropped support for Java 8 and 11; requires Java 17+ and Jakarta EE 9+Cascading dependency incompatibilities, deprecated auto-configurations, altered property names
JDK Internal EncapsulationStrong encapsulation of JDK internals via JPMS (Java Platform Module System); removal of Nashorn, Pack200, and AppletRuntime IllegalAccessError or InaccessibleObjectException when libraries inspect JVM internals
Deprecated API RemovalsMethods like Class.newInstance(), Thread.stop(), and finalized security managers removed or deprecatedOutdated utility libraries fail during compilation or crash during test execution

When an enterprise engineering team attempts to migrate a service manually, upgrading a single dependency in pom.xml often causes twenty cascading compilation failures. Developers easily lose days chasing transitive dependency conflicts. Amazon Q Developer approaches this problem not as an interactive chat prompt, but as a deterministic compilation and dependency graph transformation problem.


How Amazon Q Developer Transformation Works Under the Hood

The Amazon Q Developer Transformation Agent does not simply feed source files into an LLM and hope for valid syntax. It operates as a structured feedback loop between your local workstation and secure AWS build runners:

+-----------------------------------------------------------------------------------+
| 1. Local Pre-Flight Check & Baseline Build (Maven/Gradle verifies source compiles) |
+-----------------------------------------------------------------------------------+
                                         |
                                         v
+-----------------------------------------------------------------------------------+
| 2. Context Extraction: AST, pom.xml, Dependency Graph & Compiler Logs Bundled     |
+-----------------------------------------------------------------------------------+
                                         |
                                         v
+-----------------------------------------------------------------------------------+
| 3. AWS Isolated Cloud Sandbox: Agent Analyzes Graph & Generates Upgrade Plan      |
+-----------------------------------------------------------------------------------+
                                         |
                                         v
+-----------------------------------------------------------------------------------+
| 4. Semantic Code Transformation (Syntax modernization, javax -> jakarta, POM bump)|
+-----------------------------------------------------------------------------------+
                                         |
                                         v
+-----------------------------------------------------------------------------------+
| 5. Autonomous Build & Test Loop: Agent Fixes Compilation & Unit Test Failures     |
+-----------------------------------------------------------------------------------+
                                         |
                                         v
+-----------------------------------------------------------------------------------+
| 6. Final Artifact & Diff Synchronization: IDE Review Panel / Local Git Diff Branch|
+-----------------------------------------------------------------------------------+

1. Local Baseline Verification

Amazon Q first executes a local pre-flight build using your existing source JDK (Java 8 or 11) and build tool (Apache Maven 3.8+ or Gradle). If your project cannot compile cleanly in its existing state, the transformation halts immediately. Amazon Q requires a stable baseline so it does not attribute pre-existing defects to the modernization process.

2. Dependency Graph and AST Analysis

Once the baseline passes, Amazon Q gathers project metadata: the Abstract Syntax Tree (AST), build definitions (pom.xml or build.gradle), test configurations, and dependency trees. This bundle is transmitted securely over TLS to an isolated AWS transformation environment.

3. Iterative Build-Fix Engine

In the transformation environment, Amazon Q generates a tailored Transformation Plan. It updates parent POM versions, replaces outdated plugins (such as the Maven Compiler Plugin, Surefire, and JaCoCo), maps javax.* packages to jakarta.*, and refactors deprecated Java APIs to modern language idioms. Crucially, the agent does not quit after one pass. It initiates an internal build against the target JDK (Java 17 or Java 21), inspects the resulting compilation errors and test stack traces, adjusts the code, and re-runs the build autonomously until the build passes or hits a maximum iteration limit.

4. Patch Generation

When the agent finishes, it delivers a structured summary report, an itemized transformation plan detailing every modified file and dependency, and a local code diff that can be reviewed side-by-side in your IDE or committed to a feature branch.


Step-by-Step Execution Pipeline: Upgrading Java 8/11 to 17/21

365Finds recommends executing upgrades through a disciplined, stage-gated workflow rather than firing migrations across an entire repository cluster at once.

Phase 1: Environment and Repository Prerequisites

Before launching a transformation, verify that your development environment satisfies AWS runtime requirements:

Phase 2: Launching Transformation in IntelliJ IDEA or VS Code

  1. Open the project root in IntelliJ IDEA or Visual Studio Code with the Amazon Q Developer plugin installed and authenticated via AWS Builder ID or AWS IAM Identity Center.
  2. In the Amazon Q panel, select the Transform hub (or open the chat window and invoke /transform).
  3. Select the target project module and choose your target runtime: Java 17 (LTS) or Java 21 (LTS).
  4. Click Transform. Amazon Q will run its local pre-check, package the context, and upload the build bundle.
  5. You can monitor the Transformation Hub view in real time. The agent reports its progress through stages: Analyzing project, Generating plan, Transforming code, and Validating build.

Phase 3: Launching Headless Migrations via CLI

For platform engineering teams modernizing hundreds of microservices, running upgrades through an IDE GUI is too slow. Amazon Q Developer provides a CLI transformation tool (qct / Amazon Q CLI):

# Initiate a transformation job pointing to the target Java 17 runtime
q transform \
  --source-version JAVA_8 \
  --target-version JAVA_17 \
  --project-path /workspace/services/payment-service

The CLI executes the local build verification, syncs with the AWS transformation runner, streams progress status back to your terminal, and writes the resulting patch files to your local workspace upon completion.


What Amazon Q Changes: Real Code and Configuration Diffs

To see what Amazon Q Developer handles autonomously, consider a standard Spring Boot 2 microservice running on Java 8 migrating to Spring Boot 3 on Java 17.

1. Maven Build Configuration (pom.xml)

Amazon Q updates the Spring Boot starter parent and compiler plugins:

<!-- BEFORE (Java 8 / Spring Boot 2.7) -->
<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>2.7.18</version>
</parent>
<properties>
    <java.version>1.8</java.version>
    <maven.compiler.source>1.8</maven.compiler.source>
    <maven.compiler.target>1.8</maven.compiler.target>
</properties>

<!-- AFTER (Java 17 / Spring Boot 3.2 transformed by Amazon Q) -->
<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>3.2.5</version>
</parent>
<properties>
    <java.version>17</java.version>
    <maven.compiler.source>17</maven.compiler.source>
    <maven.compiler.target>17</maven.compiler.target>
</properties>

2. The Jakarta Namespace Shift in Domain Entities

Amazon Q scans your entities, REST controllers, and servlet filters to replace all legacy javax.* imports with jakarta.*:

// BEFORE (Java 8 / Java EE)
package com.company.billing.model;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Positive;

@Entity
@Table(name = "invoices")
public class Invoice {
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;

    @NotBlank
    private String invoiceNumber;

    @Positive
    private Double amount;
    // constructors, getters, and setters
}
// AFTER (Java 17 / Jakarta EE transformed by Amazon Q)
package com.company.billing.model;

import jakarta.persistence.Entity;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;
import jakarta.persistence.Table;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.Positive;

@Entity
@Table(name = "invoices")
public class Invoice {
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;

    @NotBlank
    private String invoiceNumber;

    @Positive
    private Double amount;
    // constructors, getters, and setters
}

Beyond package renaming, Amazon Q updates test harness annotations (migrating org.junit.Test to org.junit.jupiter.api.Test and replacing @Before with @BeforeEach), updates Mockito syntax, and modernizes deprecated collections and string helper usages.


Handling Private Dependencies and Enterprise Edge Cases

In real-world enterprise environments, automated transformations rarely run in a pristine open-source vacuum. Legacy services depend on internal shared libraries, proprietary authentication SDKs, and private Artifactory or Nexus repositories.

Managing Private Repositories and Air-Gapped Dependencies

Because Amazon Q's cloud transformation runner cannot reach private corporate artifact registries without explicit authorization, unresolvable private dependencies will cause cloud build iterations to fail. Teams must manage this through two deliberate patterns:

  1. Local Build Delegation: When using the Amazon Q CLI or IDE plugin, configure the transformation to rely on local dependency resolution. The tool packages the locally resolved dependency tree (from ~/.m2/repository) so the cloud runner has access to class definitions without needing external access to your private registry.
  2. Selective Transformation via Configuration: Amazon Q Developer supports selective transformation configuration. Teams can specify exactly which first-party and third-party dependencies the agent should modify, and which internal enterprise BOMs (Bill of Materials) should remain pinned:
# amazonq-transformation.yaml
transformationConfig:
  targetJdk: "17"
  excludedDependencies:
    - groupId: "com.internal.enterprise.security"
      artifactId: "corp-auth-starter"
    - groupId: "com.internal.data"
      artifactId: "proprietary-db-driver"
  dependencyOverrides:
    - groupId: "org.springframework.boot"
      targetVersion: "3.2.5"

Pinning internal libraries prevents the agent from attempting to guess upgrade versions for internal artifacts that have their own bespoke internal release lifecycles.


365Finds Review Protocol: Auditing AI-Generated Diff PRs

Amazon reported that its internal migration teams upgraded thousands of production Java applications in months, saving 4,500 developer-years of labor and $260 million in annualized efficiency gains. That metric is genuine and impressive. However, at 365Finds, we strongly warn against treating Amazon Q Developer Transformation as an unmonitored autopilot.

Every AI-generated transformation must pass a four-step engineering audit before merging to main:

+-----------------------------------------------------------------------------------+
| STEP 1: Audit Build Files (pom.xml / build.gradle)                                 |
| - Verify no excluded security libraries were unpinned or dropped                  |
| - Confirm Maven compiler plugin targets JDK 17 or 21 explicitly                   |
+-----------------------------------------------------------------------------------+
                                         |
                                         v
+-----------------------------------------------------------------------------------+
| STEP 2: Audit Jakarta and Reflection Imports                                      |
| - Check for mixed imports (accidental coexistence of javax.* and jakarta.*)       |
| - Inspect classes using reflection or deep JVM internals for JPMS violations       |
+-----------------------------------------------------------------------------------+
                                         |
                                         v
+-----------------------------------------------------------------------------------+
| STEP 3: Run Full Local and Integration Test Suites                                |
| - Execute: ./mvnw clean verify -Pintegration-tests                                |
| - Confirm Spring ApplicationContext loads without circular dependency failures    |
+-----------------------------------------------------------------------------------+
                                         |
                                         v
+-----------------------------------------------------------------------------------+
| STEP 4: Canary Deployment and Memory Profiling                                    |
| - Deploy canary instance to staging/pre-production                                |
| - Monitor JVM heap behavior (G1GC vs ZGC) and verify container memory limits       |
+-----------------------------------------------------------------------------------+

The Hard Truth About Test Coverage

The effectiveness of Amazon Q Developer's iterative build-fix loop is strictly bounded by the quality of your existing test suite. If a microservice has 15% code coverage and no integration tests, Amazon Q will modernize the syntax so the code compiles on Java 17, but it cannot detect runtime behavioral regressions. If your test suite is comprehensive, the agent uses test failure stack traces to correct its own code modifications dynamically.

365Finds' unequivocal recommendation: Before running Amazon Q Developer Transformation on a mission-critical service, invest three days in writing high-level HTTP contract tests and verifying existing unit tests. That safety net allows Amazon Q to do what it does best: eliminate 90% of the mechanical, repetitive refactoring work, turning what used to be a four-month migration marathon into a three-hour review cycle.


References