Class CdsResolveMojo

java.lang.Object
org.apache.maven.plugin.AbstractMojo
com.sap.cds.maven.plugin.AbstractCdsMojo
com.sap.cds.maven.plugin.build.CdsResolveMojo
All Implemented Interfaces:
CdsMojoLogger, org.apache.maven.plugin.ContextEnabled, org.apache.maven.plugin.Mojo

@Mojo(name="resolve", defaultPhase=GENERATE_SOURCES, aggregator=true, requiresDependencyCollection=COMPILE_PLUS_RUNTIME, requiresDependencyResolution=COMPILE_PLUS_RUNTIME) public class CdsResolveMojo extends AbstractCdsMojo
Extracts models from dependency JARs and places them in target/cds/ for reuse by the CDS Compiler.
Models in JARs are expected to be placed in the cds resources folder. All contents in this folder are copied to target/cds/. It is recommended to specify a unique folder structure for your models, for example by reusing group ID and artifact ID of the JAR.
Here is an example JAR layout:
 com/example/.../Some.class
 cds/
   com.example.cds/
     my-reuse-models/
       index.cds
       Foo.cds
       data/
         com.example.cds-Foo.csv
       i18n/
         i18n.properties
 
You can then refer to these reuse models in your CDS files:
 using { com.example.cds.Foo as Foo } from 'com.example.cds/my-reuse-models';
 
If your dependency is listed in the srv/pom.xml the reuse models are only available in CDS files placed in the srv folder. This ensures that multiple independent application modules can define their reuse artifacts independently. If you place a dependency in the root pom.xml the reuse models are available in all modules, including the db folder.
Since:
2.2.0
  • Constructor Details

    • CdsResolveMojo

      public CdsResolveMojo()
  • Method Details

    • execute

      public void execute() throws org.apache.maven.plugin.MojoExecutionException
      Throws:
      org.apache.maven.plugin.MojoExecutionException