Skip to content

Latest commit

 

History

History
137 lines (98 loc) · 7.09 KB

README.md

File metadata and controls

137 lines (98 loc) · 7.09 KB

Rewrite WebLogic

Migrate your WebLogic applications to the latest version of WebLogic and Java with OpenRewrite. Automatically.

What is this?

This project implements a Rewrite module that performs common tasks when migrating your WebLogic applications to a new version of WebLogic and Java.

Recipes

Composite Recipes Recipes Description
BETA: Migrate to WebLogic 15.1.1 Beta and Java 21 com.oracle.weblogic.rewrite.UpgradeTo1511
org.openrewrite.java.migrate.UpgradeToJava21
org.openrewrite.java.migrate.jakarta.JavaxMigrationToJakarta
- Applies changes required for migrating applications to WebLogic 15.1.1 and Jakarta 9.1
- Upgrades WebLogic Maven properties version
- Upgrades Java version to 21
Migrate to WebLogic 14.1.2 and Java 21 com.oracle.weblogic.rewrite.UpgradeTo1412
org.openrewrite.java.migrate.UpgradeToJava21
- Applies changes required for migrating applications to WebLogic 14.1.2
- Upgrades WebLogic Maven properties version
- Upgrades Java version to 21
Migrate to WebLogic 14.1.2 and Java 17 com.oracle.weblogic.rewrite.UpgradeTo1412
org.openrewrite.java.migrate.UpgradeToJava17
- Applies changes required for migrating applications to WebLogic 14.1.2
- Upgrades WebLogic Maven properties version
- Upgrades Java version to 17

How do I use it?

You can call OpenRewrite on your code folder using the Maven or Gradle CLI or include it as a build plug-in in your pom.xml file.

For more details on running the recipes with Maven and Gradle, see the OpenRewrite Quickstart documentation.

Prerequisites

The following tools are required to build and run this project:

  • Java
  • Maven or Gradle
  • Your code

Get your code

Clone your project to your local machine.

Important

Note that the run command will make changes to your code. Always make sure you have a backup of your code. When using git, create a branch and use git diff to see the differences.

Running using the Maven CLI

Upgrading applications to WebLogic 14.1.2 and Java 21

mvn -U org.openrewrite.maven:rewrite-maven-plugin:run \
  -Drewrite.recipeArtifactCoordinates=com.oracle.weblogic.rewrite:rewrite-weblogic:0.4.0 \
  -Drewrite.activeRecipes=com.oracle.weblogic.rewrite.UpgradeTo1412,org.openrewrite.java.migrate.UpgradeToJava21

Upgrading applications to WebLogic 14.1.2 and Java 17

mvn -U org.openrewrite.maven:rewrite-maven-plugin:run \
  -Drewrite.recipeArtifactCoordinates=com.oracle.weblogic.rewrite:rewrite-weblogic:0.4.0 \
  -Drewrite.activeRecipes=com.oracle.weblogic.rewrite.UpgradeTo1412,org.openrewrite.java.migrate.UpgradeToJava17

Beta Upgrading applications to WebLogic 15.1.1 beta, Jakarta EE 9.1 and Java 21

Warning

Make sure you are using an approved WebLogic Server 15.1.1 beta before deploy the migrated app

mvn -U org.openrewrite.maven:rewrite-maven-plugin:run \
  -Drewrite.recipeArtifactCoordinates=com.oracle.weblogic.rewrite:rewrite-weblogic:0.4.0 \
  -Drewrite.activeRecipes=com.oracle.weblogic.rewrite.UpgradeTo1511,org.openrewrite.java.migrate.UpgradeToJava21

Running using Maven and adding <plugin> in the pom.xml file

  • Add the plug-in to your pom.xml file and activate the desired recipe from the rewrite-weblogic group recipe. The following example illustrates Upgrade to WebLogic 14.1.2 and Migrate to Java 21.

        <plugin>
            <groupId>org.openrewrite.maven</groupId>
            <artifactId>rewrite-maven-plugin</artifactId>
            <version>5.43.0</version>
            <configuration>
                <exportDatatables>true</exportDatatables>
                <activeRecipes>
                    <recipe>com.oracle.weblogic.rewrite.UpgradeTo1412</recipe>
                    <recipe>org.openrewrite.java.migrate.UpgradeToJava21</recipe>
                </activeRecipes>
            </configuration>
            <dependencies>
                <dependency>
                    <groupId>com.oracle.weblogic.rewrite</groupId>
                    <artifactId>rewrite-weblogic</artifactId>
                    <version>0.4.0</version>
                </dependency>
                <dependency>
                    <groupId>org.openrewrite.recipe</groupId>
                    <artifactId>rewrite-migrate-java</artifactId>
                    <version>2.28.0</version>
                </dependency>
            </dependencies>
        </plugin>
  • Run the recipe mvn rewrite:run

Tip

If you just want to dry run the recipe without changing the code, use mvn rewrite:DryRun. For more details when using Maven, see here.

Tip

The goals rewrite:run and rewrite:dryRun are configured to fork Maven's life cycle and are a better choice when running recipes using a standalone goal (mvn rewrite:run) because this will trigger all the necessary life-cycle goals before running rewrite's plug-in. However, when using rewrite within the context of an integration build (mvn deploy rewrite:run), it may be more efficient to use the non-forking variants, as these will not cause duplicate life cycle phases to be called.

  • If you are using git for your repository, you can see the differences by using git diff or other diff viewers. This option will show you the differences between your original and migrated code.

Developing, contributing, and testing this recipe locally

Prerequisites

The following tools are required to build and run this project:

  • JDK (version 1.8 or higher)
  • Maven (version 3.2+) or Gradle (version 4.0+ )
  • Your code

Dry Run

mvn org.openrewrite.maven:rewrite-maven-plugin:dryRun

Run (apply changes)

mvn org.openrewrite.maven:rewrite-maven-plugin:run

Testing

mvn test