You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: guides/extensibility/composition.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -134,7 +134,7 @@ Add the dependency to the reuse package to your `pom.xml`:
134
134
:::
135
135
136
136
As Maven dependencies are - in contrast to `npm` packages - downloaded into a global cache, you need to make the artifacts from the reuse package available in your project locally.
137
-
The CDS Maven Plugin provides a simple goal named `resolve`, that performs this task for you and extracts reuse packages into the `target/cds/` folder of the Maven project.
137
+
The CDS Maven Plugin provides a simple goal named `resolve`, that performs this task for you and extracts reuse packages into the `target/cds/` folder of the CAP project.
138
138
Include this goal into the `pom.xml`, if not already present:
Copy file name to clipboardExpand all lines: java/building-plugins.md
+8-9Lines changed: 8 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -22,7 +22,7 @@ In the following sections, the different extension points and mechanisms are exp
22
22
23
23
### Java Version
24
24
25
-
When building CAP Java plugin modules, you need to keep in mind that the generated Java byte code of the plugin has to be compatible with the Java byte code version of the potential consumers of the plugin. To be on the safe side, we recommend using *Java 17* as this is anyways the minimum Java version for CAP Java (for 2.x release) applications. In case you deviate from this you need to check and align with the potential consumers of the plugin.
25
+
When building CAP Java plugin modules, you need to keep in mind that the generated Java byte code of the plugin has to be compatible with the Java byte code version of the potential consumers of the plugin. To be on the safe side, we recommend using *Java 17* as this is anyways the minimum Java version for CAP Java applications. In case you deviate from this you need to check and align with the potential consumers of the plugin.
26
26
27
27
### Maven GroupId and Java Packages
28
28
@@ -31,13 +31,12 @@ Of course, it's up to your project / plugin how you call the corresponding Maven
31
31
32
32
## Share CDS Models via Maven Artifacts
33
33
34
-
Before the CAP Java 2.2 release CDS definitions had to be shared as Node.js modules, also for Java projects.
35
-
36
-
Starting with the 2.2 release CDS models, CSV import data and i18n files can now be shared through Maven dependencies in addition to npm packages. This means you can now provide CDS models, CSV files, i18n files, and Java code (for example, event handlers) in a single Maven dependency.
34
+
CDS models, CSV import data and i18n files can be shared through Maven dependencies. In addition they can also be shared through npm packages.
35
+
This means you can provide CDS models, CSV files, i18n files, and Java code (for example, event handlers) in a single Maven dependency.
37
36
38
37
### Create the CDS Model in a New Maven Artifact
39
38
40
-
Simply create a plain Maven Java project and place your CDS models in the `main/resources/cds` folder of the reuse package under a unique module directory (for example, leveraging group ID and artifact ID): `src/main/resources/cds/com.sap.capire/bookshop/`. With `com.sap.capire` being the group ID and `bookshop` being the artifact ID.
39
+
Simply create a plain Maven Java project and place your CDS models in the `src/main/resources/cds` folder of the reuse package under a unique module directory (for example, leveraging group ID and artifact ID): `src/main/resources/cds/com.sap.capire/bookshop/`. With `com.sap.capire` being the group ID and `bookshop` being the artifact ID.
41
40
42
41
You can simplify the creation of such a **plain Maven Java** project by calling the following Maven archetype command:
43
42
@@ -65,7 +64,7 @@ Projects wanting to import the content simply add a Maven dependency to the reus
65
64
```
66
65
:::
67
66
68
-
Additionally, the new `resolve` goal from the CDS Maven Plugin needs to be added, to extract the models into the `target/cds/` folder of the Maven project, in order to make them available to the CDS Compiler.
67
+
Additionally, the `resolve` goal from the CDS Maven Plugin needs to be added, to extract the models into the `target/cds/` folder of the Maven project, in order to make them available to the CDS Compiler.
69
68
70
69
::: code-group
71
70
```xml [srv/pom.xml]
@@ -87,8 +86,8 @@ Additionally, the new `resolve` goal from the CDS Maven Plugin needs to be added
87
86
```
88
87
:::
89
88
90
-
::: details Reuse module as Maven module
91
-
Please be aware that the module that uses the reuse module needs to be a Maven module itself or a submodule to a Maven module that declares the dependency to the Maven module. Usually you would declare the dependency in the `srv` module of your CAP Java project and use the reuse model in the service's CDS files then. In case you want to use the reuse model in your `db` module you need to make sure that your `db` module is a Maven module and include it to the project's parent `pom.xml` file.
89
+
::: details Scope of the Reuse Package
90
+
Usually you would declare the dependency to the reuse package in the `srv`module of your CAP Java project. Since CAP Java 4.4.0 this makes the reuse models available to all CDS files in the CAP project. The models are extracted to the root `target/cds` folder. In case you want to make the reuse models only available within the Maven module that declared the dependency (e.g. `srv`) set the configuration `to` of the `resolve` goal to `${project.build.directory}`. In earlier versions of CAP Java reuse models where only available within CDS files placed in the Maven module that declared the dependency by default.
92
91
:::
93
92
94
93
When your Maven build is set up correctly, you can use the reuse models in your CDS files using the standard `using` directive:
@@ -112,7 +111,7 @@ In most of the cases an event handler plugin for a CAP Java application can be a
0 commit comments