Plugin Documentation

Goals available for this plugin:

Goal Description
cds:addIntegrationTest Adds an integration test module to the CAP Java project. The module is created in the ./integration-tests folder and an entry to the list of modules in the parent pom.xml is added.
Call mvn cds:addIntegrationTest or mvn to add an integration test module.
It automatically detects the OData version of the CAP Java project and adds the corresponding integration test class.

Note: This goal can only be executed from the command line.

cds:addSample Add a custom handler, a unit test, and CDS sample files to the CAP Java project.
Call mvn cds:addSample or mvn to add sample classes and CDS files.

Note: This goal can only be executed from the command line.

cds:addTargetPlatform Add a target platform dependency (cds-starter-${targetPlatform}) to the service module dependencies of the CAP Java project. If the dependency already exists, nothing is done.
Call mvn cds:addTargetPlatform -DtargetPlatform=cloudfoundry or mvn -DtargetPlatform=cloudfoundry to add CloudFoundry target platform.

Note: This goal can only be executed from the command line.

cds:auto-build Performs an initial CDS build (same as mvn cds:build) and then watches for changes in the CDS model. If changes are detected, the CDS model is re-built automatically. In contrast to mvn cds:watch this goal does not start the CAP Java application.
Note: This goal can only be executed from the command line.

cds:build Perform a CDS build with Java class generation executing the following goals of the cds-maven-plugin in this order:
  1. cds:install-node
  2. cds:install-cdsdk
  3. cds:cds
  4. cds:generate
The list of goals and their order is fixed. Any Java property provided on the command line with the -D option is forwarded to the invoked goals.
Call mvn cds:build or mvn to perform the CDS build. This goal is very useful for local development to test changes to the CDS model.

Note: This goal can only be executed from the command line.

cds:cds Execute CDS commands on the CAP Java project.
Call mvn cds:cds or mvn on the command line to execute all configured CDS commands of the project in current directory.

Several CDS commands can be configured in one execution block and they’re executed in the specified order. If a command execution fails, the overall goal execution is stopped and the Maven build fails.

Note: This goal requires the installation of the @sap/cds-dk with a minimum version 4.0.0, either locally or globally. The goal cds:install-cdsdk can be used for this task.

cds:clean Delete generated files and directories of the previous build from the CAP Java project.
Call mvn cds:clean or mvn to execute cleaning from the command line.

This goal deletes the following files and directories from the resource directory of the CAP Java project:
  • file: src/main/resources/**/csn.json
  • file: src/main/resources/**/schema.sql
  • directory: src/main/resources/**/edmx/
  • directory: ${codeOutputDirectory}

cds:generate Generates Java POJOs for type-safe access to the CDS model.

This goal scans the resource directory for a csn.json file and uses it for Java source code generation. It also adds the code output directory to the project's source code directories configuration. This allows you to use the generated Java classes in your custom code without any additional configuration in the project.

cds:help Display help information on cds-maven-plugin.
Call mvn cds:help -Ddetail=true -Dgoal=<goal-name> to display parameter details.
cds:install-cdsdk Install the @sap/cds-dk into a CAP Java project.
By default, this goal looks for an already installed @sap/cds-dk and skips installation if it was found. It doesn't validate the found version against the requested version and the existing @sap/cds-dk could be outdated. Add property -Dcds.install-cdsdk.force=true to the Maven command line to force the installation of the @sap/cds-dk in the configured version.

Note: This goal ignores any dependency (including version) to @sap/cds-dk, @sap/cds or @sap/cds-compiler in the package.json of the CAP Java project.

cds:install-node Download a Node.js distribution and install it on the local file system.
If the requested version is already installed, the download and installation is skipped.

This goal also considers proxy configurations in the ~/.m2/settings.xml. If there's an active proxy for the host in the downloadUrl configured, it is used.

The goal also supports basic authentication at the downloadUrl. The optional parameter serverId can be used to reference a server configuration from settings.xml, which provides username and password. See also Settings Reference for further details about server configuration in settings.xml.

Once executed, this goal exposes the following locations as project properties:
  • ${cds.node.executable}: Location of the node executable
  • ${cds.npm.executable}: Location of the npm executable
  • ${cds.npx.executable}: Location of the npx executable
  • ${}: Directory containing the Node.js executables (node/npm/npx), can be used to enhance the $PATH environment variable

cds:npm Execute an npm command on the CAP Java project. For example, it can be used to perform an npm install to install npm dependencies which are maintained in package.json.
Call mvn cds:npm -Darguments="..." or mvn -Darguments="..." to execute npm with given arguments.

cds:npx Execute an npx command on the CAP Java project.
cds:version Prints detailed version information about the CAP Java project on the console.
Call cds:version or mvn to get detailed version information.

This goal shows the following version information about the CAP Java project and build environment:
  • version of CAP Java SDK including CDS4J
  • console output of command line cds version
  • version and location of Apache Maven
  • version and location of Java runtime
  • OS information

cds:watch Starts a CAP Java application and watches for changes in the CDS model. If changes are detected, a cds:build is performed and the application is automatically restarted. Call mvn cds:watch or mvn to start the CAP Java application.

With Spring Boot Developer Tools
In order to get even faster development cycles locally, add an optional dependency to the Spring Boot Developer Tools in the pom.xml:
In this case the watch goal leaves the restart of the application to the Developer Tools, which is faster. The CAP Java application is started with a trigger file configured, used to signal the restart: --spring.devtools.restart.trigger-file=.reloadtrigger. The watch goal touches this trigger file after the cds:build is finished to signal the Spring Boot Developer Tools a safe application restart.
The trigger file is also touched, if any other file in the project has changed and no cds:build is performed. This behaviour ensures that the application is restarted, if a Java source file was changed in an IDE and a restart makes sense to test the changes.

Without Spring Boot Developer Tools
Without a dependency to the Spring Boot Developer Tools, this goal recognises all changes of included files and fully rebuilds and restarts the application.

Note: This goal can only be executed from the command line.

System Requirements

The following specifies the minimum requirements to run this Maven plugin:

Maven 3.3.1
JDK 1.8


You should specify the version in your project's plugin configuration:

    <!-- To define the plugin version in your parent POM -->
    <!-- To use the plugin goals in your POM or parent POM -->

For more information, see "Guide to Configuring Plug-ins"