I think i was somehow misunderstanding how JarJar can be used. What I wanted to do is: - pack into 1 jar only the required classes of a project, including those in the (transitive) dependencies What JarJar let me do is: - remove from 1 jar all unwanted/unrequired dependencies
The two things are clearly complementary, but actually the same. So, what I could do here is: - make a big-big jar with all transitive dependencies (using the assembly plugin, jar-with-dependencies) - strip it down using jarjar do to so, I would need a configuration parameter for JarJar to specify over which jar to run the rules (if not specified, it would be the project artifact, as it is now). Do you think that such parameter could be easily added ? On Sun, Oct 12, 2008 at 8:48 PM, Valerio Schiavoni < [EMAIL PROTECTED]> wrote: > Hello Samuel, > thanks for your support! > > I've tried with the configuration you proposed and indeed the jar is > successfully created. > But: the resulting jar doesn't include the transitive dependencies, which > was the whole point of using the jarjar. > So, i've tried to use jarjar from command-line, and I get a jar that is > exactly how I was expecting. This is how I use it: > > java -jar jarjar-1.0rc8.jar process rules.txt target/original.jar > target/shrinked.jar > > where rules.txt is: > keep gossip.simulator.Simulator > keep gossip.simulator.protocol.* > keep gossip.simulator.collectors.* > keep gossip.simulator.evolvers.* > keep gossip.simulator.initializers.* > > With such configuration, the shirinked.jar does contain the necessary > classes used from the transitive dependencies. > > The doc here > http://docs.atlassian.com/jarjar-maven-plugin/jarjar-mojo.html#rulesdoesn't > seem to explain how to reflect those keep rules into configuration > parameters of the mojo. Could you provide an example of it ? > Valerio > > > On Sun, Oct 12, 2008 at 10:08 AM, Samuel Le Berrigaud < > [EMAIL PROTECTED]> wrote: > >> Hi Valerio, >> >> I commited some more code that should allow you to exclude those >> licenses. With a plugin configuration like: >> >> <plugin> >> <groupId>com.atlassian.maven.plugins</groupId> >> <artifactId>jarjar-maven-plugin</artifactId> >> <version>0.0.4</version> >> <executions> >> <execution> >> <goals> <goal>jarjar</goal></goals> >> </execution> >> </executions> >> <configuration> >> <projectPackage>gossip.simulator</projectPackage> >> <zips> >> <zip> >> <dependency>[groupId]:[artifactId]</dependency> >> <excludes> >> <exclude>LICENSE.txt</exclude> >> <excludes> >> <zip> >> </configuration> >> </plugin> >> >> Hope this helps. Let me know. I'll try to document a bit more what >> I've done over the coming week. >> >> SaM >> >> On Sat, Oct 11, 2008 at 7:59 PM, Valerio Schiavoni >> <[EMAIL PROTECTED]> wrote: >> > Hello, >> > i've tried version 0.0.3: it still fails complaining about duplicate : >> > java.lang.IllegalArgumentException: Duplicate jar entries: LICENSE.txt >> > >> > the thing is: there might files which are not inside META-INF/ and thus >> > needs to be excluded. >> > The zap rules don't seem to apply on files which are not recognized to >> be >> > classes, or at least so it says the doc for the zap rules: >> > * <p>This is a list of patterns. Packages and classes matched by those >> > patterns will be removed from the >> > * artifact.</p> >> > >> > I'm attaching the pom.xml for your convenience. >> > >> > Thanks! >> > valerio >> > >> > On Sat, Oct 11, 2008 at 7:29 AM, Samuel Le Berrigaud < >> [EMAIL PROTECTED]> >> > wrote: >> >> >> >> Hi Valerio, >> >> >> >> I managed to reproduced the same issues. I fixed that by excluding >> >> contents of META-INF/ from included dependencies. Hopefully this will >> >> be sufficient for you as well… I released version 0.0.3 with those >> >> changes. Give it a try and let me know. >> >> >> >> SaM >> >> >> >> On Sat, Oct 11, 2008 at 12:46 PM, Samuel Le Berrigaud >> >> <[EMAIL PROTECTED]> wrote: >> >> > Thanks for the input Valerio. >> >> > >> >> > Could I by any chance ask you to paste (attach) the pom.xml you are >> >> > using? I would like to reproduce those errors locally and fix them >> (as >> >> > much as possible). >> >> > >> >> > Thanks, >> >> > SaM >> >> > >> >> > On Sat, Oct 11, 2008 at 11:30 AM, Valerio Schiavoni >> >> > <[EMAIL PROTECTED]> wrote: >> >> >> Also, if I try to specify only the name of the file to exclude, >> >> >> something >> >> >> else happen: >> >> >> >> >> >> For instance: >> >> >> : java.lang.IllegalArgumentException: Duplicate jar entries: >> >> >> LICENSE.txt >> >> >> at >> >> >> >> >> >> >> org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:116) >> >> >> at org.apache.tools.ant.Task.perform(Task.java:348) >> >> >> at groovy.util.AntBuilder.nodeCompleted(AntBuilder.java:199) >> >> >> at >> >> >> groovy.util.BuilderSupport.doInvokeMethod(BuilderSupport.java:153) >> >> >> at groovy.util.AntBuilder.doInvokeMethod(AntBuilder.java:149) >> >> >> at >> groovy.util.BuilderSupport.invokeMethod(BuilderSupport.java:64) >> >> >> at >> >> >> >> >> >> >> org.codehaus.groovy.runtime.InvokerHelper.invokePogoMethod(InvokerHelper.java:784) >> >> >> at >> >> >> >> >> >> >> org.codehaus.groovy.runtime.InvokerHelper.invokeMethod(InvokerHelper.java:758) >> >> >> at >> >> >> >> >> >> >> org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethodN(ScriptBytecodeAdapter.java:170) >> >> >> at >> >> >> >> >> >> >> com.atlassian.maven.plugins.jarjar.JarJarMojo.execute(JarJarMojo.groovy:80) >> >> >> >> >> >> >> >> >> even by having specified the following: >> >> >> <zaps> >> >> >> <zap>LICENSE.txt</zap> >> >> >> </zaps> >> >> >> >> >> >> >> >> >> Hope it helps debugging this mojo, which I believe is very useful! >> >> >> On Sat, Oct 11, 2008 at 2:14 AM, Valerio Schiavoni >> >> >> <[EMAIL PROTECTED]> wrote: >> >> >>> >> >> >>> hi, >> >> >>> On Sat, Oct 11, 2008 at 2:08 AM, Samuel Le Berrigaud >> >> >>> <[EMAIL PROTECTED]> wrote: >> >> >>>> >> >> >>>> <zaps> >> >> >>>> <zap>META-INF/maven/**</zap> >> >> >>>> <zaps> >> >> >>>> ... >> >> >>>> </configuration> >> >> >>>> >> >> >>>> This might not be ideal, but it should remove the duplicate >> entries. >> >> >>> >> >> >>> unfortunetely it doesn't work: >> >> >>> java.lang.IllegalArgumentException: Patterns cannot contain slashes >> >> >>> at >> >> >>> >> >> >>> >> com.tonicsystems.jarjar.PatternElement.createWildcards(PatternElement.java:39) >> >> >>> at >> >> >>> com.tonicsystems.jarjar.ZapProcessor.<init>(ZapProcessor.java:28) >> >> >>> at >> >> >>> com.tonicsystems.jarjar.MainProcessor.<init>(MainProcessor.java:54) >> >> >>> at >> com.tonicsystems.jarjar.JarJarTask.execute(JarJarTask.java:48) >> >> >>> >> >> >>> >> >> >>> i haven't read the full jarjar doc..maybe I should have. >> >> >>> >> >> >>> -- >> >> >>> http://www.linkedin.com/in/vschiavoni >> >> >>> http://jroller.com/vschiavoni >> >> >> >> >> >> >> >> >> >> >> >> -- >> >> >> http://www.linkedin.com/in/vschiavoni >> >> >> http://jroller.com/vschiavoni >> >> >> >> >> > >> > >> > >> > >> > -- >> > http://www.linkedin.com/in/vschiavoni >> > http://jroller.com/vschiavoni >> > >> > --------------------------------------------------------------------- >> > To unsubscribe from this list, please visit: >> > >> > http://xircles.codehaus.org/manage_email >> > >> > >> > > > > -- > http://www.linkedin.com/in/vschiavoni > http://jroller.com/vschiavoni > -- http://www.linkedin.com/in/vschiavoni http://jroller.com/vschiavoni
