Clover Core, Ant, Eclipse and IDEA Plugins Developer Guide

Prerequisites

1. Install tools. Mandatory tools are:

  • Ant 1.9.4
  • Maven 3.2.5
  • Mercurial
  • JDK 1.6
  • IntelliJ IDEA 13
  • Eclipse 4.2.2

Optional tools are:

  • JDK 1.7, JDK 1.8 - to run tests against these JDKs
  • IDEA 14.x, 15.x, 2016.x - to run tests against newer IDEA versions
  • Eclipse 4.3.1, 4.4.0, 4.5.1, 4.6.0 - to run tests against newer Eclipse versions

 

2. Set environment variables:

  • ANT_HOME=/path/to/apache-ant
  • M2_HOME=/path/to/maven3
  • JAVA_HOME=/path/to/jdk1.6

 

3. Check out main Clover repository:

hg clone ssh://hg@bitbucket.org/openclover/clover


4. Set up paths to JDK, IDEA and Eclipse:

Open <clover>/build.properties and put proper paths.


5. Download, repack and install third party libraries:

# cd clover
mvn install -f clover-core-libs/jarjar/pom.xml
mvn install -Prepack -f clover-core-libs/pom.xml
mvn install -Prepack -f clover-idea/clover-jtreemap/pom.xml

 

6. Install Atlassian fork of KTreeMap library:

git clone https://bitbucket.org/atlassian/ktreemap
git checkout ktreemap-1.1.0-atlassian-01
mvn install

Build and test

Building from a command line

To compile application code:

ant global.build

To run tests:

ant global.test

To create Clover-for-Ant, Clover-for-IDEA and Clover-for-Eclipse packages:

ant clover-ant.pkg clover-idea.pkg clover-eclipse.pkg

To install Clover Core in .m2/repository:

ant clover-ant.mvn.install

To learn about other targets available see Build system.

Building Clover from IntelliJ IDEA

  1. Compile sources using Ant first using 'ant global.build'. This is because the script downloads third party JARs as well as generates some Java sources.
  2. Open Clover project in IDEA - just select the directory containing Clover code (.idea folder and *.iml files are versioned in SCM).
  3. Open project settings and
    1. define JDKs named '1.6', '1.7', '1.8'. While Clover is compiled using JDK 1.6, there are two test projects using JDK 1.7 and 1.8.
    2. define IntelliJ Platform Plugin SDK named 'IDEA 13.0.0' (you can actually use the newest 13.1.7 bug-fix version). 
    3. configure path to 'eclipse-4.2.2' library
  4. Whole project should be compile-able now. There shall be no need to define other libraries or to change paths etc.

Release and publish

To create a snapshot version of Clover Core as well as plugins for Ant, Eclipse and IDEA:

ant global.clean clover-ant.pkg clover-idea.pkg clover-eclipse.pkg

 

To create a stable version of Clover Core as well as plugins for Ant, Eclipse and IDEA:

  1. update "core.release.base" and "core.release.num.sanitised" in /common.xml

  2. update com.atlassian.clover.registry.format.RegHeader#REG_FORMAT_VERSION (only if format of the database has changed)

  3. run a command 
ant global.clean mvn.versioncheck prod.mvn.setup clover-ant.prod clover-idea.prod clover-eclipse.prod -Dclover.prod.build=true -Dpath.to.mvn=/path/to/apache-maven-3.2.5/bin/mvn

Artefacts will be created in:

  • Clover API JavaDoc - clover-ant/target/javadoc
  • Clover Core - clover-ant/target/clover-*.jar, pom.xml
  • Clover-for-Ant - clover-ant/target/clover-ant-*.zip
  • Clover-for-Eclipse - clover-eclipse/target/main/com.atlassian.clover.eclipse.updatesite_*.zip
  • Clover-for-IDEA - clover-idea/target/clover-idea.jar