Build System & CI
Build Overview
- We use Maven as our build system
- Docs:Â Available Plugins
- Docs:Â Help Plugin
- The top level module to check out which orchestrates all the build process
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:
mvn -Dtest=TestClass,TestMore*Class,TestClassMethod#methodName -DfailIfNoTests=false test
- See http://maven.apache.org/surefire/maven-surefire-plugin/examples/single-test.html for more
- 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
- Clean all modules:
- List of projects, build order and the platform details like system properties and environment variables:
mvn help:system
- 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" ?>          xsi:schemaLocation = "http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" >   < 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" ?>          xsi:schemaLocation = "http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" >    ....   < 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.