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.
Performing transformation requires the container runtime to be configured.
7.1. Transforming applications source code Copier lienLien copié sur presse-papiers!
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.
You can only use a single target to run the transform overwrite
command.
Prerequisites
- You configured the container runtime.
Procedure
Display the available
OpenRewrite
recipes:mta-cli transform openrewrite --list-targets
$ mta-cli transform openrewrite --list-targets
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Transform the application source code:
mta-cli transform openrewrite --input=<path_to_source_code> --target=<target_from_the_list>
$ mta-cli transform openrewrite --input=<path_to_source_code> --target=<target_from_the_list>
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Verification
-
Inspect the target application source code
diff
to see the transformation.
7.2. Available OpenRewrite recipes Copier lienLien copié sur presse-papiers!
The following are the OpenRewrite
recipes that you can use for transforming application source code.
Migration path | Purpose | The rewrite.config file location | Active recipes |
---|---|---|---|
Java EE to Jakarta EE |
Replace import of
Replace |
|
|
Java EE to Jakarta EE | Rename bootstrapping files. |
|
|
Java EE to Jakarta EE |
Transform the |
|
|
Spring Boot to Quarkus |
Replace |
|
|
7.3. The openrewrite command options Copier lienLien copié sur presse-papiers!
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.
Option | Description |
---|---|
|
A target goal. The default is |
|
Display all |
| A path to the application source code directory. |
| List all available OpenRewrite recipes. |
| A path to a custom Maven settings file. |
| A target OpenRewrite recipe. |
|
A log level. The default is |
| Do not clean up temporary resources. |
7.4. Converting XML rules to YAML rules Copier lienLien copié sur presse-papiers!
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.
The mta-cli analyze
converts also automatically converts XML rules to YAML rules.
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>
$ mta-cli transform rules --input=<path_to_xml_rules> --output=<path_to_output_directory>
7.5. The rules command options Copier lienLien copié sur presse-papiers!
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.
Option | Description |
---|---|
|
Display all |
| A path to XML rule files or a directory. |
| A path to the output directory. |
|
A log level. The default is |