Build System & CI

Build Overview

How To Build CDAP Artifacts

  • git clone cdap project
    • git clone git@github.com:caskdata/cdap.git
  • Common Maven commands
    • Clean all modules:
      • mvn clean
    • Build all modules:
      • mvn package
    • Run all tests:
      • mvn test
    • Run checkstyle, skipping tests:
      • mvn package -DskipTests
    • Build a particular module with all dependencies:
      • mvn package -pl [module] -am
    • Run selected test:
    • Show dependency tree:
      • mvn package dependency:tree -DskipTests
    • Show dependency tree for a particular module:
      • mvn package dependency:tree -DskipTests -pl [module] -am
    • Show test output to stdout:
      • mvn -Dsurefire.redirectTestOutputToFile=false ...
    • Offline mode:
      • mvn -o ...
    • Change version:
      • mvn versions:set -DnewVersion=[new_version] -DgenerateBackupPoms=false
    • List of projects, build order and the platform details like system properties and environment variables:

Module Organization

The CDAP project is built as a multi-module maven project. While all modules are aggregated in the top-level CDAP pom, only the cdap-api module inherited from CDAP, while all others inherited from the parent module. By doing so, we have the flexibility on internal modules, while keeping the cdap-api simple.

How To Add A New Module

In situations when you want to add new module, create a sub-directory with the name of the new module. Then create a pom.xml inside that looks like this:

 

<?xml version="1.0" encoding="UTF-8"?>
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  <modelVersion>4.0.0</modelVersion>
  <parent>
    <groupId>co.cask</groupId>
    <artifactId>parent</artifactId>
    <version>[Substitute correct version here]</version>
    <relativePath>../parent/pom.xml</relativePath>
  </parent>
  <artifactId>[new_module_name]</artifactId>
  <name>CDAP [new_module_name]</name>
  <packaging>jar</packaging>
  ....
</project>

 

Then modify the top level pom.xml to include the new module

 

<?xml version="1.0" encoding="UTF-8"?>
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 
  ....
  <modules>
    <module>cask-api</module>
    <module>cask-common</module>
    ...
    <module>[new_module_name]</module>
  </modules>
  ...
</project>

 

You can also easily do it using Intellij. Just right click on the top level "CDAP" project and select New->Module and follow the screen.