1<?xml version="1.0" encoding="UTF-8" ?> 2<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> 3<html xmlns="http://www.w3.org/1999/xhtml" lang="en"> 4<head> 5 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> 6 <link rel="stylesheet" href="resources/doc.css" charset="UTF-8" type="text/css" /> 7 <link rel="stylesheet" href="../coverage/jacoco-resources/prettify.css" charset="UTF-8" type="text/css" /> 8 <link rel="shortcut icon" href="resources/report.gif" type="image/gif" /> 9 <script type="text/javascript" src="../coverage/jacoco-resources/prettify.js"></script> 10 <title>JaCoCo - Build</title> 11</head> 12<body onload="prettyPrint()"> 13 14<div class="breadcrumb"> 15 <a href="../index.html" class="el_report">JaCoCo</a> > 16 <a href="index.html" class="el_group">Documentation</a> > 17 <span class="el_source">Build</span> 18</div> 19<div id="content"> 20 21<h1>Build</h1> 22 23<p> 24 The JaCoCo build is based on <a href="http://maven.apache.org/">Maven</a> and 25 can be locally executed on every machine with a proper 26 <a href="environment.html">environment setup</a>. In particular you need a 27 <a href="http://maven.apache.org/">Maven 3</a> installation. Developers are 28 encouraged to run the build before every commit to ensure consistency of the 29 source tree. 30</p> 31 32 33<h2>Running the Build</h2> 34 35<p> 36 The build can be started by executing the following command with 37 <code>./org.jacoco.build/</code> as the working directory: 38</p> 39 40<pre> 41 mvn clean install 42</pre> 43 44<p> 45 Total build time is typically around 3 minutes, however first build might take 46 more time, because Maven should download plugins and dependencies. The 47 download ZIP will be created at the following location: 48</p> 49 50<pre> 51 ./jacoco/target/jacoco-<i>x.y.z.qualifier</i>.zip 52</pre> 53 54 55<h2>Running Quick Build without Tests</h2> 56 57<p> 58 It is not recommended, however possible to the run build without any tests: 59</p> 60 61<pre> 62 mvn clean install -DskipTests 63</pre> 64 65 66<h2>Testing with different JDKs</h2> 67 68<p> 69 Target Java version for JaCoCo builds is 1.5, however for verification 70 purposes you can execute tests using other versions. In order to do so, first 71 you should create file <code>toolchains.xml</code> in <code>~/.m2/</code> 72 directory. Here is an example of such file. For more information see 73 <a href="http://maven.apache.org/guides/mini/guide-using-toolchains.html">Maven 74 Guide to Using Toolchains</a>. 75</p> 76 77<pre class="source lang-xml linenums"> 78<?xml version="1.0" encoding="UTF8"?> 79<toolchains> 80 <toolchain> 81 <type>jdk</type> 82 <provides> 83 <id>java15</id> 84 <version>1.5</version> 85 <vendor>sun</vendor> 86 </provides> 87 <configuration> 88 <jdkHome>/usr/lib/jvm/sun-jdk-1.5</jdkHome> 89 </configuration> 90 </toolchain> 91 <toolchain> 92 <type>jdk</type> 93 <provides> 94 <id>java16</id> 95 <version>1.6</version> 96 <vendor>sun</vendor> 97 </provides> 98 <configuration> 99 <jdkHome>/usr/lib/jvm/sun-jdk-1.6</jdkHome> 100 </configuration> 101 </toolchain> 102 <toolchain> 103 <type>jdk</type> 104 <provides> 105 <id>java17</id> 106 <version>1.7</version> 107 <vendor>sun</vendor> 108 </provides> 109 <configuration> 110 <jdkHome>/usr/lib/jvm/sun-jdk-1.7</jdkHome> 111 </configuration> 112 </toolchain> 113 <toolchain> 114 <type>jdk</type> 115 <provides> 116 <id>java18</id> 117 <version>1.8</version> 118 <vendor>sun</vendor> 119 </provides> 120 <configuration> 121 <jdkHome>/usr/lib/jvm/sun-jdk-1.8</jdkHome> 122 </configuration> 123 </toolchain> 124 <toolchain> 125 <type>jdk</type> 126 <provides> 127 <id>java19</id> 128 <version>1.9</version> 129 <vendor>sun</vendor> 130 </provides> 131 <configuration> 132 <jdkHome>/usr/lib/jvm/sun-jdk-1.9</jdkHome> 133 </configuration> 134 </toolchain> 135</toolchains> 136</pre> 137 138<p> 139 Now you should be able to execute maven build with specified version of JDK: 140</p> 141 142<pre> 143 mvn clean install -Djdk.version=<i>version</i> 144</pre> 145 146<p> 147 Location of <code>toolchains.xml</code> can be set via an option: 148</p> 149 150<pre> 151 mvn --toolchains <i>path</i> clean install -Djdk.version=<i>version</i> 152</pre> 153 154<p> 155 Also Eclipse Compiler for Java can be used for compilation: 156</p> 157 158<pre> 159 mvn clean install -Decj 160</pre> 161 162<p> 163 In addition JaCoCo can be compiled for higher class file versions than 1.5 164 specifying the property <code>bytecode.version</code>. Note that in this case 165 the version of the JVM running Maven must be at least the version of the 166 specified bytecode version as this JVM is also running the tests. Combining 167 these options JaCoCo is regularly tested with the following setups: 168</p> 169 170<ul> 171 <li>Maven with 1.5 JDK: <code>mvn clean install -Djdk.version=1.5 -Dbytecode.version=1.5</code></li> 172 <li>Maven with 1.6 JDK: <code>mvn clean install -Djdk.version=1.6 -Dbytecode.version=1.6</code></li> 173 <li>Maven with 1.7 JDK: <code>mvn clean install -Djdk.version=1.7 -Dbytecode.version=1.7</code></li> 174 <li>Maven with 1.8 JDK: <code>mvn clean install -Djdk.version=1.8 -Dbytecode.version=1.8</code></li> 175 <li>Maven with 1.8 JDK: <code>mvn clean install -Djdk.version=1.8 -Dbytecode.version=1.8 -Decj</code></li> 176 <li>Maven with 1.9 JDK: <code>mvn clean install -Djdk.version=1.9 -Dbytecode.version=1.9</code></li> 177</ul> 178 179 180</div> 181<div class="footer"> 182 <span class="right"><a href="@jacoco.home.url@">JaCoCo</a> @qualified.bundle.version@</span> 183 <a href="license.html">Copyright</a> © @copyright.years@ Mountainminds GmbH & Co. KG and Contributors 184</div> 185 186</body> 187</html> 188