• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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> &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 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&lt;?xml version="1.0" encoding="UTF8"?&gt;
79&lt;toolchains&gt;
80  &lt;toolchain&gt;
81    &lt;type&gt;jdk&lt;/type&gt;
82    &lt;provides&gt;
83      &lt;id&gt;java15&lt;/id&gt;
84      &lt;version&gt;1.5&lt;/version&gt;
85      &lt;vendor&gt;sun&lt;/vendor&gt;
86    &lt;/provides&gt;
87    &lt;configuration&gt;
88      &lt;jdkHome&gt;/usr/lib/jvm/sun-jdk-1.5&lt;/jdkHome&gt;
89    &lt;/configuration&gt;
90  &lt;/toolchain&gt;
91  &lt;toolchain&gt;
92    &lt;type&gt;jdk&lt;/type&gt;
93    &lt;provides&gt;
94      &lt;id&gt;java16&lt;/id&gt;
95      &lt;version&gt;1.6&lt;/version&gt;
96      &lt;vendor&gt;sun&lt;/vendor&gt;
97    &lt;/provides&gt;
98    &lt;configuration&gt;
99      &lt;jdkHome&gt;/usr/lib/jvm/sun-jdk-1.6&lt;/jdkHome&gt;
100    &lt;/configuration&gt;
101  &lt;/toolchain&gt;
102  &lt;toolchain&gt;
103    &lt;type&gt;jdk&lt;/type&gt;
104    &lt;provides&gt;
105      &lt;id&gt;java17&lt;/id&gt;
106      &lt;version&gt;1.7&lt;/version&gt;
107      &lt;vendor&gt;sun&lt;/vendor&gt;
108    &lt;/provides&gt;
109    &lt;configuration&gt;
110      &lt;jdkHome&gt;/usr/lib/jvm/sun-jdk-1.7&lt;/jdkHome&gt;
111    &lt;/configuration&gt;
112  &lt;/toolchain&gt;
113  &lt;toolchain&gt;
114    &lt;type&gt;jdk&lt;/type&gt;
115    &lt;provides&gt;
116      &lt;id&gt;java18&lt;/id&gt;
117      &lt;version&gt;1.8&lt;/version&gt;
118      &lt;vendor&gt;sun&lt;/vendor&gt;
119    &lt;/provides&gt;
120    &lt;configuration&gt;
121      &lt;jdkHome&gt;/usr/lib/jvm/sun-jdk-1.8&lt;/jdkHome&gt;
122    &lt;/configuration&gt;
123  &lt;/toolchain&gt;
124  &lt;toolchain&gt;
125    &lt;type&gt;jdk&lt;/type&gt;
126    &lt;provides&gt;
127      &lt;id&gt;java19&lt;/id&gt;
128      &lt;version&gt;1.9&lt;/version&gt;
129      &lt;vendor&gt;sun&lt;/vendor&gt;
130    &lt;/provides&gt;
131    &lt;configuration&gt;
132      &lt;jdkHome&gt;/usr/lib/jvm/sun-jdk-1.9&lt;/jdkHome&gt;
133    &lt;/configuration&gt;
134  &lt;/toolchain&gt;
135&lt;/toolchains&gt;
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> &copy; @copyright.years@ Mountainminds GmbH &amp; Co. KG and Contributors
184</div>
185
186</body>
187</html>
188