1Jar Jar Links - A utility to repackage and embed Java libraries 2Copyright 2007 Google Inc. 3 4Command-line usage: 5 6 java -jar jarjar.jar [help] 7 8 Prints this help message. 9 10 java -jar jarjar.jar strings <cp> 11 12 Dumps all string literals in classpath <cp>. Line numbers will be 13 included if the classes have debug information. 14 15 java -jar jarjar.jar find <level> <cp1> [<cp2>] 16 17 Prints dependencies on classpath <cp2> in classpath <cp1>. If <cp2> 18 is omitted, <cp1> is used for both arguments. 19 20 The level argument must be "class" or "jar". The former prints 21 dependencies between individual classes, while the latter only 22 prints jar->jar dependencies. A "jar" in this context is actually 23 any classpath component, which can be a jar file, a zip file, or a 24 parent directory (see below). 25 26 java -jar jarjar.jar process <rulesFile> <inJar> <outJar> 27 28 Transform the <inJar> jar file, writing a new jar file to <outJar>. 29 Any existing file named by <outJar> will be deleted. 30 31 The transformation is defined by a set of rules in the file specified 32 by the rules argument (see below). 33 34Classpath format: 35 36 The classpath argument is a colon or semi-colon delimited set 37 (depending on platform) of directories, jar files, or zip files. See 38 the following page for more details: 39 http://java.sun.com/j2se/1.5.0/docs/tooldocs/solaris/classpath.html 40 41 Mustang-style wildcards are also supported: 42 http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6268383 43 44Rules file format: 45 46 The rules file is a text file, one rule per line. Leading and trailing 47 whitespace is ignored. There are three types of rules: 48 49 rule <pattern> <result> 50 zap <pattern> 51 keep <pattern> 52 strip-annotations <annotation> 53 54 The standard rule ("rule") is used to rename classes. All references 55 to the renamed classes will also be updated. If a class name is 56 matched by more than one rule, only the first one will apply. 57 58 <pattern> is a class name with optional wildcards. "**" will 59 match against any valid class name substring. To match a single 60 package component (by excluding "." from the match), a single "*" may 61 be used instead. 62 63 <result> is a class name which can optionally reference the 64 substrings matched by the wildcards. A numbered reference is available 65 for every "*" or "**" in the <pattern>, starting from left to 66 right: "@1", "@2", etc. A special "@0" reference contains the entire 67 matched class name. 68 69 The "zap" rule causes any matched class to be removed from the resulting 70 jar file. All zap rules are processed before renaming rules. 71 72 The "keep" rule marks all matched classes as "roots". If any keep 73 rules are defined all classes which are not reachable from the roots 74 via dependency analysis are discarded when writing the output 75 jar. This is the last step in the process, after renaming and zapping. 76 77 The "strip-annotations" rule will remove all the references to a certain 78 annotation from a jar file. As no pattern matching is performed, the 79 annotations have to be provided as one per line. 80