Skip to content

Commit 2ff882d

Browse files
rjayasingherenejeglinskybeckermarcchgeo
authored
add section for CAP Java OpenRewrite recipes (#2194)
Co-authored-by: René Jeglinsky <rene.jeglinsky@sap.com> Co-authored-by: Marc Becker <marc.becker@sap.com> Co-authored-by: Christian Georgi <christian.georgi@sap.com>
1 parent 5395e49 commit 2ff882d

File tree

1 file changed

+30
-2
lines changed

1 file changed

+30
-2
lines changed

java/migration.md

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
11
---
2-
synopsis: >
2+
synopsis:
33
This chapter contains comprehensive guides that help you to work through migrations such as from CAP Java 1.x to CAP Java 2.x.
44
uacp: Used as link target from Help Portal at https://help.sap.com/products/BTP/65de2977205c403bbc107264b8eccf4b/9186ed9ab00842e1a31309ff1be38792.html
55
---
66

77
<script setup>
88
import Cds4j from './components/Cds4jLink.vue'
99
import CdsSrv from './components/CdsServicesLink.vue'
10+
import { useData } from 'vitepress'
11+
const { theme } = useData()
12+
const { versions } = theme.value.capire
1013
</script>
1114

1215

@@ -22,7 +25,31 @@ uacp: Used as link target from Help Portal at https://help.sap.com/products/BTP/
2225

2326
[[toc]]
2427

25-
## CAP Java 4.9 to CAP Java 5.0 { #four-to-five }
28+
## Automatic CAP Java Migrations with OpenRewrite
29+
30+
For any Java related changes of the CAP Java APIs we try to make the transition from the old version to the new version as smooth as possible. Consequently, we provide [OpenRewrite recipes](https://docs.openrewrite.org) with migrations for our API changes so that larger projects can easily consume them.
31+
32+
### Running OpenRewrite Recipes
33+
34+
As migration is a one-time operation, run the OpenRewrite `recipes` as a command through Maven. Take this call as an example:
35+
36+
37+
```bash-vue
38+
mvn org.openrewrite.maven:rewrite-maven-plugin:run \
39+
-Drewrite.recipeArtifactCoordinates=com.sap.cds:cds-services-recipes:{{ versions.java_services }} \
40+
-Drewrite.activeRecipes=com.sap.cds.services.migrations.MigrateStatements \
41+
-DskipMavenParsing=true
42+
```
43+
44+
Here, the *migration* `com.sap.cds.services.migrations.MigrateStatements` from CAP Java's OpenRewrite Maven artifact `com.sap.cds:cds-services-recipes` is called in the given project context. The *migration* is a container for one or more recipes. A recipe is a rule that tells OpenRewrite how to transform code.
45+
46+
### Currently Released CAP Java Migrations
47+
48+
|Name |Description|Available since|
49+
|--------|-----------|---------------|
50+
|[com.sap.cds.services.migrations.MigrateStatements](../releases/2025/aug25#typed-query-results)|Migrates CQN statements to comply with typed Query API changes in 4.3.0.|4.3.0|
51+
52+
## CAP Java 4.9 to CAP Java 5.0 (TBA) { #four-to-five }
2653

2754
### Spring Boot 4
2855

@@ -1426,3 +1453,4 @@ After rebuilding and restarting your application, your Application Services are
14261453
<!-- TODO: Move this to "Development" section -->
14271454

14281455
<span id="afterenablingodata" />
1456+

0 commit comments

Comments
 (0)