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/.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/.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> &gt;
16  <a href="index.html" class="el_group">Documentation</a> &gt;
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 fully based on <a href="http://maven.apache.org/">Maven</a>
25  and its extension <a href="http://www.eclipse.org/tycho/">Tycho</a> to build
26  OSGi bundles based on the declations in their <code>MANIFEST.MF</code> file
27  ("manfest-first" approach). The build can be locally executed on every machine
28  with a proper <a href="environment.html">environment setup</a>. In particular
29  you need a <a href="http://maven.apache.org/">Maven 3</a> installation.
30  Developers are encouraged to run the build before every commit to ensure
31  consistency of the source tree.
32</p>
33
34
35<h2>Running the Build</h2>
36
37<p>
38  The build can be started by executing the following command with
39  <code>./org.jacoco.build/</code> as the working directory:
40</p>
41
42<pre>
43  mvn clean install
44</pre>
45
46<p>
47  Total build time is typically around 3 minutes, however first build might take
48  more time, because Maven should download plugins and dependencies. The
49  download ZIP will be created at the following location:
50</p>
51
52<pre>
53  ./org.jacoco.doc/target/jacoco-<i>x.y.z.qualifier</i>.zip
54</pre>
55
56
57<h2>Running Quick Build without Tests</h2>
58
59<p>
60  It is not recommended, however possible to the run build without any tests:
61</p>
62
63<pre>
64  mvn clean install -DskipTests
65</pre>
66
67
68<h2>Testing with different JDKs</h2>
69
70<p>
71  Target Java version for JaCoCo builds is 1.5, however for verification
72  purposes you can execute tests using other versions. In order to do so, first
73  you should create file <code>toolchains.xml</code> in <code>~/.m2/</code>
74  directory. Here is an example of such file. For more information see
75  <a href="http://maven.apache.org/guides/mini/guide-using-toolchains.html">Maven
76  Guide to Using Toolchains</a>.
77</p>
78
79<pre class="source lang-xml linenums">
80&lt;?xml version="1.0" encoding="UTF8"?&gt;
81&lt;toolchains&gt;
82  &lt;toolchain&gt;
83    &lt;type&gt;jdk&lt;/type&gt;
84    &lt;provides&gt;
85      &lt;id&gt;java15&lt;/id&gt;
86      &lt;version&gt;1.5&lt;/version&gt;
87      &lt;vendor&gt;sun&lt;/vendor&gt;
88    &lt;/provides&gt;
89    &lt;configuration&gt;
90      &lt;jdkHome&gt;/usr/lib/jvm/sun-jdk-1.5&lt;/jdkHome&gt;
91    &lt;/configuration&gt;
92  &lt;/toolchain&gt;
93  &lt;toolchain&gt;
94    &lt;type&gt;jdk&lt;/type&gt;
95    &lt;provides&gt;
96      &lt;id&gt;java16&lt;/id&gt;
97      &lt;version&gt;1.6&lt;/version&gt;
98      &lt;vendor&gt;sun&lt;/vendor&gt;
99    &lt;/provides&gt;
100    &lt;configuration&gt;
101      &lt;jdkHome&gt;/usr/lib/jvm/sun-jdk-1.6&lt;/jdkHome&gt;
102    &lt;/configuration&gt;
103  &lt;/toolchain&gt;
104  &lt;toolchain&gt;
105    &lt;type&gt;jdk&lt;/type&gt;
106    &lt;provides&gt;
107      &lt;id&gt;java17&lt;/id&gt;
108      &lt;version&gt;1.7&lt;/version&gt;
109      &lt;vendor&gt;sun&lt;/vendor&gt;
110    &lt;/provides&gt;
111    &lt;configuration&gt;
112      &lt;jdkHome&gt;/usr/lib/jvm/sun-jdk-1.7&lt;/jdkHome&gt;
113    &lt;/configuration&gt;
114  &lt;/toolchain&gt;
115  &lt;toolchain&gt;
116    &lt;type&gt;jdk&lt;/type&gt;
117    &lt;provides&gt;
118      &lt;id&gt;java18&lt;/id&gt;
119      &lt;version&gt;1.8&lt;/version&gt;
120      &lt;vendor&gt;sun&lt;/vendor&gt;
121    &lt;/provides&gt;
122    &lt;configuration&gt;
123      &lt;jdkHome&gt;/usr/lib/jvm/sun-jdk-1.8&lt;/jdkHome&gt;
124    &lt;/configuration&gt;
125  &lt;/toolchain&gt;
126&lt;/toolchains&gt;
127</pre>
128
129<p>
130  Now you should be able to execute maven build with specified version of JDK:
131</p>
132
133<pre>
134  mvn clean install -Djdk.version=<i>version</i>
135</pre>
136
137<p>
138  Location of <code>toolchains.xml</code> can be set via an option:
139</p>
140
141<pre>
142  mvn --toolchains <i>path</i> clean install -Djdk.version=<i>version</i>
143</pre>
144
145<p>
146  In addition JaCoCo can be compiled for higher class file versions than 1.5
147  specifying the property <code>bytecode.version</code>. Note that in this case
148  the version of the JVM running Maven must be at least the version of the
149  specified bytecode version as this JVM is also running the tests. Combining
150  these options JaCoCo is regularly tested with the following setups:
151</p>
152
153<ul>
154  <li>Maven with 1.5 JDK: <code>mvn clean install -Djdk.version=1.5 -Dbytecode.version=1.5</code></li>
155  <li>Maven with 1.6 JDK: <code>mvn clean install -Djdk.version=1.6 -Dbytecode.version=1.6</code></li>
156  <li>Maven with 1.7 JDK: <code>mvn clean install -Djdk.version=1.7 -Dbytecode.version=1.7</code></li>
157  <li>Maven with 1.8 JDK: <code>mvn clean install -Djdk.version=1.8 -Dbytecode.version=1.8</code></li>
158</ul>
159
160
161</div>
162<div class="footer">
163  <span class="right"><a href="@jacoco.home.url@">JaCoCo</a> @qualified.bundle.version@</span>
164  <a href="license.html">Copyright</a> &copy; @copyright.years@ Mountainminds GmbH &amp; Co. KG and Contributors
165</div>
166
167</body>
168</html>
169