jakarta-namespace
Automates the migration of legacy Java EE namespaces to the modern Jakarta EE standard.
Install
mkdir -p .claude/skills/jakarta-namespace && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/2935" && unzip -o skill.zip -d .claude/skills/jakarta-namespace && rm skill.zipInstalls to .claude/skills/jakarta-namespace
Activation
This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.
Migrate Java EE javax.* imports to Jakarta EE jakarta.* namespace. Use when upgrading to Spring Boot 3.x, migrating javax.persistence, javax.validation, javax.servlet imports, or fixing compilation errors after Jakarta EE transition. Covers package mappings, batch sed commands, and verification steps.Key capabilities
- →Migrate javax.* imports to jakarta.*
- →Perform batch replacement of package namespaces
- →Verify migration completeness with grep
- →Automate migration using OpenRewrite recipes
- →Update JPA entity and validation annotations
How it works
The skill uses batch sed commands or OpenRewrite recipes to systematically replace Java EE namespace imports with their Jakarta EE counterparts across the codebase.
Inputs & outputs
When to use jakarta-namespace
- →Upgrade Spring Boot 2.x to 3.x
- →Refactor javax.persistence to jakarta.persistence
- →Fix import errors after Jakarta EE transition
About this skill
Jakarta EE Namespace Migration Skill
Overview
Spring Boot 3.0 has upgraded from Java EE to Jakarta EE APIs for all dependencies. This is one of the most significant breaking changes and requires updating all javax.* package imports to jakarta.*.
Important: Packages such as javax.sql.* and javax.crypto.* will NOT change to jakarta.* as they are part of the Java 17+ JDK itself, not part of Java EE.
Required Package Mappings
| Before (Java EE) | After (Jakarta EE) |
|---|---|
javax.persistence.* | jakarta.persistence.* |
javax.validation.* | jakarta.validation.* |
javax.servlet.* | jakarta.servlet.* |
javax.annotation.* | jakarta.annotation.* |
javax.transaction.* | jakarta.transaction.* |
javax.ws.rs.* | jakarta.ws.rs.* |
javax.mail.* | jakarta.mail.* |
javax.jms.* | jakarta.jms.* |
javax.xml.bind.* | jakarta.xml.bind.* |
Affected Annotations and Classes
Persistence (JPA)
@Entity,@Table,@Column@Id,@GeneratedValue@ManyToOne,@OneToMany,@ManyToMany,@OneToOne@JoinColumn,@JoinTable@PrePersist,@PreUpdate,@PostLoad@Enumerated,@TemporalEntityManager,EntityManagerFactoryEntityNotFoundException
Validation
@Valid@NotNull,@NotBlank,@NotEmpty@Size,@Min,@Max@Email,@Pattern@Positive,@Negative@Past,@Future
Servlet
HttpServletRequest,HttpServletResponseServletExceptionFilter,FilterChainHttpSession,Cookie
Migration Commands
Step 1: Find All javax Imports That Need Migration
# List all files with javax imports that need migration (excludes JDK packages)
grep -r "import javax\." --include="*.java" . | grep -v "javax.sql" | grep -v "javax.crypto" | grep -v "javax.net"
Step 2: Batch Replace All Namespaces
# Replace javax.persistence with jakarta.persistence
find . -name "*.java" -type f -exec sed -i 's/import javax\.persistence/import jakarta.persistence/g' {} +
# Replace javax.validation with jakarta.validation
find . -name "*.java" -type f -exec sed -i 's/import javax\.validation/import jakarta.validation/g' {} +
# Replace javax.servlet with jakarta.servlet
find . -name "*.java" -type f -exec sed -i 's/import javax\.servlet/import jakarta.servlet/g' {} +
# Replace javax.annotation (common ones used in Spring)
find . -name "*.java" -type f -exec sed -i 's/import javax\.annotation\.PostConstruct/import jakarta.annotation.PostConstruct/g' {} +
find . -name "*.java" -type f -exec sed -i 's/import javax\.annotation\.PreDestroy/import jakarta.annotation.PreDestroy/g' {} +
find . -name "*.java" -type f -exec sed -i 's/import javax\.annotation\.Resource/import jakarta.annotation.Resource/g' {} +
# Replace javax.transaction with jakarta.transaction
find . -name "*.java" -type f -exec sed -i 's/import javax\.transaction/import jakarta.transaction/g' {} +
Step 3: Handle Wildcard Imports
# Replace wildcard imports
find . -name "*.java" -type f -exec sed -i 's/import javax\.persistence\.\*/import jakarta.persistence.*/g' {} +
find . -name "*.java" -type f -exec sed -i 's/import javax\.validation\.\*/import jakarta.validation.*/g' {} +
find . -name "*.java" -type f -exec sed -i 's/import javax\.servlet\.\*/import jakarta.servlet.*/g' {} +
Critical: Entity Classes Must Use jakarta.persistence
After migration, every JPA entity class MUST have jakarta.persistence imports. This is a hard requirement for Spring Boot 3.
Example Entity Migration
// BEFORE (Spring Boot 2.x) - WILL NOT COMPILE in Spring Boot 3
import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.Id;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
@Entity
@Table(name = "users")
public class User {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
}
// AFTER (Spring Boot 3.x) - REQUIRED
import jakarta.persistence.Entity;
import jakarta.persistence.Table;
import jakarta.persistence.Id;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType;
@Entity
@Table(name = "users")
public class User {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
}
Example Validation Migration
// BEFORE
import javax.validation.constraints.Email;
import javax.validation.constraints.NotBlank;
import javax.validation.Valid;
// AFTER
import jakarta.validation.constraints.Email;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.Valid;
Example Servlet Migration
// BEFORE
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
// AFTER
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
Verification
Verify No Old javax Imports Remain
# These commands should return NO results after migration
grep -r "import javax\.persistence" --include="*.java" .
grep -r "import javax\.validation" --include="*.java" .
grep -r "import javax\.servlet" --include="*.java" .
# Combined check for all Java EE packages
grep -r "import javax\." --include="*.java" . | grep -E "(persistence|validation|servlet|transaction|annotation\.(PostConstruct|PreDestroy|Resource))"
Verify jakarta Imports Are Present
# These MUST return results showing your migrated classes
grep -r "import jakarta\.persistence" --include="*.java" .
grep -r "import jakarta\.validation" --include="*.java" .
If the jakarta.persistence grep returns no results but you have JPA entities, the migration is incomplete and will fail.
Using OpenRewrite for Automated Migration
OpenRewrite can automate the entire namespace migration:
<!-- Add to pom.xml plugins section -->
<plugin>
<groupId>org.openrewrite.maven</groupId>
<artifactId>rewrite-maven-plugin</artifactId>
<version>5.42.0</version>
<configuration>
<activeRecipes>
<recipe>org.openrewrite.java.migrate.jakarta.JavaxMigrationToJakarta</recipe>
</activeRecipes>
</configuration>
<dependencies>
<dependency>
<groupId>org.openrewrite.recipe</groupId>
<artifactId>rewrite-migrate-java</artifactId>
<version>2.26.0</version>
</dependency>
</dependencies>
</plugin>
Then run:
mvn rewrite:run
Common Pitfalls
- Don't change javax.sql or javax.crypto - These are JDK packages, not Java EE
- Check test files too - Test classes also need migration
- Update XML configurations - If using persistence.xml, update namespaces there too
- Third-party libraries - Ensure all dependencies have Jakarta EE compatible versions
- Mixed namespaces cause runtime errors - All must be migrated together
Sources
When not to use it
- →When dealing with JDK-native packages like javax.sql or javax.crypto
Prerequisites
Limitations
- →Requires manual verification of third-party library compatibility
- →Mixed namespaces can cause runtime errors
How it compares
It provides a targeted, automated approach to a specific breaking change, distinguishing between Java EE packages and JDK-native packages.
Compared to similar skills
jakarta-namespace side by side with the closest alternatives in the catalog.
| Skill | Installs | Updated | Safety | Difficulty |
|---|---|---|---|---|
| jakarta-namespace (this skill) | 2 | 6mo | Review | Intermediate |
| spring-boot-migration | 1 | 6mo | Review | Advanced |
| java-coding-standards | 16 | 4mo | No flags | Intermediate |
| springboot-tdd | 5 | 5mo | No flags | Intermediate |
Try saying
Example prompts that trigger this skill in your AI assistant.
More by benchflow-ai
View all by benchflow-ai →You might also like
spring-boot-migration
benchflow-ai
Migrate Spring Boot 2.x applications to Spring Boot 3.x. Use when updating pom.xml versions, removing deprecated JAXB dependencies, upgrading Java to 17/21, or using OpenRewrite for automated migration. Covers dependency updates, version changes, and migration checklist.
java-coding-standards
affaan-m
Java coding standards for Spring Boot services: naming, immutability, Optional usage, streams, exceptions, generics, and project layout.
springboot-tdd
affaan-m
Test-driven development for Spring Boot using JUnit 5, Mockito, MockMvc, Testcontainers, and JaCoCo. Use when adding features, fixing bugs, or refactoring.
spring-boot-config-refactor
sklintyg
Refactor a Spring Boot application's configuration from legacy application.properties and scattered @Value usage to structured YAML and immutable @ConfigurationProperties records. Use this when migrating messy configuration, standardizing property naming, introducing app-prefixed custom properties,
java-springboot
carlosroco
Genera la estructura completa de un microservicio Java Spring Boot 3.x con Maven. Úsalo cuando necesites crear el proyecto base (pom.xml, clase principal), la capa de servicio (interfaz + implementación) o el controlador REST.
refactor
jgreen021
This standard governs the modernization of legacy code and the surgical decomposition of high-complexity monolithic structures.