blob: 64e80253d3e75c6096f17d15e456c94fbc1f1697 [file] [log] [blame]
Marc R. Hoffmann57f9ab42009-08-24 10:52:42 +00001<?xml version="1.0" encoding="ISO-8859-1" ?>
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=ISO-8859-1" />
6 <link rel="stylesheet" href=".resources/doc.css" charset="ISO-8859-1" type="text/css" />
7 <title>JaCoCo - Java Agent</title>
8</head>
9<body>
10
11<div class="breadcrumb">
12 <a href="../index.html" class="el_session">JaCoCo</a> &gt;
13 <a href="index.html" class="el_group">Documentation</a> &gt;
14 <span class="el_source">Java Agent</span>
15</div>
Marc R. Hoffmann17be2692010-02-02 05:44:47 +000016<div id="content">
Marc R. Hoffmann57f9ab42009-08-24 10:52:42 +000017
18<h1>Java Agent</h1>
19
20<p>
21 JaCoCo uses class file instrumentation to record execution coverage data.
Radek Libaad5fbc92009-10-26 13:26:53 +000022 Class files are instrumented on-the-fly using a so called Java agent. This
Marc R. Hoffmann57f9ab42009-08-24 10:52:42 +000023 mechanism allows in-memory pre-processing of all class files during class
Marc R. Hoffmann58d76212009-10-08 15:40:46 +000024 loading independent of the application framework. The JaCoCo agent collects
25 execution information and dumps it to a local file when the JVM exits.
Marc R. Hoffmann57f9ab42009-08-24 10:52:42 +000026</p>
27
28<p class="hint">
29 If you use the <a href="ant.html">JaCoCo Ant tasks</a> you don't have to care
Radek Libaad5fbc92009-10-26 13:26:53 +000030 about the agent and its options directly. This is transparently handled by the
31 Ant tasks.
Marc R. Hoffmann57f9ab42009-08-24 10:52:42 +000032</p>
33
34<p>
35 The agent <code>jacocoagent.jar</code> is part of the JaCoCo distribution and
36 includes all required dependencies. A Java agent can be activated with the
37 following JVM option:
38</p>
39
40<pre>
41 -javaagent:<i>[yourpath/]</i>jacocoagent.jar=<i>[option1]</i>=<i>[value1]</i>,<i>[option2]</i>=<i>[value2]</i>
42</pre>
43
44<p>
45 The JaCoCo agent accepts the following options:
46</p>
47
48<table class="coverage">
49 <thead>
50 <tr>
51 <td>Option</td>
52 <td>Description</td>
53 <td>Default</td>
54 </tr>
55 </thead>
56 <tbody>
57 <tr>
Brock Janiczak003d47c2010-01-15 00:45:17 +000058 <td><code>destfile</code></td>
Marc R. Hoffmann57f9ab42009-08-24 10:52:42 +000059 <td>Path to the output file for execution data.</td>
60 <td><code>jacoco.exec</code></td>
61 </tr>
62 <tr>
Brock Janiczak003d47c2010-01-15 00:45:17 +000063 <td><code>append</code></td>
Marc R. Hoffmann57f9ab42009-08-24 10:52:42 +000064 <td>If set to <code>true</code> and the execution data file already
Brock Janiczak003d47c2010-01-15 00:45:17 +000065 exists, coverage data is appended to the existing file. If set to
Marc R. Hoffmann57f9ab42009-08-24 10:52:42 +000066 <code>false</code>, an existing execution data file will be replaced.
67 </td>
68 <td><code>true</code></td>
69 </tr>
70 <tr>
Marc R. Hoffmanncf5345f2009-09-10 15:01:24 +000071 <td><code>includes</code></td>
Radek Libaad5fbc92009-10-26 13:26:53 +000072 <td>A list of class names that should be included in execution analysis.
Marc R. Hoffmanncf5345f2009-09-10 15:01:24 +000073 The list entries are separated by a vertical bar (<code>|</code>) and
74 may use wildcard characters (<code>*</code> and <code>?</code>).
75 Except for performance optimization or technical corner cases this
76 option is normally not required.
77 </td>
78 <td><code>*</code> (all classes)</td>
79 </tr>
80 <tr>
81 <td><code>excludes</code></td>
82 <td>A list of class names that should be excluded from execution analysis.
83 The list entries are separated by a vertical bar (<code>|</code>) and
84 may use wildcard characters (<code>*</code> and <code>?</code>).
85 Except for performance optimization or technical corner cases this
86 option is normally not required.
87 </td>
88 <td><i>empty</i> (no excluded classes)</td>
89 </tr>
90 <tr>
Marc R. Hoffmann57f9ab42009-08-24 10:52:42 +000091 <td><code>exclclassloader</code></td>
Marc R. Hoffmanncf5345f2009-09-10 15:01:24 +000092 <td>A list of class loader names that should be excluded from execution
Marc R. Hoffmann57f9ab42009-08-24 10:52:42 +000093 analysis. The list entries are separated by a vertical bar
94 (<code>|</code>) and may use wildcard characters (<code>*</code> and
95 <code>?</code>). This option might be required in case of special
96 frameworks that conflict with JaCoCo code instrumentation, in
97 particular class loaders that do not have access to the Java runtime
98 classes.
99 </td>
100 <td><code>sun.reflect.DelegatingClassLoader</code></td>
101 </tr>
102 </tbody>
103</table>
104
Marc R. Hoffmann17be2692010-02-02 05:44:47 +0000105</div>
Marc R. Hoffmann57f9ab42009-08-24 10:52:42 +0000106<div class="footer">
Marc R. Hoffmanndf6ff962010-04-09 15:31:22 +0000107 <div class="versioninfo"><a href="@jacoco.home.url@">JaCoCo</a> @qualified.bundle.version@</div>
108 <a href="license.html">Copyright</a> &copy; @copyright.years@ Mountainminds GmbH &amp; Co. KG and Contributors
Marc R. Hoffmann57f9ab42009-08-24 10:52:42 +0000109</div>
110
111</body>
112</html>