Marc R. Hoffmann | 57f9ab4 | 2009-08-24 10:52:42 +0000 | [diff] [blame] | 1 | <?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> >
|
| 13 | <a href="index.html" class="el_group">Documentation</a> >
|
| 14 | <span class="el_source">Java Agent</span>
|
| 15 | </div>
|
Marc R. Hoffmann | 17be269 | 2010-02-02 05:44:47 +0000 | [diff] [blame] | 16 | <div id="content">
|
Marc R. Hoffmann | 57f9ab4 | 2009-08-24 10:52:42 +0000 | [diff] [blame] | 17 |
|
| 18 | <h1>Java Agent</h1>
|
| 19 |
|
| 20 | <p>
|
| 21 | JaCoCo uses class file instrumentation to record execution coverage data.
|
Radek Liba | ad5fbc9 | 2009-10-26 13:26:53 +0000 | [diff] [blame] | 22 | Class files are instrumented on-the-fly using a so called Java agent. This
|
Marc R. Hoffmann | 57f9ab4 | 2009-08-24 10:52:42 +0000 | [diff] [blame] | 23 | mechanism allows in-memory pre-processing of all class files during class
|
Marc R. Hoffmann | 58d7621 | 2009-10-08 15:40:46 +0000 | [diff] [blame] | 24 | 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. Hoffmann | 57f9ab4 | 2009-08-24 10:52:42 +0000 | [diff] [blame] | 26 | </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 Liba | ad5fbc9 | 2009-10-26 13:26:53 +0000 | [diff] [blame] | 30 | about the agent and its options directly. This is transparently handled by the
|
| 31 | Ant tasks.
|
Marc R. Hoffmann | 57f9ab4 | 2009-08-24 10:52:42 +0000 | [diff] [blame] | 32 | </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 Janiczak | 003d47c | 2010-01-15 00:45:17 +0000 | [diff] [blame] | 58 | <td><code>destfile</code></td>
|
Marc R. Hoffmann | 57f9ab4 | 2009-08-24 10:52:42 +0000 | [diff] [blame] | 59 | <td>Path to the output file for execution data.</td>
|
| 60 | <td><code>jacoco.exec</code></td>
|
| 61 | </tr>
|
| 62 | <tr>
|
Brock Janiczak | 003d47c | 2010-01-15 00:45:17 +0000 | [diff] [blame] | 63 | <td><code>append</code></td>
|
Marc R. Hoffmann | 57f9ab4 | 2009-08-24 10:52:42 +0000 | [diff] [blame] | 64 | <td>If set to <code>true</code> and the execution data file already
|
Brock Janiczak | 003d47c | 2010-01-15 00:45:17 +0000 | [diff] [blame] | 65 | exists, coverage data is appended to the existing file. If set to
|
Marc R. Hoffmann | 57f9ab4 | 2009-08-24 10:52:42 +0000 | [diff] [blame] | 66 | <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. Hoffmann | cf5345f | 2009-09-10 15:01:24 +0000 | [diff] [blame] | 71 | <td><code>includes</code></td>
|
Radek Liba | ad5fbc9 | 2009-10-26 13:26:53 +0000 | [diff] [blame] | 72 | <td>A list of class names that should be included in execution analysis.
|
Marc R. Hoffmann | cf5345f | 2009-09-10 15:01:24 +0000 | [diff] [blame] | 73 | 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. Hoffmann | 57f9ab4 | 2009-08-24 10:52:42 +0000 | [diff] [blame] | 91 | <td><code>exclclassloader</code></td>
|
Marc R. Hoffmann | cf5345f | 2009-09-10 15:01:24 +0000 | [diff] [blame] | 92 | <td>A list of class loader names that should be excluded from execution
|
Marc R. Hoffmann | 57f9ab4 | 2009-08-24 10:52:42 +0000 | [diff] [blame] | 93 | 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>
|
Brock Janiczak | f2d6f88 | 2010-05-04 06:47:40 +0000 | [diff] [blame] | 102 | <tr>
|
Marc R. Hoffmann | adfa118 | 2010-05-05 12:59:42 +0000 | [diff] [blame^] | 103 | <td><code>sessionid</code></td>
|
| 104 | <td>A session identifier that is written with the execution data. Without
|
| 105 | this parameter a random identifier is created by the agent.
|
| 106 | </td>
|
| 107 | <td><i>auto-generated</i></td>
|
| 108 | </tr>
|
| 109 | <tr>
|
Brock Janiczak | f2d6f88 | 2010-05-04 06:47:40 +0000 | [diff] [blame] | 110 | <td><code>dumponexit</code></td>
|
Marc R. Hoffmann | adfa118 | 2010-05-05 12:59:42 +0000 | [diff] [blame^] | 111 | <td>If set to <code>true</code> coverage data will be written on VM
|
| 112 | shutdown.
|
| 113 | </td>
|
Brock Janiczak | f2d6f88 | 2010-05-04 06:47:40 +0000 | [diff] [blame] | 114 | <td><code>true</code></td>
|
| 115 | </tr>
|
Marc R. Hoffmann | 57f9ab4 | 2009-08-24 10:52:42 +0000 | [diff] [blame] | 116 | </tbody>
|
| 117 | </table>
|
| 118 |
|
Marc R. Hoffmann | 17be269 | 2010-02-02 05:44:47 +0000 | [diff] [blame] | 119 | </div>
|
Marc R. Hoffmann | 57f9ab4 | 2009-08-24 10:52:42 +0000 | [diff] [blame] | 120 | <div class="footer">
|
Marc R. Hoffmann | df6ff96 | 2010-04-09 15:31:22 +0000 | [diff] [blame] | 121 | <div class="versioninfo"><a href="@jacoco.home.url@">JaCoCo</a> @qualified.bundle.version@</div>
|
| 122 | <a href="license.html">Copyright</a> © @copyright.years@ Mountainminds GmbH & Co. KG and Contributors
|
Marc R. Hoffmann | 57f9ab4 | 2009-08-24 10:52:42 +0000 | [diff] [blame] | 123 | </div>
|
| 124 |
|
| 125 | </body>
|
| 126 | </html> |