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 com.sap.cds:cds-maven-plugin:watch
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
:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<optional>true</optional>
</dependency>
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.