Skip to content

Commit 2293e22

Browse files
authored
Maven modules are now globally resolved by default (#2113)
@rjayasinghe Can't add you as reviewer somehow. Maybe you are not yet properly onboarded into the new capire GitHub org?
1 parent d6a5a40 commit 2293e22

File tree

2 files changed

+9
-10
lines changed

2 files changed

+9
-10
lines changed

guides/extensibility/composition.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ Add the dependency to the reuse package to your `pom.xml`:
134134
:::
135135

136136
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.
138138
Include this goal into the `pom.xml`, if not already present:
139139

140140
::: code-group

java/building-plugins.md

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ In the following sections, the different extension points and mechanisms are exp
2222

2323
### Java Version
2424

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.
2626

2727
### Maven GroupId and Java Packages
2828

@@ -31,13 +31,12 @@ Of course, it's up to your project / plugin how you call the corresponding Maven
3131

3232
## Share CDS Models via Maven Artifacts
3333

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.
3736

3837
### Create the CDS Model in a New Maven Artifact
3938

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.
4140

4241
You can simplify the creation of such a **plain Maven Java** project by calling the following Maven archetype command:
4342

@@ -65,7 +64,7 @@ Projects wanting to import the content simply add a Maven dependency to the reus
6564
```
6665
:::
6766

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.
6968

7069
::: code-group
7170
```xml [srv/pom.xml]
@@ -87,8 +86,8 @@ Additionally, the new `resolve` goal from the CDS Maven Plugin needs to be added
8786
```
8887
:::
8988

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.
9291
:::
9392

9493
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
112111

113112
```xml
114113
<properties>
115-
<cds.services.version>2.4.0</cds.services.version>
114+
<cds.services.version>...</cds.services.version>
116115
</properties>
117116

118117
<dependencyManagement>

0 commit comments

Comments
 (0)