aboutsummaryrefslogtreecommitdiff
path: root/org.jacoco.doc/docroot/doc/maven.html
blob: 0c113116b5e38e06ed39e3734502d77108cd2ad5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en">
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
  <link rel="stylesheet" href=".resources/doc.css" charset="UTF-8" type="text/css" />
  <link rel="stylesheet" href="../coverage/.resources/prettify.css" charset="UTF-8" type="text/css" />
  <link rel="shortcut icon" href=".resources/report.gif" type="image/gif" />
  <script type="text/javascript" src="../coverage/.resources/prettify.js"></script>
  <title>JaCoCo - Maven Plug-in</title>
</head>
<body onload="prettyPrint()">

<div class="breadcrumb">
  <a href="../index.html" class="el_report">JaCoCo</a> &gt;
  <a href="index.html" class="el_group">Documentation</a> &gt;
  <span class="el_source">Maven Plug-in</span>
</div>
<div id="content"> 

<h1>Maven Plug-in</h1>

<p>
  The JaCoCo <a href="http://maven.apache.org/">Maven</a> plug-in provides the
  JaCoCo runtime agent to your tests and allows basic report creation.
</p>

<p class="hint">
  If you want to have line number information included in the coverage reports
  or you want source code highlighting the class files of the test target must
  be compiled with debug information.
</p>

<h2>Example</h2>

<p>
  The JaCoCo distribution contains a simple example how code coverage can be
  added to a Maven project. This <a href="examples/build/pom.xml">POM file</a>
  for a JAR project runs JUnit tests under code coverage and creates a coverage
  report. The complete example is located in the <code>./doc/examples/build</code>
  folder of the distribution.
</p>


<h2>Prerequisites</h2>

<p>
  The JaCoCo Maven plug-in requires
</p>

<ul>
  <li>Maven 2.1.0 or higher and</li>
  <li>Java 1.5 or higher (for both, the Maven runtime and the test executor).</li>
</ul>


<h2>Usage</h2>

<p>
  The Maven plug-in can be included in your build with the following
  declaration. Please check
  <a href="http://search.maven.org/#search|ga|1|g%3Aorg.jacoco%20a%3Ajacoco-maven-plugin">here</a>
  for the latest release version in the repository.
</p>

<pre class="source lang-xml linenums">
&lt;plugin&gt;
  &lt;groupId&gt;org.jacoco&lt;/groupId&gt;
  &lt;artifactId&gt;jacoco-maven-plugin&lt;/artifactId&gt;
  &lt;version&gt;@project.version@&lt;/version&gt;
&lt;/plugin&gt;
</pre>

<p>
  To receive a full list of goals and available parameters you can use
  <code>maven-help-plugin</code>:
</p>
<pre>
mvn help:describe -Dplugin=org.jacoco:jacoco-maven-plugin -Ddetail
</pre>

<h2>Goals</h2>

<p>
  The JaCoCo Maven plug-in defines the following goals:
</p>

<ul>
  <li><a href="help-mojo.html">help</a></li>
  <li><a href="prepare-agent-mojo.html">prepare-agent</a></li>
  <li><a href="report-mojo.html">report</a></li>
  <li><a href="check-mojo.html">check</a></li>
  <li><a href="instrument-mojo.html">instrument</a></li>
  <li><a href="restore-instrumented-classes-mojo.html">restore-instrumented-classes</a></li>
</ul>

</div>
<div class="footer">
  <span class="right"><a href="@jacoco.home.url@">JaCoCo</a> @qualified.bundle.version@</span>
  <a href="license.html">Copyright</a> &copy; @copyright.years@ Mountainminds GmbH &amp; Co. KG and Contributors
</div>

</body>
</html>