Home | History | Annotate | Download | only in manual
      1 <!doctype html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
      2 <html>
      3 <head>
      4 <meta http-equiv="content-type" content="text/html; charset=iso-8859-1">
      5 <meta http-equiv="content-style-type" content="text/css">
      6 <link rel="stylesheet" type="text/css" href="style.css">
      7 <title>Ant Task</title>
      8 <script type="text/javascript" language="JavaScript">
      9 <!--
     10 if (window.self==window.top)
     11   window.top.location.replace("../index.html#"+window.location.pathname+window.location.hash);
     12 else {
     13   var hash="#"+window.location.pathname.replace(window.top.location.pathname.replace("index.html", ""), "");
     14   if (window.top.location.hash!=hash)
     15     window.top.location.hash=hash;
     16 }
     17 //-->
     18 </script>
     19 </head>
     20 <body>
     21 
     22 <h2>Ant Task</h2>
     23 
     24 <b>ProGuard</b> can be run as a task in the Java-based build tool Ant (version
     25 1.6.0 or higher).
     26 <p>
     27 
     28 Before you can use the <code>proguard</code> task, you have to tell Ant about
     29 this new task. The easiest way is to add the following line to your
     30 <code>build.xml</code> file:
     31 <p>
     32 
     33 <pre>
     34 &lt;taskdef resource="proguard/ant/task.properties"
     35          classpath="/usr/local/java/proguard/lib/proguard.jar" /&gt;
     36 </pre>
     37 <p>
     38 
     39 Please make sure the class path is set correctly for your system.
     40 <p>
     41 
     42 There are three ways to configure the ProGuard task:
     43 <ol>
     44 <li>using an external configuration file,</li>
     45 <li>using embedded ProGuard configuration options, or</li>
     46 <li>using the equivalent XML configuration tags.</li>
     47 </ol>
     48 These three ways can be combined, depending on practical circumstances and
     49 personal preference.
     50 <p>
     51 
     52 <h3>1. An external ProGuard configuration file</h3>
     53 
     54 The simplest way to use the ProGuard task in an Ant build file is to keep your
     55 ProGuard configuration file, and include it from Ant. You can include your
     56 ProGuard configuration file by setting
     57 the <a href="#configuration_attribute"><code>configuration</code></a>
     58 attribute of your
     59 <code>proguard</code> task. Your ant build file will then look like this:
     60 <p>
     61 
     62 <pre>
     63 &lt;taskdef resource="proguard/ant/task.properties"
     64          classpath="/usr/local/java/proguard/lib/proguard.jar" /&gt;
     65 &lt;proguard configuration="myconfigfile.pro"/&gt;
     66 </pre>
     67 <p>
     68 
     69 This is a convenient option if you prefer ProGuard's configuration style over
     70 XML, if you want to keep your build file small, or if you have to share your
     71 configuration with developers who don't use Ant.
     72 <p>
     73 
     74 <h3>2. Embedded ProGuard configuration options</h3>
     75 
     76 Instead of keeping an external ProGuard configuration file, you can also copy
     77 the contents of the file into the nested text of the <code>proguard</code> task
     78 (the PCDATA area). Your Ant build file will then look like this:
     79 <p>
     80 
     81 <pre>
     82 &lt;taskdef resource="proguard/ant/task.properties"
     83          classpath="/usr/local/java/proguard/lib/proguard.jar" /&gt;
     84 &lt;proguard&gt;
     85   -libraryjars ${java.home}/lib/rt.jar
     86   -injars      in.jar
     87   -outjars     out.jar
     88 
     89   -keepclasseswithmembers public class * {
     90       public static void main(java.lang.String[]);
     91   }
     92 &lt;/proguard&gt;
     93 </pre>
     94 <p>
     95 
     96 Some minor syntactical changes are required in order to conform with the XML
     97 standard.
     98 <p>
     99 
    100 Firstly, the <code>#</code> character cannot be used for comments in an XML
    101 file. Comments must be enclosed by an opening <code>&lt;!--</code> and a
    102 closing <code>--&gt;</code>. All occurrences of the <code>#</code> character
    103 can be removed.
    104 <p>
    105 
    106 Secondly, the use of <code>&lt;</code> and <code>&gt;</code> characters would
    107 upset the structure of the XML build file. Environment variables can be
    108 specified with the usual Ant style <code>${...}</code>, instead of the ProGuard
    109 style <code>&lt;...&gt;</code>.  Other occurrences of <code>&lt;</code> and
    110 <code>&gt;</code> have to be encoded as <code>&amp;lt;</code> and
    111 <code>&amp;gt;</code> respectively.
    112 <p>
    113 
    114 <h3>3. XML configuration tags</h3>
    115 
    116 If you really prefer a full-blown XML configuration, you can replace the
    117 ProGuard configuration options by XML configuration tags. The resulting
    118 configuration will be equivalent, but much more verbose and difficult to read,
    119 as XML goes. The remainder of this page presents the supported tags. For a
    120 more extensive discussion of their meaning, please consult the traditional <a
    121 href="usage.html">Usage</a> section. You can find some sample configuration
    122 files in the <code>examples/ant</code> directory of the ProGuard distribution.
    123 <p>
    124 
    125 <h2><a name="proguard">Task Attributes and Nested Elements</a></h2>
    126 
    127 The <code><b>&lt;proguard&gt;</b></code> task and the
    128 <code><b>&lt;proguardconfiguration&gt;</b></code> task can have the following
    129 attributes (only for <code>&lt;proguard&gt;</code>) and nested
    130 elements:
    131 
    132 <dl>
    133 
    134 <dt><a name="configuration_attribute"><code><b>configuration</b></code></a>
    135     = "<i>filename</i>"</dt>
    136 <dd>Read and merge options from the given ProGuard-style configuration
    137     file. Note: for reading multiple configuration files or XML-style
    138     configurations, use the <a
    139     href="#configuration_element"><code>configuration</code></a>
    140     <i>element</i>.</dd>
    141 
    142 <dt><a href="usage.html#skipnonpubliclibraryclasses"><code><b>skipnonpubliclibraryclasses</b></code></a>
    143     = "<i>boolean</i>"
    144     (default = false)</dt>
    145 <dd>Ignore non-public library classes.</dd>
    146 
    147 <dt><a href="usage.html#dontskipnonpubliclibraryclassmembers"><code><b>skipnonpubliclibraryclassmembers</b></code></a>
    148     = "<i>boolean</i>"
    149     (default = true)</dt>
    150 <dd>Ignore package visible library class members.</dd>
    151 
    152 <dt><a href="usage.html#target"><code><b>target</b></code></a>
    153     = "<i>version</i>"
    154     (default = none)</dt>
    155 <dd>Set the given version number in the processed classes.</dd>
    156 
    157 <dt><a href="usage.html#forceprocessing"><code><b>forceprocessing</b></code></a>
    158     = "<i>boolean</i>"
    159     (default = false)</dt>
    160 <dd>Process the input, even if the output seems up to date.</dd>
    161 
    162 <dt><a href="usage.html#printseeds"><code><b>printseeds</b></code></a>
    163     = "<i>boolean or filename</i>"
    164     (default = false)</dt>
    165 <dd>List classes and class members matched by the various <code>keep</code>
    166     commands, to the standard output or to the given file.</dd>
    167 
    168 <dt><a href="usage.html#dontshrink"><code><b>shrink</b></code></a>
    169     = "<i>boolean</i>"
    170     (default = true)</dt>
    171 <dd>Shrink the input class files.</dd>
    172 
    173 <dt><a href="usage.html#printusage"><code><b>printusage</b></code></a>
    174     = "<i>boolean or filename</i>"
    175     (default = false)</dt>
    176 <dd>List dead code of the input class files, to the standard output or to the
    177     given file.</dd>
    178 
    179 <dt><a href="usage.html#dontoptimize"><code><b>optimize</b></code></a>
    180     = "<i>boolean</i>"
    181     (default = true)</dt>
    182 <dd>Optimize the input class files.</dd>
    183 
    184 <dt><a href="usage.html#optimizationpasses"><code><b>optimizationpasses</b></code></a>
    185     = "<i>n</i>"
    186     (default = 1)</dt>
    187 <dd>The number of optimization passes to be performed.</dd>
    188 
    189 <dt><a href="usage.html#allowaccessmodification"><code><b>allowaccessmodification</b></code></a>
    190     = "<i>boolean</i>"
    191     (default = false)</dt>
    192 <dd>Allow the access modifiers of classes and class members to be modified,
    193     while optimizing.</dd>
    194 
    195 <dt><a href="usage.html#mergeinterfacesaggressively"><code><b>mergeinterfacesaggressively</b></code></a>
    196     = "<i>boolean</i>"
    197     (default = false)</dt>
    198 <dd>Allow any interfaces to be merged, while optimizing.</dd>
    199 
    200 <dt><a href="usage.html#dontobfuscate"><code><b>obfuscate</b></code></a>
    201     = "<i>boolean</i>"
    202    (default = true)</dt>
    203 <dd>Obfuscate the input class files.</dd>
    204 
    205 <dt><a href="usage.html#printmapping"><code><b>printmapping</b></code></a>
    206     = "<i>boolean or filename</i>"
    207     (default = false)</dt>
    208 <dd>Print the mapping from old names to new names for classes and class members
    209     that have been renamed, to the standard output or to the given file.</dd>
    210 
    211 <dt><a href="usage.html#applymapping"><code><b>applymapping</b></code></a>
    212     = "<i>filename</i>"
    213     (default = none)</dt>
    214 <dd>Reuse the given mapping, for incremental obfuscation.</dd>
    215 
    216 <dt><a href="usage.html#obfuscationdictionary"><code><b>obfuscationdictionary</b></code></a>
    217     = "<i>filename</i>"
    218     (default = none)</dt>
    219 <dd>Use the words in the given text file as obfuscated field names and method
    220     names.</dd>
    221 
    222 <dt><a href="usage.html#classobfuscationdictionary"><code><b>classobfuscationdictionary</b></code></a>
    223     = "<i>filename</i>"
    224     (default = none)</dt>
    225 <dd>Use the words in the given text file as obfuscated class names.</dd>
    226 
    227 <dt><a href="usage.html#packageobfuscationdictionary"><code><b>packageobfuscationdictionary</b></code></a>
    228     = "<i>filename</i>"
    229     (default = none)</dt>
    230 <dd>Use the words in the given text file as obfuscated package names.</dd>
    231 
    232 <dt><a href="usage.html#overloadaggressively"><code><b>overloadaggressively</b></code></a>
    233     = "<i>boolean</i>"
    234     (default = false)</dt>
    235 <dd>Apply aggressive overloading while obfuscating.</dd>
    236 
    237 <dt><a href="usage.html#useuniqueclassmembernames"><code><b>useuniqueclassmembernames</b></code></a>
    238     = "<i>boolean</i>"
    239     (default = false)</dt>
    240 <dd>Ensure uniform obfuscated class member names for subsequent incremental
    241     obfuscation.</dd>
    242 
    243 <dt><a href="usage.html#dontusemixedcaseclassnames"><code><b>usemixedcaseclassnames</b></code></a>
    244     = "<i>boolean</i>"
    245     (default = true)</dt>
    246 <dd>Generate mixed-case class names while obfuscating.</dd>
    247 
    248 <dt><a href="usage.html#flattenpackagehierarchy"><code><b>flattenpackagehierarchy</b></code></a>
    249     = "<i>package_name</i>"
    250     (default = none)</dt>
    251 <dd>Repackage all packages that are renamed into the single given parent
    252     package.</dd>
    253 
    254 <dt><a href="usage.html#repackageclasses"><code><b>repackageclasses</b></code></a>
    255     = "<i>package_name</i>"
    256     (default = none)</dt>
    257 <dd>Repackage all class files that are renamed into the single given
    258     package.</dd>
    259 
    260 <dt><a href="usage.html#keepparameternames"><code><b>keepparameternames</b></code></a>
    261     = "<i>boolean</i>"
    262    (default = false)</dt>
    263 <dd>Keep the parameter names and types of methods that are kept.</dd>
    264 
    265 <dt><a href="usage.html#renamesourcefileattribute"><code><b>renamesourcefileattribute</b></code></a>
    266     = "<i>string</i>"
    267     (default = none)</dt>
    268 <dd>Put the given constant string in the <code>SourceFile</code>
    269     attributes.</dd>
    270 
    271 <dt><a href="usage.html#dontpreverify"><code><b>preverify</b></code></a>
    272     = "<i>boolean</i>"
    273     (default = true)</dt>
    274 <dd>Preverify the processed class files if they are targeted at Java Micro
    275     Edition or at Java 6 or higher.</dd>
    276 
    277 <dt><a href="usage.html#microedition"><code><b>microedition</b></code></a>
    278     = "<i>boolean</i>"
    279     (default = false)</dt>
    280 <dd>Target the processed class files at Java Micro Edition.</dd>
    281 
    282 <dt><a href="usage.html#verbose"><code><b>verbose</b></code></a>
    283     = "<i>boolean</i>"
    284     (default = false)</dt>
    285 <dd>Write out some more information during processing.</dd>
    286 
    287 <dt><a href="usage.html#dontnote"><code><b>note</b></code></a>
    288     = "<i>boolean</i>"
    289    (default = true)</dt>
    290 <dd>Print notes about potential mistakes or omissions in the configuration.
    291     Use the nested element <a href="#dontnote">dontnote</a> for more
    292     fine-grained control.</dd>
    293 
    294 <dt><a href="usage.html#dontwarn"><code><b>warn</b></code></a>
    295     = "<i>boolean</i>"
    296     (default = true)</dt>
    297 <dd>Print warnings about unresolved references. Use the nested
    298     element <a href="#dontwarn">dontwarn</a> for more fine-grained
    299     control. <i>Only use this option if you know what you're doing!</i></dd>
    300 
    301 <dt><a href="usage.html#ignorewarnings"><code><b>ignorewarnings</b></code></a>
    302     = "<i>boolean</i>"
    303     (default = false)</dt>
    304 <dd>Print warnings about unresolved references, but continue processing
    305     anyhow. <i>Only use this option if you know what you're doing!</i></dd>
    306 
    307 <dt><a href="usage.html#printconfiguration"><code><b>printconfiguration</b></code></a>
    308     = "<i>boolean or filename</i>"
    309     (default = false)</dt>
    310 <dd>Write out the entire configuration in traditional ProGuard style, to the
    311     standard output or to the given file. Useful to replace unreadable
    312     XML configurations.</dd>
    313 
    314 <dt><a href="usage.html#dump"><code><b>dump</b></code></a>
    315     = "<i>boolean or filename</i>"
    316     (default = false)</dt>
    317 <dd>Write out the internal structure of the processed class files, to the
    318     standard output or to the given file.</dd>
    319 
    320 <dt><a href="usage.html#injars"><code><b>&lt;injar</b></code></a>
    321     <a href="#classpath"><i>class_path</i></a>
    322     <code><b>/&gt;</b></code></dt>
    323 <dd>Specifies the program jars (or wars, ears, zips, or directories).</dd>
    324 
    325 <dt><a href="usage.html#outjars"><code><b>&lt;outjar</b></code></a>
    326     <a href="#classpath"><i>class_path</i></a>
    327     <code><b>/&gt;</b></code></dt>
    328 <dd>Specifies the names of the output jars (or wars, ears, zips, or
    329     directories).</dd>
    330 
    331 <dt><a href="usage.html#libraryjars"><code><b>&lt;libraryjar</b></code></a>
    332     <a href="#classpath"><i>class_path</i></a>
    333     <code><b>/&gt;</b></code></dt>
    334 <dd>Specifies the library jars (or wars, ears, zips, or directories).</dd>
    335 
    336 <dt><a href="usage.html#keepdirectories"><code><b>&lt;keepdirectory name = </b></code></a>"<i>directory_name</i>"
    337     <code><b>/&gt;</b></code><br/>
    338     <a href="usage.html#keepdirectories"><code><b>&lt;keepdirectories filter = </b></code></a>"<a href="usage.html#filefilters"><i>directory_filter</i></a>"
    339     <code><b>/&gt;</b></code></dt>
    340 <dd>Keep the specified directories in the output jars (or wars, ears, zips, or
    341     directories).</dd>
    342 
    343 <dt><a href="usage.html#keep"><code><b>&lt;keep</b></code></a>
    344     <a href="#keepmodifier"><i>modifiers</i></a>
    345     <a href="#classspecification"><i>class_specification</i></a>
    346     <code><b>&gt;</b></code>
    347     <a href="#classmemberspecification"><i>class_member_specifications</i></a>
    348     <code><b>&lt;/keep&gt;</b></code></dt>
    349 <dd>Preserve the specified classes <i>and</i> class members.</dd>
    350 
    351 <dt><a href="usage.html#keepclassmembers"><code><b>&lt;keepclassmembers</b></code></a>
    352     <a href="#keepmodifier"><i>modifiers</i></a>
    353     <a href="#classspecification"><i>class_specification</i></a>
    354     <code><b>&gt;</b></code>
    355     <a href="#classmemberspecification"><i>class_member_specifications</i></a>
    356     <code><b>&lt;/keepclassmembers&gt;</b></code></dt>
    357 <dd>Preserve the specified class members, if their classes are preserved as
    358     well.</dd>
    359 
    360 <dt><a href="usage.html#keepclasseswithmembers"><code><b>&lt;keepclasseswithmembers</b></code></a>
    361     <a href="#keepmodifier"><i>modifiers</i></a>
    362     <a href="#classspecification"><i>class_specification</i></a>
    363     <code><b>&gt;</b></code>
    364     <a href="#classmemberspecification"><i>class_member_specifications</i></a>
    365     <code><b>&lt;/keepclasseswithmembers&gt;</b></code></dt>
    366 <dd>Preserve the specified classes <i>and</i> class members, if all of the
    367     specified class members are present.</dd>
    368 
    369 <dt><a href="usage.html#keepnames"><code><b>&lt;keepnames</b></code></a>
    370     <a href="#classspecification"><i>class_specification</i></a>
    371     <code><b>&gt;</b></code>
    372     <a href="#classmemberspecification"><i>class_member_specifications</i></a>
    373     <code><b>&lt;/keepnames&gt;</b></code></dt>
    374 <dd>Preserve the names of the specified classes <i>and</i> class members (if
    375     they aren't removed in the shrinking step).</dd>
    376 
    377 <dt><a href="usage.html#keepclassmembernames"><code><b>&lt;keepclassmembernames</b></code></a>
    378     <a href="#classspecification"><i>class_specification</i></a>
    379     <code><b>&gt;</b></code>
    380     <a href="#classmemberspecification"><i>class_member_specifications</i></a>
    381     <code><b>&lt;/keepclassmembernames&gt;</b></code></dt>
    382 <dd>Preserve the names of the specified class members (if they aren't removed
    383     in the shrinking step).</dd>
    384 
    385 <dt><a href="usage.html#keepclasseswithmembernames"><code><b>&lt;keepclasseswithmembernames</b></code></a>
    386     <a href="#classspecification"><i>class_specification</i></a>
    387     <code><b>&gt;</b></code>
    388     <a href="#classmemberspecification"><i>class_member_specifications</i></a>
    389     <code><b>&lt;/keepclasseswithmembernames&gt;</b></code></dt>
    390 <dd>Preserve the names of the specified classes <i>and</i> class members, if
    391     all of the specified class members are present (after the shrinking
    392     step).</dd>
    393 
    394 <dt><a href="usage.html#whyareyoukeeping"><code><b>&lt;whyareyoukeeping</b></code></a>
    395     <a href="#classspecification"><i>class_specification</i></a>
    396     <code><b>&gt;</b></code>
    397     <a href="#classmemberspecification"><i>class_member_specifications</i></a>
    398     <code><b>&lt;/whyareyoukeeping&gt;</b></code></dt>
    399 <dd>Print details on why the given classes and class members are being kept in
    400     the shrinking step.</dd>
    401 
    402 <dt><a href="usage.html#assumenosideeffects"><code><b>&lt;assumenosideeffects</b></code></a>
    403     <a href="#classspecification"><i>class_specification</i></a>
    404     <code><b>&gt;</b></code>
    405     <a href="#classmemberspecification"><i>class_member_specifications</i></a>
    406     <code><b>&lt;/assumenosideeffects&gt;</b></code></dt>
    407 <dd>Assume that the specified methods don't have any side effects, while
    408     optimizing. <i>Only use this option if you know what you're
    409     doing!</i></dd>
    410 
    411 <dt><a href="usage.html#optimizations"><code><b>&lt;optimization name = </b></code></a>"<a href="optimizations.html"><i>optimization_name</i></a>"
    412     <code><b>/&gt;</b></code><br/>
    413     <a href="usage.html#optimizations"><code><b>&lt;optimizations filter = </b></code></a>""<a href="optimizations.html"><i>optimization_filter</i></a>"
    414     <code><b>/&gt;</b></code></dt>
    415 <dd>Perform only the specified optimizations.</dd>
    416 
    417 <dt><a href="usage.html#keeppackagenames"><code><b>&lt;keeppackagename name = </b></code></a>"<i>package_name</i>"
    418     <code><b>/&gt;</b></code><br/>
    419     <a href="usage.html#keeppackagenames"><code><b>&lt;keeppackagenames filter = </b></code></a>"<a href="usage.html#filters"><i>package_filter</i></a>"
    420     <code><b>/&gt;</b></code></dt>
    421 <dd>Keep the specified package names from being obfuscated. If no name is
    422     given, all package names are preserved.</dd>
    423 
    424 <dt><a href="usage.html#keepattributes"><code><b>&lt;keepattribute name = </b></code></a>"<i>attribute_name</i>"
    425     <code><b>/&gt;</b></code><br/>
    426     <a href="usage.html#keepattributes"><code><b>&lt;keepattributes filter = </b></code></a>"<a href="usage.html#filters"><i>attribute_filter</i></a>"
    427     <code><b>/&gt;</b></code></dt>
    428 <dd>Preserve the specified optional Java bytecode attributes, with optional
    429     wildcards. If no name is given, all attributes are preserved.</dd>
    430 
    431 <dt><a href="usage.html#adaptclassstrings"><code><b>&lt;adaptclassstrings filter = </b></code></a>"<a href="usage.html#filters"><i>class_filter</i></a>"
    432     <code><b>/&gt;</b></code></dt>
    433 <dd>Adapt string constants in the specified classes, based on the obfuscated
    434     names of any corresponding classes.</dd>
    435 
    436 <dt><a href="usage.html#adaptresourcefilenames"><code><b>&lt;adaptresourcefilenames filter = </b></code></a>"<a href="usage.html#filefilters"><i>file_filter</i></a>"
    437     <code><b>/&gt;</b></code></dt>
    438 <dd>Rename the specified resource files, based on the obfuscated names of the
    439     corresponding class files.</dd>
    440 
    441 <dt><a href="usage.html#adaptresourcefilecontents"><code><b>&lt;adaptresourcefilecontents filter = </b></code></a>"<a href="usage.html#filefilters"><i>file_filter</i></a>"
    442     <code><b>/&gt;</b></code></dt>
    443 <dd>Update the contents of the specified resource files, based on the
    444     obfuscated names of the processed classes.</dd>
    445 
    446 <dt><a name="dontnote" />
    447     <a href="usage.html#dontnote"><code><b>&lt;dontnote filter = </b></code></a>"<a href="usage.html#filters"><i>class_filter</i></a>"
    448     <code><b>/&gt;</b></code></dt>
    449 <dd>Don't print notes about classes matching the specified class name
    450     filter.</dd>
    451 
    452 <dt><a name="dontwarn" />
    453     <a href="usage.html#dontwarn"><code><b>&lt;dontwarn filter = </b></code></a>"<a href="usage.html#filters"><i>class_filter</i></a>"
    454     <code><b>/&gt;</b></code></dt>
    455 <dd>Don't print warnings about classes matching the specified class name
    456     filter. <i>Only use this option if you know what you're doing!</i></dd>
    457 
    458 <dt><a name="configuration_element"><code><b>&lt;configuration refid = </b></code></a>"<i>ref_id</i>"
    459     <code><b>/&gt;</b></code><br/>
    460     <code><b>&lt;configuration file = </b></code>"<i>name</i>"
    461     <code><b>/&gt;</b></code></dt>
    462 <dd>The first form includes the XML-style configuration specified in a
    463     <code>&lt;proguardconfiguration&gt;</code> task (or
    464     <code>&lt;proguard&gt;</code> task) with attribute <code>id</code> =
    465     "<i>ref_id</i>". Only the nested elements of this configuration are
    466     considered, not the attributes.
    467     <p>
    468     The second form includes the ProGuard-style configuration from the specified
    469     file. The element is actually a <code>fileset</code> element and supports
    470     all of its attributes and nested elements, including multiple files.
    471     </dd>
    472 
    473 </dl>
    474 
    475 <h2><a name="classpath">Class Path Attributes and Nested Elements</a></h2>
    476 
    477 The jar elements are <code>path</code> elements, so they can have any of the
    478 standard <code>path</code> attributes and nested elements. The most common
    479 attributes are:
    480 
    481 <dl>
    482 
    483 <dt><code><b>path</b></code> = "<i>path</i>"</dt>
    484 <dd>The names of the jars (or wars, ears, zips, or directories), separated by
    485     the path separator.</dd>
    486 
    487 <dt><code><b>location</b></code> = "<i>name</i>" (or <code><b>file</b></code>
    488     = "<i>name</i>", or <code><b>dir</b></code> = "<i>name</i>", or
    489     <code><b>name</b></code> = "<i>name</i>")</dt>
    490 <dd>Alternatively, the name of a single jar (or war, ear, zip, or
    491     directory).</dd>
    492 
    493 <dt><code><b>refid</b></code> = "<i>ref_id</i>"</dt>
    494 <dd>Alternatively, a reference to the path or file set with the attribute
    495     <code>id</code> = "<i>ref_id</i>".</dd>
    496 
    497 </dl>
    498 
    499 In addition, the jar elements can have ProGuard-style filter attributes:
    500 
    501 <dl>
    502 
    503 <dt><code><b>filter</b></code> =
    504     "<a href="usage.html#filefilters"><i>file_filter</i></a>"</dt>
    505 <dd>An optional filter for all class file names and resource file names that
    506     are encountered.</dd>
    507 
    508 <dt><code><b>jarfilter</b></code> =
    509     "<a href="usage.html#filefilters"><i>file_filter</i></a>"</dt>
    510 <dd>An optional filter for all jar names that are encountered.</dd>
    511 
    512 <dt><code><b>warfilter</b></code> =
    513     "<a href="usage.html#filefilters"><i>file_filter</i></a>"</dt>
    514 <dd>An optional filter for all war names that are encountered.</dd>
    515 
    516 <dt><code><b>earfilter</b></code> =
    517     "<a href="usage.html#filefilters"><i>file_filter</i></a>"</dt>
    518 <dd>An optional filter for all ear names that are encountered.</dd>
    519 
    520 <dt><code><b>zipfilter</b></code> =
    521     "<a href="usage.html#filefilters"><i>file_filter</i></a>"</dt>
    522 <dd>An optional filter for all zip names that are encountered.</dd>
    523 
    524 </dl>
    525 
    526 <h2><a name="keepmodifier">Keep Modifier Attributes</a></h2>
    527 
    528 The keep tags can have the following <i>modifier</i> attributes:
    529 
    530 <dl>
    531 
    532 <dt><a href="usage.html#allowshrinking"><code><b>allowshrinking</b></code></a>
    533     = "<i>boolean</i>"
    534     (default = false)</dt>
    535 <dd>Specifies whether the entry points specified in the keep tag may be
    536     shrunk.</dd>
    537 
    538 <dt><a href="usage.html#allowoptimization"><code><b>allowoptimization</b></code></a>
    539     = "<i>boolean</i>"
    540     (default = false)</dt>
    541 <dd>Specifies whether the entry points specified in the keep tag may be
    542     optimized.</dd>
    543 
    544 <dt><a href="usage.html#allowobfuscation"><code><b>allowobfuscation</b></code></a>
    545     = "<i>boolean</i>"
    546     (default = false)</dt>
    547 <dd>Specifies whether the entry points specified in the keep tag may be
    548     obfuscated.</dd>
    549 
    550 </dl>
    551 
    552 <h2><a name="classspecification">Class Specification Attributes and Nested Elements</a></h2>
    553 
    554 The keep tags can have the following <i>class_specification</i> attributes and
    555 <i>class_member_specifications</i> nested elements:
    556 
    557 <dl>
    558 
    559 <dt><code><b>access</b></code> = "<i>access_modifiers</i>"</dt>
    560 <dd>The optional access modifiers of the class. Any space-separated list of
    561     "public", "final", and "abstract", with optional negators "!".</dd>
    562 
    563 <dt><code><b>annotation</b></code> = "<i>annotation_name</i>"</dt>
    564 <dd>The optional fully qualified name of an annotation of the class, with
    565     optional wildcards.</dd>
    566 
    567 <dt><code><b>type</b></code> = "<i>type</i>"</dt>
    568 <dd>The optional type of the class: one of "class", "interface", or
    569     "!interface".</dd>
    570 
    571 <dt><code><b>name</b></code> = "<i>class_name</i>"</dt>
    572 <dd>The optional fully qualified name of the class, with optional
    573     wildcards.</dd>
    574 
    575 <dt><code><b>extendsannotation</b></code> = "<i>annotation_name</i>"</dt>
    576 <dd>The optional fully qualified name of an annotation of the the class that
    577     the specified classes must extend, with optional wildcards.</dd>
    578 
    579 <dt><code><b>extends</b></code> = "<i>class_name</i>"</dt>
    580 <dd>The optional fully qualified name of the class the specified classes
    581     must extend, with optional wildcards.</dd>
    582 
    583 <dt><code><b>implements</b></code> = "<i>class_name</i>"</dt>
    584 <dd>The optional fully qualified name of the class the specified classes
    585     must implement, with optional wildcards.</dd>
    586 
    587 <dt><code><b>&lt;field</b></code>
    588     <a href="#classmemberspecification"><i>class_member_specification</i></a>
    589     <code><b>/&gt;</b></code></dt>
    590 <dd>Specifies a field.</dd>
    591 
    592 <dt><code><b>&lt;method</b></code>
    593     <a href="#classmemberspecification"><i>class_member_specification</i></a>
    594     <code><b>/&gt;</b></code></dt>
    595 <dd>Specifies a method.</dd>
    596 
    597 <dt><code><b>&lt;constructor</b></code>
    598     <a href="#classmemberspecification"><i>class_member_specification</i></a>
    599     <code><b>/&gt;</b></code></dt>
    600 <dd>Specifies a constructor.</dd>
    601 
    602 </dl>
    603 
    604 <h2><a name="classmemberspecification">Class Member Specification Attributes</a></h2>
    605 
    606 The class member tags can have the following <i>class_member_specification</i>
    607 attributes:
    608 
    609 <dl>
    610 
    611 <dt><code><b>access</b></code> = "<i>access_modifiers</i>"</dt>
    612 <dd>The optional access modifiers of the class. Any space-separated list of
    613     "public", "protected", "private", "static", etc., with optional negators
    614     "!".</dd>
    615 
    616 <dt><code><b>annotation</b></code> = "<i>annotation_name</i>"</dt>
    617 <dd>The optional fully qualified name of an annotation of the class member,
    618     with optional wildcards.</dd>
    619 
    620 <dt><code><b>type</b></code> = "<i>type</i>"</dt>
    621 <dd>The optional fully qualified type of the class member, with optional
    622     wildcards. Not applicable for constructors, but required for methods for
    623     which the <code>parameters</code> attribute is specified.</dd>
    624 
    625 <dt><code><b>name</b></code> = "<i>name</i>"</dt>
    626 <dd>The optional name of the class member, with optional wildcards. Not
    627     applicable for constructors.</dd>
    628 
    629 <dt><code><b>parameters</b></code> = "<i>parameters</i>"</dt>
    630 <dd>The optional comma-separated list of fully qualified method parameters,
    631     with optional wildcards. Not applicable for fields, but required for
    632     constructors, and for methods for which the <code>type</code> attribute is
    633     specified.</dd>
    634 
    635 </dl>
    636 
    637 <hr />
    638 <noscript><div><a target="_top" href="../index.html" class="button">Show menu</a></div></noscript>
    639 <address>
    640 Copyright &copy; 2002-2013
    641 <a target="other" href="http://www.lafortune.eu/">Eric Lafortune</a>.
    642 </address>
    643 </body>
    644 </html>
    645