Giter Site home page Giter Site logo

jarjar's People

Contributors

mrmaxross avatar

Watchers

 avatar  avatar

jarjar's Issues

Make jarjar'd classes unimportable

In Guice we love jarjar. We transform com.google.common.collect.ImmutableMap to 
com.google.inject.internal.collect. ImmutableMap. But unfortunately, IDE users 
often import the 
wrong one. And then we change Guice, and bad things happen.

Could jarjar prefix the transformed classes with a dollarsign, to make then 
unimportable? If the FQN 
was com.google.inject.internal.collect.$ImmutableMap, then good times? This 
would also prevent 
the IDE from suggesting this class name for import.

Original issue reported on code.google.com by limpbizkit on 31 Dec 2008 at 7:10

Preserve Main-Class from MANIFEST.MF

What steps will reproduce the problem?
1. Use jarjar to create a single jar from multiple sources, one of which has 
the Main-Class set
2. Attempt to run the jar using "java -jar"

What is the expected output? What do you see instead?
I expect the class selected in the "Main-Class" manifest attribute to run. It 
turns out that no 
manifest information is preserved.

I would hope that a warning (or, optionally, an error) would be printed if more 
than one Main-
Class was seen.

What version of the product are you using? On what operating system?
1.0 from the downloads

Original issue reported on code.google.com by simon.m.stewart on 8 May 2010 at 11:43

Support removal of unused static methods

( For background see
http://code.google.com/p/google-guice/issues/detail?id=264 )

The attached patch adds support for removing unused static methods, you can
also use the "keep" rule to flag whole classes or selected methods that you
want kept even if they look unused (like main methods, etc.)

For example, for Guice the following methods look unused but should be kept
around because they are used by generated CGLIB proxy classes:

  <keep pattern="net.sf.cglib.core.ReflectUtils.findMethods"/>
  <keep pattern="net.sf.cglib.proxy.MethodProxy.create"/>

With this patch I can reduce Guice to ~700k (a saving of around 200k).

Feel free to use/modify/rewrite this patch as you feel fit, for example
you'd probably want to add a new flag to make removing methods optional.

Original issue reported on code.google.com by [email protected] on 1 Dec 2008 at 5:42

Attachments:

JarJarTask dependency checking

What steps will reproduce the problem?
1. Use the JarJarTask in an ant build script
2. run the build script twice
3. notice that even though no classes or jar files that are the input of
the JarJarTask, the jar is re-packaged, or at least touched.

What is the expected output? What do you see instead?
I expect that the output jar remains untouched if no inputs to the
JarJarTask have changed since the last time the jar was touched.

What version of the product are you using? On what operating system?
1.0rc5 on Windows (though I suspect the OS doesn't matter).

Please provide any additional information below.
The result of the bug is that any transitively dependent tasks in the ant
script will always run. It is possible to work around by using the ant task
'uptodate', however a well behaved ant task has no effects when no input
has changed.

Original issue reported on code.google.com by talper%[email protected] on 18 Oct 2007 at 8:45

java.lang.ArrayIndexOutOfBoundsException if source log4j or commons-logging

What steps will reproduce the problem?
1. <zipfileset
src="C:\3rd\log4j\dist\logging-log4j-1.2.13\dist\lib\log4j-1.2.13.jar"/>
2. <zipfileset
src="C:\3rd\commons-logging\dist\commons-logging-1.1\commons-logging-1.1.jar
"/>


What is the expected output? What do you see instead?

--- Nested Exception ---
java.lang.ArrayIndexOutOfBoundsException: 39
    at com.tonicsystems.jarjar.asm.Type.a(Unknown Source)
    at com.tonicsystems.jarjar.asm.Type.getElementType(Unknown Source)
    at com.tonicsystems.jarjar.asm.commons.Remapper.mapType(Unknown Source)
    at com.tonicsystems.jarjar.asm.commons.Remapper.mapType(Unknown Source)
    at com.tonicsystems.jarjar.PackageRemapper.mapPath(PackageRemapper.java:82)
    at com.tonicsystems.jarjar.PackageRemapper.mapValue(PackageRemapper.java:104)
    at
com.tonicsystems.jarjar.asm.commons.RemappingMethodAdapter.visitLdcInsn(Unknown
Source)
    at com.tonicsystems.jarjar.asm.ClassReader.accept(Unknown Source)
    at com.tonicsystems.jarjar.asm.ClassReader.accept(Unknown Source)
    at
com.tonicsystems.jarjar.ext_util.JarTransformer.process(JarTransformer.java:35)
    at
com.tonicsystems.jarjar.ext_util.JarProcessorChain.process(JarProcessorChain.jav
a:31)
    at com.tonicsystems.jarjar.MainProcessor.process(MainProcessor.java:83)
    at
com.tonicsystems.jarjar.ext_util.AntJarProcessor.zipFile(AntJarProcessor.java:55
)
    at org.apache.tools.ant.taskdefs.Zip.addResources(Zip.java:763)
    at org.apache.tools.ant.taskdefs.Zip.addResources(Zip.java:810)
    at org.apache.tools.ant.taskdefs.Zip.executeMain(Zip.java:543)
    at org.apache.tools.ant.taskdefs.Zip.execute(Zip.java:410)
    at
com.tonicsystems.jarjar.ext_util.AntJarProcessor.execute(AntJarProcessor.java:42
)
    at com.tonicsystems.jarjar.JarJarTask.execute(JarJarTask.java:50)
    at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
    at sun.reflect.GeneratedMethodAccessor2.invoke(Unknown Source)
    at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.jav
a:25)
    at java.lang.reflect.Method.invoke(Method.java:585)
    at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:105)
    at org.apache.tools.ant.Task.perform(Task.java:348)
    at org.apache.tools.ant.Target.execute(Target.java:357)
    at org.apache.tools.ant.Target.performTasks(Target.java:385)
    at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1329)
    at
org.apache.tools.ant.helper.SingleCheckExecutor.executeTargets(SingleCheckExecut
or.java:38)
    at org.apache.tools.ant.Project.executeTargets(Project.java:1181)
    at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:416)
    at org.apache.tools.ant.taskdefs.CallTarget.execute(CallTarget.java:105)
    at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
    at sun.reflect.GeneratedMethodAccessor2.invoke(Unknown Source)
    at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.jav
a:25)
    at java.lang.reflect.Method.invoke(Method.java:585)
    at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:105)
    at org.apache.tools.ant.Task.perform(Task.java:348)
    at org.apache.tools.ant.Target.execute(Target.java:357)
    at org.apache.tools.ant.Target.performTasks(Target.java:385)
    at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1329)
    at org.apache.tools.ant.Project.executeTarget(Project.java:1298)
    at
org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:
41)
    at org.apache.tools.ant.Project.executeTargets(Project.java:1181)
    at org.apache.tools.ant.Main.runBuild(Main.java:698)
    at org.apache.tools.ant.Main.startAnt(Main.java:199)
    at org.apache.tools.ant.launch.Launcher.run(Launcher.java:257)
    at org.apache.tools.ant.launch.Launcher.main(Launcher.java:104)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.jav
a:25)
    at java.lang.reflect.Method.invoke(Method.java:585)
    at com.intellij.rt.ant.execution.AntMain2.main(AntMain2.java:17)


What version of the product are you using? On what operating system?

jarjar-1.0rc5.jar, Win XP Pro


Please provide any additional information below.

Other commons and third party libraries get added with jarjar fine.


Original issue reported on code.google.com by [email protected] on 18 Sep 2007 at 6:13

Enhancement Request: Add "Both" Option for Find

JarJar Links is a great tool.  The dependency finder is excellent.  However, I 
wish there was an option to display both jar and class dependencies instead of 
one or the other. 

What is the expected output? What do you see instead?
With -find jar output,
a.jar -> b.jar
b.jar -> c.jar

With -find class output,
a/A -> b/B
b/B -> c/C

With proposed -find both output
a.jar -> b.jar
    a/A -> b/B
b.jar -> c.jar
    b/B -> c/C

What version of the product are you using? On what operating system?
1.0 on Windows 7

Please provide any additional information below.
The attached patch is a proposed implementation.  This new mode provides even 
more information for this excellent dependency finder.  

Original issue reported on code.google.com by [email protected] on 12 Nov 2010 at 11:57

Attachments:

Upgrade to ASM 4

The Groovy (http://groovy.codehaus.org) language uses jarjar to build an 
embeddable jar. The next version of Groovy which is due soon introduces support 
of InvokeDynamic. This support requires an upgrade to ASM 4, and classes 
generated by ASM 4 won't pass with current jarjar.

Is there any plan to upgrade?

Original issue reported on code.google.com by [email protected] on 2 Mar 2012 at 3:27

No source archive for 1.0

There is no jarjar-src on the final 1.0 unlike the release candidates

Original issue reported on code.google.com by pterjan on 20 Jan 2011 at 8:25

StringIndexOutOfBoundsException with wicket-1.3.0-rc2.jar

What steps will reproduce the problem?
1. Run the attached Ant build script using "ant -d -f jjdebug.xml" ensuring
that the property setting the path to the wicket-1.3.0-rc2.jar file is
correct for the test system

What is the expected output? What do you see instead?
Should have generated a deps.jar file containing the contents of the wicket
JAR.  Instead, got a "java.lang.StringIndexOutOfBoundsException: String
index out of range: -3" as shown in snippet below.

What version of the product are you using? On what operating system?
Testing jarjar1.0-rc6 on a Win2K, SP4 system with JDK 1.6.0_03

Please provide any additional information below.

Got the following exception trace result in which it appears that during
visiting a field, PackageRemapper.mapPath() calls String.substring() which
throws the exception.

java.lang.StringIndexOutOfBoundsException: String index out of range: -3 at
org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:115)
        at org.apache.tools.ant.Task.perform(Task.java:348)
        at org.apache.tools.ant.Target.execute(Target.java:357)
        at org.apache.tools.ant.Target.performTasks(Target.java:385)
        at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1329)
        at org.apache.tools.ant.Project.executeTarget(Project.java:1298)
        at
org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java
:41)
        at org.apache.tools.ant.Project.executeTargets(Project.java:1181)
        at org.apache.tools.ant.Main.runBuild(Main.java:698)
        at org.apache.tools.ant.Main.startAnt(Main.java:199)
        at org.apache.tools.ant.launch.Launcher.run(Launcher.java:257)
        at org.apache.tools.ant.launch.Launcher.main(Launcher.java:104)
Caused by: java.lang.StringIndexOutOfBoundsException: String index out of
range: -3
        at java.lang.String.substring(String.java:1938)
        at
com.tonicsystems.jarjar.PackageRemapper.mapPath(PackageRemapper.java:84)
        at
com.tonicsystems.jarjar.PackageRemapper.mapValue(PackageRemapper.java:101)
        at
com.tonicsystems.jarjar.asm.commons.RemappingClassAdapter.visitField(Unknown
Source)

Original issue reported on code.google.com by [email protected] on 18 Dec 2007 at 2:39

Attachments:

JarJar find can't handle absolute paths in Windows

What steps will reproduce the problem?
1. Use an absolute file name (including drive letter: c:\home\lib\foo.jar")
as input in any of the classpath arguments. JarJar thinks the ':' in the
drive letter is a path separator and breaks the path in the wrong place.

For example:
java -jar c:\home\lib\jarjar-1.0rc6.jar\jarjar-1.0rc6.jar find jar
c:\home\test\foo.bar

What is the expected output? What do you see instead?
The expected output is the list of dependencies - which you get fine if you
 use relative paths.

What you see instead is this error:
Syntax error: File c:\home\test\c does not exist

What version of the product are you using? On what operating system?
jarjar-1.0rc6.jar on Windows XP.

Please provide any additional information below.
The fix is simple: on ClassPathIterator

instead of 
        StringTokenizer st = new StringTokenizer(classPath, ":;");

use
        StringTokenizer st = new StringTokenizer(classPath,
System.getProperty("path.separator"));


Original issue reported on code.google.com by [email protected] on 8 Feb 2008 at 12:48

Support exclusive as well as inclusive patterns

What steps will reproduce the problem?
1. Attempt to jarjar all the libraries of a project
2. Find you want to exclude one set of packages from renaming, but rename 
everything else
3. The syntax does not allow you to express this other than by explicitly 
listing all the libraries you do want to rename.

What version of the product are you using? On what operating system?

1.0 on Fedora Linux

I'd like to see JarJar extended so that I can concisely specify "rename 
everything except these packages" as this is a common use-case. e.g. I don't 
want to rename log4j's packages (because its config format uses Class.forname), 
but I do want to rename everything else.

Original issue reported on code.google.com by [email protected] on 17 Dec 2010 at 3:51

Need diagnostics of errors inside asm

I get exception:

===
BUILD FAILED
/home/stepancheg/devel/yandex/mysql-diff/build.xml:102:
java.lang.StringIndexOutOfBoundsException: String index ou
t of range: 130
        at
org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:115)
        at org.apache.tools.ant.Task.perform(Task.java:348)
        at org.apache.tools.ant.Target.execute(Target.java:357)
        at org.apache.tools.ant.Target.performTasks(Target.java:385)
        at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1329)
        at org.apache.tools.ant.Project.executeTarget(Project.java:1298)
        at
org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:
41)
        at org.apache.tools.ant.Project.executeTargets(Project.java:1181)
        at org.apache.tools.ant.Main.runBuild(Main.java:698)
        at org.apache.tools.ant.Main.startAnt(Main.java:199)
        at org.apache.tools.ant.launch.Launcher.run(Launcher.java:257)
        at org.apache.tools.ant.launch.Launcher.main(Launcher.java:104)
Caused by: java.lang.StringIndexOutOfBoundsException: String index out of
range: 130
        at java.lang.String.charAt(String.java:694)
        at com.tonicsystems.jarjar.asm.signature.SignatureReader.a(Unknown
Source)
        at
com.tonicsystems.jarjar.asm.signature.SignatureReader.accept(Unknown Source)
        at
com.tonicsystems.jarjar.asm.commons.Remapper.mapSignature(Unknown Source)
        at
com.tonicsystems.jarjar.asm.commons.RemappingClassAdapter.visitMethod(Unknown
Source)
        at com.tonicsystems.jarjar.asm.ClassReader.accept(Unknown Source)
        at com.tonicsystems.jarjar.asm.ClassReader.accept(Unknown Source)
        at
com.tonicsystems.jarjar.ext_util.JarTransformer.process(JarTransformer.java:35)
        at
com.tonicsystems.jarjar.ext_util.JarProcessorChain.process(JarProcessorChain.jav
a:31)
        at com.tonicsystems.jarjar.MainProcessor.process(MainProcessor.java:80)
        at
com.tonicsystems.jarjar.ext_util.AntJarProcessor.zipFile(AntJarProcessor.java:70
)
        at org.apache.tools.ant.taskdefs.Zip.addResources(Zip.java:763)
        at org.apache.tools.ant.taskdefs.Zip.addResources(Zip.java:810)
        at org.apache.tools.ant.taskdefs.Zip.executeMain(Zip.java:543)
        at org.apache.tools.ant.taskdefs.Zip.execute(Zip.java:410)
        at
com.tonicsystems.jarjar.ext_util.AntJarProcessor.execute(AntJarProcessor.java:51
)
        at com.tonicsystems.jarjar.JarJarTask.execute(JarJarTask.java:49)
        at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.jav
a:43)
        at java.lang.reflect.Method.invoke(Method.java:616)
        at
org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:105)
        ... 11 more
===

I cannot understand, what class cannot be processed by asm.

JarTransformer.process should throw exception with currently processed
class name, like:

===
JarTransformer.process(EntryStruct struct) {
  try {
    // current "process" body
  } catch (Exception e) {
    throw new JarJarException("failed to process " + struct.name + ": " + e);
  }
}
===

Original issue reported on code.google.com by [email protected] on 4 Oct 2008 at 3:00

Can't use $ in rules file

For example, if you try to create a rule like:

rule com.example.SomeClass$SomeNestedClass
com.example.internal.SomeClass$SomeNestedClass 

it won't rename the class because the $ ends up interpreted as the regex
end-of-line pattern, which causes the Wildcard object to fail the match.

I fixed this by adding code to Wildcard.java:

    private static Pattern dollar = Pattern.compile("\\$");

(then in the constructor after the other replaceAllLiteral calls)

        regex = replaceAllLiteral(dollar, regex, "\\$");

Original issue reported on code.google.com by [email protected] on 23 Nov 2009 at 7:21

Get ArrayIndexOutOfBoundsException when building

What steps will reproduce the problem?

  Unclear.  I think the problem may be library-content related.
  I've attached a stack trace and what seem to be the relevant
  values from the last two frames.  Here was the analogous task:

<target name="project_postjar" depends="project_compile">
  <jar jarfile="${dist}/project.jar">
    <manifest>
    <attribute name="Built-By" value="${user.name}" />
    <attribute name="Main-Class" 
value="com.company.group.tools.project.ProjectMain" />
    </manifest>
    <fileset dir="${build}" 
includes="com/company/group/tools/project/**" />
    <fileset dir="${build}" 
includes="com/company/group/tools/cliconfig/**" />
    <fileset dir="${build}" includes="com/company/group/tools/common/**" />
    <zipfileset src="${build}/project.jar" />
  </jar>
</target>


What is the expected output? What do you see instead?

  a successfully built jar.  a BUILD FAILED, due to the exception.

What version of the product are you using? On what operating system?

  1.0rc5

Please provide any additional information below.

Relevant values from debugging at the exception point (w/o source):

Type.a(null, 0)
Type.getElementType(): a == 9, c == 0, d == 72, b[] =
    [[, L, O, O, K, U, P, ],  , L, o, o, k, i, n, g,  , f, o, r,  , 
a,  , r, e, s, o, u, r, c, e,  , f, i, l, e,  , o, f,  , n, a, m, e,  , [, 
M, E, T, A, -, I, N, F, /, s, e, r, v, i, c, e, s, /, R, E, S, O, U, R, C, 
E]

jarjar works great in some other situations, but there's something poison 
in the zipfileset that causes it to croak consistently.

Original issue reported on code.google.com by [email protected] on 31 Jul 2007 at 12:35

Attachments:

Missing class when using jarjar with Java6 bytecode

What steps will reproduce the problem?
1. Checkout Guice trunk (http://google-guice.googlecode.com/svn/trunk)
2. Install latest Java6 JDK
(http://java.sun.com/javase/downloads/ea/6u10/6u10rcDownload.jsp#6u10JDKs)
3. build Guice jar with Java6 (ant clean jar)

What is the expected output? What do you see instead?

 The final Guice jar should include the CGLIB Enhancer class, but it
doesn't. This means that the tests (ant test.dist) almost all fail.

What version of the product are you using? On what operating system?

 jarjar-1.0rc8.jar on Windows

Please provide any additional information below.

 When targeting Java5 bytecode (ant.build.javac.target=1.5) the jar does
contain the CGLIB Enhancer class as expected.

Original issue reported on code.google.com by [email protected] on 15 Oct 2008 at 3:46

Can't use "-" in patterns

...even though it's legal to have package names with it.

Original issue reported on code.google.com by tal.liron on 15 Feb 2010 at 9:13

Method annotations are not transformed

What steps will reproduce the problem?
1. Jar that includes an annotation class and a class that declares the 
annotation on a method (probably doesn't work for other annotated objects 
either)
2. Transform the jar changing the package name from one thing to another
3. The declared annotation still uses the old package name

What is the expected output? What do you see instead?
If I have an annotation class defined as follows:
package org.blah.function;

@Target( { ElementType.METHOD })
@Retention(RetentionPolicy.RUNTIME)
public @interface Function {
    public String description() default "";
    public String group() default "";
    public boolean visibleInUI() default true;
}

And a class that declares the annotation on a method as follows:
package org.blah.function;
public class SimpleTest{
    @Function(group="Content")
    public boolean beginswith(String s, String prefix) {
        return s.startsWith(prefix);
    }
}

Then run jarjar transforming org.blah to com.mycompany.

The class file for the @Function annotation now has a package of 
com.mycompany.function

The class file for SimpleTest also now has a package of 
com.mycompany.function.  However, the annotation on the method is still 
org.blah.function.Function.

What version of the product are you using? On what operating system?
jarjar-1.0rc8.jar
Windows XP


Please provide any additional information below.


Original issue reported on code.google.com by [email protected] on 22 Nov 2008 at 6:31

Directory entries in jar files

jarjar currently does not include directory entries. This makes it difficult 
for jars to be scanned by 
classloader.getResources().

Which, many frameworks like TestNG and warp-widgets use to discover classes.

Original issue reported on code.google.com by [email protected] on 29 Aug 2008 at 10:16

Add a new Mojo in the maven plugin to support the find dependency feature

The attached patch extends the jarjar maven plugin to support the find 
dependency feature of jarjar plugin. This could be exploited to easily mavenize 
projects from jar by dynamically creating poms with proper dependencies.

Here is how to use this feature:

<build>
  <plugins>
...
      <plugin>
        <groupId>com.tonicsystems.jarjar</groupId>
        <artifactId>jarjar-plugin</artifactId>
        <executions>
          <execution>
            <phase>generate-resources</phase>
            <goals>
              <goal>find</goal>
            </goals>
          </execution>
        </executions>
        <configuration>
          <level>JAR</level>
          <libs>${project.build.directory}/yourLibraryPath/*</libs>
          <deps>${project.build.directory}/yourLibraryPath/*:${project.build.directory}/yourDepsPath/*</deps>
          <report>${project.build.directory}/depfind/dependency.txt</report>
        </configuration>
      </plugin>
...
  </plugins>
</build>

<level> could be either JAR or CLASS (uppercase is mandatory) and is mandatory.
<libs> is the classpath of the classes to be analysed and is mandatory.
<deps> is the classpath of dependancies to be considered, if missing <libs> is 
used
<report> is a file where the result of the analysis is written, if missing 
stdout is used

There is some potential improvement that I am thinking about:
 - Use multivalued argument for the classpath
 - extends this feature further to directly generating poms

WDYT ?

Original issue reported on code.google.com by [email protected] on 16 Jun 2010 at 7:58

Attachments:

1.0rc4 compiled against java5 (for a reason?)

What steps will reproduce the problem?
1. Download jarjar-1.0rc4.jar
2. Try to use it with jvm 1.4

What is the expected output? What do you see instead?
The jarjar task in my build file work :)

The output is:
BUILD FAILED
java.lang.UnsupportedClassVersionError: com/tonicsystems/jarjar/JarJarTask
(Unsupported major.minor version 49.0)

Total time: 1 second
toomasr@cigarette:~/weaver$ java -version
java version "1.4.2_10"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_10-b03)
Java HotSpot(TM) Client VM (build 1.4.2_10-b03, mixed mode)


What version of the product are you using? On what operating system?
1.0rc4


Original issue reported on code.google.com by [email protected] on 4 Jul 2007 at 12:56

Can JarJar handle hardcoded string references to some of their class names?

Some libraries we use in our current project, like JDom, has hard-coded
string references to some of their class names. 

Or for some reason, a library may construct class names programmatically, like 

String[] beanNames = new String[]{"SMTPServer", "Repository"};

for (String bean: beanNames)
{
 ..
 Class.forName("com.x.y." + beanName + "MBean")
}

Can JarJar handle such cases (automatically repacking these libraries)?

Original issue reported on code.google.com by [email protected] on 29 Jan 2008 at 2:22

Processing JAR fails with java.lang.IllegalStateException: Unknown local variable 3

If I try to run jarjar on the attached JAR file (the file jarjar.rules is empty)

<java jar="D:\Java\Libraries\JarJar\jarjar-1.0.jar" fork="true" >
<arg value="process"/>
<arg value="jarjar.rules"/>
<arg value="bug.jar"/>
<arg value="bug2.jar"/>
</java>

I get the following error:

     [java] Exception in thread "main" java.lang.IllegalStateException: Unknown local variable 3
     [java]     at com.tonicsystems.jarjar.asm.commons.LocalVariablesSorter.remap(Unknown Source)
     [java]     at com.tonicsystems.jarjar.asm.commons.LocalVariablesSorter.visitFrame(Unknown Source)
     [java]     at com.tonicsystems.jarjar.asm.commons.RemappingMethodAdapter.visitFrame(Unknown Source)
     [java]     at com.tonicsystems.jarjar.asm.ClassReader.accept(Unknown Source)
     [java]     at com.tonicsystems.jarjar.asm.ClassReader.accept(Unknown Source)
     [java]     at com.tonicsystems.jarjar.ext_util.JarTransformer.process(JarTransformer.java:35)
     [java]     at com.tonicsystems.jarjar.ext_util.JarProcessorChain.process(JarProcessorChain.java:31)
     [java]     at com.tonicsystems.jarjar.MainProcessor.process(MainProcessor.java:80)
     [java]     at com.tonicsystems.jarjar.ext_util.StandaloneJarProcessor.run(StandaloneJarProcessor.java:50)
     [java]     at com.tonicsystems.jarjar.Main.process(Main.java:93)
     [java]     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
     [java]     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
     [java]     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
     [java]     at java.lang.reflect.Method.invoke(Method.java:597)
     [java]     at com.tonicsystems.jarjar.MainUtil.runMain(MainUtil.java:37)
     [java]     at com.tonicsystems.jarjar.Main.main(Main.java:50)
     [java] Java Result: 1

I also upload the source code of single Java file contained in the JAR.
The method testErrorWithJDT causes the error, if the source code is slightly 
changed like in testOk the file is processed fine.

I also noticed that the error only shows up if the class file in the JAR has 
been produced by the built-in Eclipe JDT compiler (I'm using Helios, Build id: 
20100617-1415).

If I compile the java file with Sun JDK 1.6.0_18, no error shows up.

Original issue reported on code.google.com by [email protected] on 24 Sep 2010 at 10:38

Attachments:

[patch] New "check" command to check for missing dependencies

jarjar's find command outputs dependencies but excludes those where the target 
cannot be found in its classpath.

I'd like a new command that looks for such dependencies, as they may be 
significant errors resulting in runtime NoClassDefFoundError.

The attached patch adds a "check" command which is similar to "find" but 
outputs lines of the form

foo.jar!org/example/foo/MyClass -> org/example/bar/TheirClass

for each reference in cp1 that cannot be resolved in cp2.

It was a fairly natural adaptation of "find" so I'd like it to be considered 
for inclusion in a future jarjar release.

I have some additional plans:
  (1) Look into adding tests for this
  (2) Investigate exposing an ant task for "check"
  (3) Consider adding some form of exemption list for optional dependencies that are known to be missing

(2) and (3) could be done within jarjar or as part of my calling code, so I'd 
welcome any opinion here.

Original issue reported on code.google.com by matt%[email protected] on 17 Mar 2011 at 5:36

Attachments:

"Error reading Main.class: ClassReader.accept() should be called with EXPAND_FRAMES flag"

What steps will reproduce the problem?
1. Untar the attached file
2. run jarjar find class atarget


What is the expected output? 
Nothing

What do you see instead?
"Error reading Main.class: ClassReader.accept() should be called with
EXPAND_FRAMES flag"

What version of the product are you using? On what operating system?
1.0, mac osx 10.5.7



Original issue reported on code.google.com by [email protected] on 12 Jun 2009 at 6:51

Attachments:

Releases should be tagged in svn and request for source release

As a member of the gentoo linux java team, we would appreciate if you
would, tag releases in svn and create source zip/tar's.

This will allow us to package jarjar for Gentoo (currently we have 0.9)

This following is a link with some notes about how, we believe, you can be
a good upstream

http://overlays.gentoo.org/proj/java/wiki/How_to_be_a_good_upstream

Thanks.

Original issue reported on code.google.com by [email protected] on 29 Dec 2007 at 12:24

"IndexOutOfBoundsException" in "ClassHeaderReader" when looking for dependencies

What steps will reproduce the problem?
Don't know for sure, but the Exception is thrown when checking any jar (as
input) for dependence on e.g. "activation.jar" (from Sun Microsystems)



What is the expected output? What do you see instead?

Expected: Dependence

Instead: IndexOutOfBoundException in "ClassHeaderReader.read()" (see
Stacktrace below)

Exception in thread "Thread-3" java.lang.IndexOutOfBoundsException
    at java.util.zip.InflaterInputStream.read(Unknown Source)
    at java.util.jar.JarVerifier$VerifierStream.read(Unknown Source)
    at
com.tonicsystems.jarjar.util.ClassHeaderReader.read(ClassHeaderReader.java:164)
    at
com.tonicsystems.jarjar.util.ClassHeaderReader.buffer(ClassHeaderReader.java:154
)
    at
com.tonicsystems.jarjar.util.ClassHeaderReader.read(ClassHeaderReader.java:86)
    at com.tonicsystems.jarjar.DepFind.run(DepFind.java:42)
    at com.tonicsystems.jarjar.Main.find(Main.java:72)




What version of the product are you using? On what operating system?
Version: 1.0rc7
OS: Win XP



Please provide any additional information below.

I added a String-output to JarJar for interacting with another tiny program
(but didn't change anything else than the "PrintWriter" in Main.find() to
"StringBuffer").

Original issue reported on code.google.com by [email protected] on 29 May 2008 at 3:49

Feature request: Verbose option

What steps will reproduce the problem?
1. Running jarjar on any jar does not show what is happening. It would be
interesting to see which rule is executed, when substitutions or changes
are made, what change is made and in what class, etc.

What is the expected output? What do you see instead?
Expect traces regarding class refactoring.

(Really nice tool to use)


Original issue reported on code.google.com by [email protected] on 5 Dec 2008 at 1:33

class declared in default section of switch not included

A class declared in the default section of a switch statement does not get 
included as a dependency in the JAR file.

What steps will reproduce the problem?

        switch ( enumString )
        {
          default:

            throw new EnumUnknownException ( enumString );
        }

What is the expected output? What do you see instead?

I expect to see EnumUnknownException.class included in jar file.

What version of the product are you using? On what operating system?

Maven Plugin 0.0.4:

            <plugin>
              <!-- http://docs.atlassian.com/jarjar-maven-plugin/ -->
              <groupId>com.atlassian.maven.plugins</groupId>
              <artifactId>jarjar-maven-plugin</artifactId>
              <version>0.0.4</version>
            </plugin>

Windows Vista.

Please provide any additional information below.

An easy workaround is to declare the class outside default section.  I just 
include a line like this in the constructor method:

// jarjar workaround
new EnumUnknownException ( );

The EnumUnknownException.class file is then included in the JAR file.

Original issue reported on code.google.com by david.wallace.croft on 11 Jul 2010 at 5:55

REgarding tonic systems license

Hi, 

 we had a couple of licenses from tonic systems for the ppt download API's 
a couple of years back. We were trying to get in touch with Tonic systems 
inorder to discuss the terms of usage etc. Please let us know whom do we 
speak with regarding this.

Thanks,
Sn

Original issue reported on code.google.com by [email protected] on 6 Oct 2009 at 4:29

Code: Outputing dependencies in graphvis (dot) format (DotDepHandler.java)

When using jarjar find jars <cp>, the output is almost but not quite
suitable for feeding directly to dot [1], which can draw a nice graph of it.

I wrote a specific DepHandler, which makes the output a digraph that can be
fed directly to dot.  Could it be committed to the project?

To test it, simply replace "new TextDepHandler" in Main.java with "new
DotDepHandler", as I have not yet written a way to decide runtime which
handler to use.

[1] http://www.graphviz.org/doc/info/lang.html

Original issue reported on code.google.com by [email protected] on 4 Dec 2008 at 5:46

Attachments:

Wich version of asm do you use?

Hi,

I'm trying to build 1.0rc6 for Debian. First, I agree with <a
href="http://code.google.com/p/jarjar/issues/detail?id=8">#8</a>. Having a
source tarball would be great. Also, could you specify the real version of
asm you are using? If it's not a release of asm, could you update your
package to asm3?

Thanks for your time,

Original issue reported on code.google.com by avandyck on 19 Jan 2008 at 5:02

Can't compile using ant 1.8.x

What steps will reproduce the problem?
1. install Ant
2. checkout jarjar
3. run ant

Ant's <zip> task has added a new signature to the zipDir method (taking
a Resource rather than a File as first argument) so you get an error when
compiling AntJarProcessor

    [javac] src/main/com/tonicsystems/jarjar/util/AntJarProcessor.java:87: reference to zipDir is ambiguous, both method zipDir(java.io.File,org.apache.tools.zip.ZipOutputStream,java.lang.String,int,org.apache.tools.zip.ZipExtraField[]) in org.apache.tools.ant.taskdefs.Zip and method zipDir(org.apache.tools.ant.types.Resource,org.apache.tools.zip.ZipOutputStream,java.lang.String,int,org.apache.tools.zip.ZipExtraField[]) in org.apache.tools.ant.taskdefs.Zip match

    [javac]           super.zipDir(null, zOut, dir + "/", ZipFileSet.DEFAULT_DIR_MODE, JAR_MARKER);
    [javac]                ^
    [javac] 1 error

The attached trivial patch allows jarjar to be compiled with Ant 1.7.x and 
1.8.x (and likely 1.6.x with x > 2, but I haven't tried that).

Original issue reported on code.google.com by [email protected] on 27 Aug 2010 at 10:08

Attachments:

IllegalStateException as a result of missing EXPAND_FRAMES flag

What steps will reproduce the problem?

1. Create an Ant build script with a task as follows:
<target name="dist" description="Build the distributable JAR" depends="build">
    <mkdir dir="${dist.dir}" />
    <taskdef name="jarjar" classname="com.tonicsystems.jarjar.JarJarTask"
classpath="${lib.ant.dir}/${jar.jarjar}" />
    <jarjar jarfile="${dist.dir}/${project.name}.jar">
        <manifest>
            <attribute name="Manifest-Version" value="1.0" />
            <attribute name="Main-Class" value="com.example.program.Runner" />
        </manifest>
        <fileset dir="${build.dir}"/>
        <zipfileset src="${lib.dir}/mysql-connector-java-5.1.5-bin.jar"/>
        <zipfileset src="${lib.dir}/commons-lang-2.3.jar" />
        <rule pattern="com.mysql.**" result="com.example.mysql.@1" />
        <rule pattern="org.gjt.**" result="com.example.gjt.@1" />
        <rule pattern="org.apache.**" result="com.example.apache.@1" />
    </jarjar>
</target>

2. Run the above target: "ant dist"


What is the expected output? What do you see instead?

Expect a properly constructed JAR but receive instead the following error:
BUILD FAILED
/home/sean/workspace/CascadeDbCollator/build.xml:70:
java.lang.IllegalStateException: ClassReader.accept() should be called with
EXPAND_FRAMES flag

Line 70 in my script is:
<jarjar jarfile="${dist.dir}/${project.name}.jar">


What version of the product are you using? On what operating system?
1.0 RC6 on Ubuntu Linux 7.10


Please provide any additional information below.

Using Java 1.5, output from java -version is:
java version "1.5.0_13"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_13-b05)
Java HotSpot(TM) Server VM (build 1.5.0_13-b05, mixed mode)

Using Ant 1.7, output from ant -versoin is:
Apache Ant version 1.7.0 compiled on August 29 2007

Build task is as follows:
<target name="build" description="Compile main source tree java files">
    <mkdir dir="${build.dir}" />
    <javac destdir="${build.dir}" debug="true" deprecation="false"
optimize="false" failonerror="true">
        <src path="${src.dir}" />
        <classpath refid="master-classpath" />
    </javac>
</target>

Running the above as a normal <jar/> task succeeds using the following:
<target name="dist" description="Build the distributable JAR" depends="build">
    <mkdir dir="${dist.dir}" />
    <jar jarfile="${dist.dir}/${project.name}.jar">
        <manifest>
            <attribute name="Manifest-Version" value="1.0" />
            <attribute name="Main-Class"
value="com.hannonhill.cascade.collator.Runner" />
        </manifest>
        <fileset dir="${build.dir}"/>
        <zipfileset src="${lib.dir}/mysql-connector-java-5.1.5-bin.jar"/>
        <zipfileset src="${lib.dir}/commons-lang-2.3.jar" />
    </jar>
</target>

Original issue reported on code.google.com by [email protected] on 10 Dec 2007 at 2:23

PackageRemapper uses Java 1.5 only character category

What steps will reproduce the problem?
1. Run under Java 1.4 and cause PackageRemapper to be loaded through use of
the jarjar Ant task.

What is the expected output? What do you see instead?
Expected: rewritten classes
Seen:
ava.util.regex.PatternSyntaxException: Unknown character category
{javaJavaIdentifierPart} near index 29
\[L[\p{javaJavaIdentifierPart}\.]+?;
                             ^
    at java.util.regex.Pattern.error(Pattern.java:1541)
    at java.util.regex.Pattern.familyError(Pattern.java:2222)
    at java.util.regex.Pattern.retrieveCategoryNode(Pattern.java:2213)
    at java.util.regex.Pattern.family(Pattern.java:2185)
    at java.util.regex.Pattern.range(Pattern.java:2106)
    at java.util.regex.Pattern.clazz(Pattern.java:2069)
    at java.util.regex.Pattern.sequence(Pattern.java:1598)
    at java.util.regex.Pattern.expr(Pattern.java:1558)
    at java.util.regex.Pattern.compile(Pattern.java:1291)
    at java.util.regex.Pattern.<init>(Pattern.java:1047)
    at java.util.regex.Pattern.compile(Pattern.java:785)
    at com.tonicsystems.jarjar.PackageRemapper.<clinit>(PackageRemapper.java:30)

What version of the product are you using? On what operating system?
1.0RC7, OSX 10.5, JDK 1.4

Please provide any additional information below.
the javaJavaIdentifierPart character category is available from Java 5
onwards, it seems.

Original issue reported on code.google.com by [email protected] on 3 Apr 2008 at 12:38

JarJar not replacing package names on META-INF/services/

What steps will reproduce the problem?
1. download Sun JWSDP 2.0
2.  <jarjar jarfile="${target_jars}/NewJARs.jar">
        <zipfileset src="${jars}/jwsdp/saaj-api.jar"/>
        <zipfileset src="${jars}/jwsdp/saaj-impl.jar"/>
        <zipfileset src="${jars}/jwsdp/xalan.jar"/>
        <zipfileset src="${jars}/jwsdp/xercesImpl.jar"/>
        <rule pattern="com.sun.**" result="com.mycompany.com.sun.@1"/>
        <rule pattern="javax.**" result="com.mycompany.javax.@1"/>
        <rule pattern="org.**" result="com.mycompany.org.@1"/>
    </jarjar>
3. The properties in META-INF/services are not replaced with the
appropriate new package name, e.g. javax.xml.parsers.DocumentBuilderFactory
is still pointing at
com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl

What is the expected output? What do you see instead?
Expected to see javax.xml.parsers.DocumentBuilderFactory pointing at
com.mycompany.com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl

What version of the product are you using? On what operating system?
jarjar-1.0

Please provide any additional information below.


Original issue reported on code.google.com by [email protected] on 4 Feb 2009 at 3:47

index="true" doesn't work on jarjar ant task

What steps will reproduce the problem?
1. Set index="true" on a jarjar ant task

What is the expected output? What do you see instead?
I expect a valid INDEX.LIST however I get one containing only the jar name.
No packages.

What version of the product are you using? On what operating system?
Windows XP
Java 1.6.0_02
Ant 1.7.0
JarJar 1.0rc5

Please provide any additional information below.

Here's my task definition:

<jarjar jarfile="myjar.jar" index="true">
  <fileset dir="tmp" includes="somepackage/*.class/>
  <zipfileset src="lib/jartoinclude.jar"/>
  <rule pattern="org.apps.**" result="org.otherapps.@1"/>
</jarjar>

Original issue reported on code.google.com by [email protected] on 5 Oct 2007 at 11:22

JarJar produces corrupt files

What steps will reproduce the problem?
1. Check out Google Guice
2. Invoke "ant clean.all dist"
3. guice-snapshot.jar as generated by JarJar will have many files packed as
0 bytes.
4. This issue is reproducible 100% of the time.

What is the expected output? What do you see instead?
I expect to see the same output as running "jar" but instead I see 0-byte
files.

What version of the product are you using? On what operating system?
1.0rc7 under Windows Vista 64-bit.

Please provide any additional information below.
I am using Ant 1.7.1 under JDK 1.6.0_10-rc-b27

Original issue reported on code.google.com by [email protected] on 14 Jul 2008 at 6:49

Resources repackaged but not zapped

What steps will reproduce the problem?
1. Take any jar file containing non .class resource, e.g. .properties
2. Zap a package containing resources (zap pkg.**)

What is the expected output? What do you see instead?

Expecting: Zapped package along with resources.
Actual: .class files zapped, but resources files remain.

What version of the product are you using? On what operating system?

1.2, Ubuntu.

Please provide any additional information below.

Note that repackage rules apply to resources just like they apply to class 
files. I am not sure why zap treats resources differently.

Original issue reported on code.google.com by [email protected] on 16 Feb 2012 at 7:06

Empty folders created in resulting archive

What steps will reproduce the problem?
1. Use a jar with folder entries
2. Run the jarjar task with a keep rule that pulls in some transitive
dependencies from the jar in step 1
3.

What is the expected output? What do you see instead?
The resulting jar is nicely created but it is polluted with empty folder
from the dependency jar. In my case, class a.b.c.D is pulled in but Jarjar
creates folder entries for a.e, a.f, a.b.g, a.b.i and so on even though
they are not needed.
I would expect these folders to not be copied since none of their content
(whether class or reasources) is required.

What version of the product are you using? On what operating system?
I'm using Ant 1.7.1 (from Maven) and Jarjar 1.0.

Please provide any additional information below.


Original issue reported on code.google.com by [email protected] on 25 May 2009 at 11:40

jarjar-1.0rc7 fails build

What steps will reproduce the problem?
1. ant clean jar

What is the expected output? What do you see instead?

I expect jarjar-1.0rc7.jar to be properly build. Instead I see:

Buildfile: build.xml

clean:

init:
     [echo] bootclasspath 

compile:
    [mkdir] Created dir: /home/jieryn/jarjar/build/main
     [copy] Copying 1 file to /home/jieryn/jarjar/build/main
     [copy] Copied 4 empty directories to 1 empty directory under
/home/jieryn/jarjar/build/main
    [javac] Compiling 38 source files to /home/jieryn/jarjar/build/main

jar:
    [mkdir] Created dir: /home/jieryn/jarjar/dist
   [jarjar] Building jar: /home/jieryn/jarjar/dist/jarjar-1.0rc7.jar

BUILD FAILED
java.lang.NoSuchMethodError:
org.objectweb.asm.ClassReader.accept(Lorg/objectweb/asm/ClassVisitor;I)V
        at com.tonicsystems.jarjar.KeepProcessor.process(KeepProcessor.java:73)
        at
com.tonicsystems.jarjar.util.JarProcessorChain.process(JarProcessorChain.java:31
)
        at com.tonicsystems.jarjar.MainProcessor.process(MainProcessor.java:82)
        at
com.tonicsystems.jarjar.util.AntJarProcessor.zipFile(AntJarProcessor.java:55)
        at org.apache.tools.ant.taskdefs.Zip.zipFile(Zip.java:1551)
        at org.apache.tools.ant.taskdefs.Zip.addResources(Zip.java:792)
        at org.apache.tools.ant.taskdefs.Zip.addResources(Zip.java:853)
        at org.apache.tools.ant.taskdefs.Zip.executeMain(Zip.java:499)
        at org.apache.tools.ant.taskdefs.Zip.execute(Zip.java:416)
        at
com.tonicsystems.jarjar.util.AntJarProcessor.execute(AntJarProcessor.java:42)
        at com.tonicsystems.jarjar.JarJarTask.execute(JarJarTask.java:50)
        at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
        at sun.reflect.GeneratedMethodAccessor1.invoke(Unknown Source)
        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.jav
a:25)
        at java.lang.reflect.Method.invoke(Method.java:585)
        at
org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
        at org.apache.tools.ant.Task.perform(Task.java:348)
        at org.apache.tools.ant.Target.execute(Target.java:357)
        at org.apache.tools.ant.Target.performTasks(Target.java:385)
        at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1337)
        at org.apache.tools.ant.Project.executeTarget(Project.java:1306)
        at
org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:
41)
        at org.apache.tools.ant.Project.executeTargets(Project.java:1189)
        at org.apache.tools.ant.Main.runBuild(Main.java:758)
        at org.apache.tools.ant.Main.startAnt(Main.java:217)
        at org.apache.tools.ant.launch.Launcher.run(Launcher.java:257)
        at org.apache.tools.ant.launch.Launcher.main(Launcher.java:104)

Total time: 1 second


What version of the product are you using? On what operating system?

1.0-rc7, Linux.

Please provide any additional information below.


Original issue reported on code.google.com by [email protected] on 12 Aug 2008 at 6:10

JarJar does not work with ant 1.8.0RC1

Using ant 1.8.0RC1 you get a jar, but no classes have been removed and no 
packages have been renamed. It seems that JarJar just stops working after 
having created the normal jar that the normal ant jar task produces.

With ant 1.7.1 it works.

See: http://code.google.com/p/solidbase/issues/detail?id=34
(not much extra information there, but still)

Original issue reported on code.google.com by [email protected] on 20 Jan 2010 at 10:38

Upload for maven 2 repositories?

Please provide any additional information below.

Would it be possible to have a recent version of jarjar uploaded to the
maven 2 repositories? I am happy to help put together the bundle if that
will assist. Instructions for manual uploading are here:

http://maven.apache.org/guides/mini/guide-central-repository-upload.html

Not sure if google code has a sync option available.

Another option would be to create your own local repo. This is what seems
to have been done here:

http://code.google.com/p/gwt-maven/

in this directory

http://gwt-maven.googlecode.com/svn/trunk/mavenrepo/

That would need to be added to a repo proxy for one of my customers but
would certainly be doable.

Original issue reported on code.google.com by [email protected] on 6 Mar 2008 at 2:33

JarJar Ant task does not repackage package-info.class files

What steps will reproduce the problem?
1. Attempt to jarjar com.google.collections:google-collections:1.0-rc4 
using pattern com.google.common.** -> com.acme.repackaged.@0
2. Inspect the resulting JAR

What is the expected output? What do you see instead?

The file com/google/common/collect/package-info.class should (?) be moved 
to package com/acme/repackaged/com/google/common/collect. Instead, it is 
still at its old location com/google/common/collect.

What version of the product are you using? On what operating system?

The test was carried out running the JarJar Ant task via Maven using the 
following configuration:

<project>
  ...
  <dependency>
    <groupId>com.google.collections</groupId>
    <artifactId>google-collections</artifactId>
    <version>1.0-rc4</version>
  </dependency>
  ...
  <build>
      <plugins>
          <plugin>
              <artifactId>maven-assembly-plugin</artifactId>
              <executions>
                  <execution>
                      <phase>package</phase>
                      <goals>
                          <goal>single</goal>
                      </goals>
                      <configuration>
                          <descriptorRefs>
                              <descriptorRef>jar-with-
dependencies</descriptorRef>
                          </descriptorRefs>
                      </configuration>
                  </execution>
              </executions>
          </plugin>   
          <plugin>
              <artifactId>maven-antrun-plugin</artifactId>
              <executions>
                  <execution>
                      <phase>package</phase>
                      <goals>
                          <goal>run</goal>
                      </goals>
                      <configuration>
                          <tasks>
                              <taskdef name="jarjar" 
classname="com.tonicsystems.jarjar.JarJarTask"/>
                              <jarjar 
destfile="${build.directory}/${build.finalName}-jar-with-dependencies.jar"
                                      update="true">
                                  <rule pattern="com.google.common.**" 
result="${groupId}.repackaged.@0"/>
                              </jarjar>
                          </tasks>
                      </configuration>
                  </execution>
              </executions>
              <dependencies>
                  <dependency>
                      <groupId>com.tonicsystems.jarjar</groupId>
                      <artifactId>jarjar</artifactId>
                      <version>1.0-rc8</version>
                  </dependency>
              </dependencies>
          </plugin>                     
      </plugins>
  </build>
</project>

I'm assuming this is equivalent to running the Ant or even command-line 
task, but of course there is always a chance this is down to Maven. I would 
suspect not, but haven't verified this.

Original issue reported on code.google.com by [email protected] on 17 Dec 2009 at 2:23

Attachments:

Feature request: apply rules to textual matches

What steps will reproduce the problem?
Use a JAR file that has textual class references in it, via an embedded
Spring context (like Spring DM), an Ant task definition properties file, etc.

What is the expected output? What do you see instead?
If I map class a.b.c.MyTask to x.y.z.MyTask, the textual references in
my-tasks.properties would also be changed.  I currently see that they are
unaffected, and when I peruse the task definition in the source, I don't
see an option for turning on such a feature.

What version of the product are you using? On what operating system?
1.0-rc8

Please provide any additional information below.
I think this would be very handy to make jarjar even more compatible. 
Optionally and additionally, it would be nice if String variables that
point to fully qualified class names would be changed.  Some libraries
(unfortunately) use this technique rather than MyClass.class.getName().

Original issue reported on code.google.com by [email protected] on 8 Dec 2008 at 8:04

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.