Ce contenu n'est pas disponible dans la langue sélectionnée.

Chapter 7. Performing a transformation with the MTA command-line interface


You can use transformation to perform the following actions:

  • Transform Java applications source code by using the transform openrewrite command.
  • Convert XML rules to YAML rules by using the transform rules command.
Important

Performing transformation requires the container runtime to be configured.

7.1. Transforming applications source code

To update Java libraries or frameworks, for example, javax or Spring Boot, you can transform Java application source code by using the transform openrewrite command. The openrewrite subcommand allows running OpenRewrite recipes on source code.

Note

You can only use a single target to run the transform overwrite command.

Prerequisites

  • You configured the container runtime.

Procedure

  1. Display the available OpenRewrite recipes:

    $ mta-cli transform openrewrite --list-targets
    Copy to Clipboard Toggle word wrap
  2. Transform the application source code:

    $ mta-cli transform openrewrite --input=<path_to_source_code> --target=<target_from_the_list>
    Copy to Clipboard Toggle word wrap

Verification

  • Inspect the target application source code diff to see the transformation.

7.2. Available OpenRewrite recipes

The following are the OpenRewrite recipes that you can use for transforming application source code.

Expand
Table 7.1. Available OpenRewrite recipes
Migration pathPurposeThe rewrite.config file locationActive recipes

Java EE to Jakarta EE

Replace import of javax packages with equivalent jakarta packages.

Replace javax artifacts, declared within pom.xml files, with the jakarta equivalents.

<MTA_HOME>/rules/openrewrite/jakarta \ /javax/imports/rewrite.yml

org.jboss.windup.JavaxToJakarta

Java EE to Jakarta EE

Rename bootstrapping files.

<MTA_HOME>/rules/openrewrite/jakarta \ /javax/bootstrapping/rewrite.yml

org.jboss.windup.jakarta.javax. \ BootstrappingFiles

Java EE to Jakarta EE

Transform the persistence.xml file configuration.

<MTA_HOME>/rules/openrewrite/jakarta \ /javax/xml/rewrite.yml

org.jboss.windup.javax-jakarta. \ PersistenceXML

Spring Boot to Quarkus

Replace spring.jpa.hibernate.ddl-auto property within files matching application*.properties.

<MTA_HOME>/rules/openrewrite/quarkus \ /springboot/properties/rewrite.yml

org.jboss.windup.sb-quarkus.Properties

7.3. The openrewrite command options

The following are the options that you can use together with the mta-cli transform openrewrite command to adjust the command behavior to your needs.

Expand
Table 7.2. The mta-cli transform openrewrite command options
OptionDescription

--goal (string)

A target goal. The default is "dryRun".

--help

Display all mta-cli transform openrewrite command options.

--input (string)

A path to the application source code directory.

--list-targets

List all available OpenRewrite recipes.

-maven-settings (string)

A path to a custom Maven settings file.

--target (string)

A target OpenRewrite recipe.

--log-level uint32

A log level. The default is 4.

--no-cleanup

Do not clean up temporary resources.

7.4. Converting XML rules to YAML rules

You can convert the MTA XML rules to the analyzer-lsp YAML rules, which are easier to maintain, by using the mta-cli transform rules command. To convert the rules, the rules subcommand uses the windup-shim tool.

Note

The mta-cli analyze converts also automatically converts XML rules to YAML rules.

Note

analyzer-lsp is the tool that evaluates the rules for the language providers and determines rule matches.

Prerequisites

  • You have the Podman tool installed and running.
  • If your system is in a disconnected environment, you copied Podman images to the file system of the disconnected device and uploaded these images to the local Podman.

Procedure

  • Convert the XML rules to the YAML rules:
$ mta-cli transform rules --input=<path_to_xml_rules> --output=<path_to_output_directory>
Copy to Clipboard Toggle word wrap

7.5. The rules command options

The following are the options that you can use together with the mta-cli transform rules command to adjust the command behavior to your needs.

Expand
Table 7.3. The the mta-cli transform rules command options
OptionDescription

--help

Display all mta-cli transform rules command options.

--input (stringArray)

A path to XML rule files or a directory.

--output (string)

A path to the output directory.

--log-level (int)

A log level. The default is 5.

Retour au début
Red Hat logoGithubredditYoutubeTwitter

Apprendre

Essayez, achetez et vendez

Communautés

À propos de la documentation Red Hat

Nous aidons les utilisateurs de Red Hat à innover et à atteindre leurs objectifs grâce à nos produits et services avec un contenu auquel ils peuvent faire confiance. Découvrez nos récentes mises à jour.

Rendre l’open source plus inclusif

Red Hat s'engage à remplacer le langage problématique dans notre code, notre documentation et nos propriétés Web. Pour plus de détails, consultez le Blog Red Hat.

À propos de Red Hat

Nous proposons des solutions renforcées qui facilitent le travail des entreprises sur plusieurs plates-formes et environnements, du centre de données central à la périphérie du réseau.

Theme

© 2025 Red Hat