<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>

    <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  </head>
  <body text="#000000" bgcolor="#ffffff">
    Hi guys,<br>
    <br>
    We should actively notify/teach each other about tips and tricks.<br>
    There's a lot we can learn from each other.<br>
    I'll start with a build tip:<br>
    <br>
    <br>
    The problem<br>
    ========<br>
    - How bloated is the dependency tree of my module? This affects the
    download zip size, but also the minimal jars needed to run.<br>
    - Are there dead dependency left in my module?<br>
    <br>
    The solution<br>
    ========<br>
    - First thing to understand is that it has to reviewed module by
    module<br>
    (focus on end-user modules such as drools-compiler,
    drools-camel-server, guvnor-webapp, ...).<br>
    - Use the command <b>mvn dependency:tree</b><br>
    <br>
    Example<br>
    =====<br>
    <br>
    Here's the output on drools-compiler.<br>
    I've annotated a couple of possible incidents which might or might
    not be a problem.<br>
    It's hard to tell without someone with extensive drools-compiler
    experience looking further into it.<br>
    <br>
    drools-compiler [master] $ mvn dependency:tree<br>
    [INFO] Scanning for projects...<br>
    [INFO]                                                                        
    <br>
    [INFO]
    ------------------------------------------------------------------------<br>
    [INFO] Building Drools :: Compiler 5.3.0-SNAPSHOT<br>
    [INFO]
    ------------------------------------------------------------------------<br>
    [INFO] <br>
    [INFO] --- maven-dependency-plugin:2.2:tree (default-cli) @
    drools-compiler ---<br>
    [INFO] org.drools:drools-compiler:jar:5.3.0-SNAPSHOT<br>
    [INFO] +- org.drools:drools-core:jar:5.3.0-SNAPSHOT:compile<br>
    [INFO] |  \- org.drools:knowledge-api:jar:5.3.0-SNAPSHOT:compile<br>
    [INFO] +- org.drools:drools-core:test-jar:tests:5.3.0-SNAPSHOT:test<br>
    [INFO] +- org.apache.felix:org.osgi.core:jar:1.4.0:provided<br>
    [INFO] +- org.apache.felix:org.osgi.compendium:jar:1.4.0:provided<br>
    [INFO] +- org.antlr:<b>antlr-runtime:jar:3.3</b>:compile<br>
    [INFO] +- org.antlr:<b>antlr:jar:3.3</b>:compile<br>
       <b>Incident</b> 1: maybe org.antlr:antlr-runtime:jar:3.3 is a
    subset of org.antlr:antlr-runtime:jar:3.3 ? (antlr is wierd IIRC -
    so this is probably not in this case)<br>
    [INFO] +- org.antlr:stringtemplate:jar:3.2.1:compile<br>
    [INFO] +- antlr:<b>antlr:jar:2.7.7</b>:compile<br>
       <b>Incident</b> 2: maybe antlr:antlr:jar:2.7.7 is a subset of
    org.antlr:antlr-runtime:jar:3.3 ? (antlr is wierd IIRC - so this is
    probably not in this case)<br>
       In general, dependencies with a non-namespaced groupId need to be
    upgraded if possible.<br>
    [INFO] +- org.antlr:gunit:jar:3.3:test<br>
    [INFO] +- org.eclipse.jdt.core.compiler:ecj:jar:3.5.1:compile<br>
    [INFO] +- janino:janino:jar:2.5.15:compile<br>
       Note that janino is optional (output doesn't show that :( ) - no
    problem here<br>
    [INFO] +- org.mvel:mvel2:jar:2.1-SNAPSHOT:compile<br>
    [INFO] +- com.thoughtworks.xstream:xstream:jar:1.3.1:test<br>
    [INFO] |  \- xpp3:xpp3_min:jar:1.1.4c:test<br>
    [INFO] +- org.mortbay.<b>jetty</b>:jetty-embedded:jar:6.1.15:test<br>
       <b>Incident</b> 3: Wierd that drools-compiler would need jetty
    to test something?<br>
    [INFO] |  +- org.mortbay.jetty:jetty:jar:6.1.15:test<br>
    [INFO] |  |  +- org.mortbay.jetty:jetty-util:jar:6.1.15:test<br>
    [INFO] |  |  \- org.mortbay.jetty:servlet-api:jar:2.5-20081211:test<br>
    [INFO] |  \- javax.servlet.jsp:jsp-api:jar:2.1:test<br>
    [INFO] +- org.opensymphony.quartz:quartz:jar:1.6.1:test<br>
    [INFO] +- com.sun.xml.bind:jaxb-xjc:jar:2.2.1.1:provided<br>
    [INFO] +- com.sun.xml.bind:jaxb-impl:jar:2.2.1.1:provided<br>
    [INFO] +- javax.xml.bind:jaxb-api:jar:2.2.1:provided<br>
    [INFO] +- javax.xml.stream:stax-api:jar:1.0-2:provided<br>
    [INFO] +- javax.activation:activation:jar:1.1:provided<br>
    [INFO] +- net.java.dev.<b>glazedlists</b>:glazedlists_java15:jar:1.8.0:test<br>
       <b>Incident</b> 4: Wierd that drools-compiler would need a swing
    framework to test something?<br>
    [INFO] +- junit:junit:jar:4.8.1:test<br>
    [INFO] \- org.mockito:mockito-all:jar:1.8.2:test<br>
    [INFO]
    ------------------------------------------------------------------------<br>
    [INFO] BUILD
    SUCCESS                                                                                                                                                                                                                        
    <br>
    [INFO]
    ------------------------------------------------------------------------                                                                                                                                                             
    <br>
    [INFO] Total time:
    1.951s                                                                                                                                                                                                                   
    <br>
    [INFO] Finished at: Wed May 11 15:09:09 CEST
    2011                                                                                                                                                                                           
    <br>
    [INFO] Final Memory:
    10M/309M                                                                                                                                                                                                               
    <br>
    [INFO]
    ------------------------------------------------------------------------<br>
    <br>
    Here's another example showing another type of incident:<br>
    <br>
    drools-camel-server [master] $ mvn dependency:tree<br>
    ...<br>
    [INFO] +- org.drools:drools-grid-impl:jar:5.3.0-SNAPSHOT:compile<br>
    [INFO] |  +- org.apache.mina:mina-core:jar:2.0.1:compile (version
    managed from 2.0.0-M6)<br>
    [INFO] |  \- com.hazelcast:hazelcast:jar:1.8.5:compile<br>
    ...<br>
    [INFO] +- org.apache.camel:camel-cxf:jar:2.4.0:compile<br>
    [INFO] |  \- org.apache.cxf:<b>cxf-rt-frontend-jaxrs</b>:jar:2.2.9:compile<br>
    [INFO] |     +-
    org.apache.cxf:cxf-common-utilities:jar:2.2.9:compile<br>
    [INFO] |     +-
    org.apache.cxf:cxf-rt-transports-http:jar:2.2.9:compile<br>
    [INFO] |     +-
    org.apache.cxf:cxf-rt-databinding-aegis:jar:2.2.9:compile<br>
    [INFO] |     +- jaxen:jaxen:jar:1.1.1:compile<br>
    [INFO] |     \- org.apache.xmlbeans:xmlbeans:jar:2.4.0:compile<br>
    ...<br>
    [INFO] +- org.apache.cxf:<b>cxf-bundle-jaxrs</b>:jar:2.2.9:compile<br>
      <b>Incident</b> A: This cxf-bundle-jaxrs is an uber jar. <b><i>Uber
        jars (as dependencies) are evil.</i></b><br>
         An uber jar extracts the classes from other jars and zips them
    (=aggregate) in itself.<br>
         This effectively kills maven's ability to only have 1 class of
    something in your classpath.<br>
         It turns your classpath into box of chocolates: <i>you never
      know what version of class file you'll get</i>.<br>
         Also, it bloats the classpath with things you don't need (like
    jetty in this case)<br>
         and those cause havoc if you deploy it to some app servers.<br>
    [INFO] |  +- aopalliance:aopalliance:jar:1.0:compile<br>
    [INFO] |  +-
    org.apache.geronimo.specs:geronimo-annotation_1.0_spec:jar:1.1.1:compile<br>
    [INFO] |  +-
    org.apache.geronimo.specs:geronimo-stax-api_1.0_spec:jar:1.0.1:compile<br>
    [INFO] |  +- wsdl4j:wsdl4j:jar:1.6.2:compile<br>
    [INFO] |  +-
    org.apache.ws.commons.schema:XmlSchema:jar:1.4.5:compile<br>
    [INFO] |  +- commons-lang:commons-lang:jar:2.4:compile<br>
    [INFO] |  +-
    org.apache.geronimo.specs:geronimo-activation_1.1_spec:jar:1.0.2:compile<br>
    [INFO] |  +- org.codehaus.woodstox:wstx-asl:jar:3.2.9:compile<br>
    [INFO] |  +- org.apache.neethi:neethi:jar:2.0.4:compile<br>
    [INFO] |  +-
    org.apache.geronimo.specs:geronimo-javamail_1.4_spec:jar:1.6:compile<br>
    [INFO] |  +- org.springframework:spring-web:jar:2.5.6:compile<br>
    [INFO] |  +- org.mortbay.jetty:<b>jetty</b>:jar:6.1.21:compile<br>
    [INFO] |  +- org.mortbay.jetty:jetty-util:jar:6.1.21:compile<br>
    [INFO] |  +- javax.ws.rs:jsr311-api:jar:1.0:compile<br>
    [INFO] |  +- org.apache.abdera:abdera-core:jar:1.0:compile<br>
    [INFO] |  +- org.apache.abdera:abdera-i18n:jar:1.0:compile<br>
    [INFO] |  +- commons-codec:commons-codec:jar:1.3:compile<br>
    [INFO] |  +- org.apache.abdera:abdera-parser:jar:1.0:compile<br>
    [INFO] |  +-
    org.apache.ws.commons.axiom:axiom-impl:jar:1.2.7:compile<br>
    [INFO] |  +- org.apache.ws.commons.axiom:axiom-api:jar:1.2.7:compile<br>
    [INFO] |  +-
    org.apache.abdera:abdera-extensions-json:jar:1.0:compile<br>
    [INFO] |  \-
    org.apache.abdera:abdera-extensions-main:jar:1.0:compile<br>
    ...<br>
    <br>
    Also, if you're trying to solve such things on master, try upgrading
    the dependencies first (not on a release branch - upgrading is
    risky!):<br>
    many issues in the poms tend to be identified and fixed in newer
    versions.<br>
    <pre class="moz-signature" cols="72">-- 
With kind regards,
Geoffrey De Smet</pre>
  </body>
</html>