Uploaded image for project: 'James Server'
  1. James Server
  2. JAMES-3214

Remove test only libraries from being pulled as transitive dependencies of production artifacts

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • None
    • None
    • None

    Description

      assertj-core , equalsverifier, rest-assured (and maybe other libraries) belong to testing (probably more). And they leaked to our "production" builds which depends on just 2 jars from James:

      implementation "org.apache.james:james-server-jpa-guice:${jamesVersion}"
      implementation "org.apache.james:james-server-cli:${jamesVersion}"

      == Context

      I'm working with David @dleangen on the self hosting with Apache James. We built a sandbox to play around and experiment: https://github.com/ieugen/james-self-hosting-sandbox .

      Current setup is to use gradle + application plugin to build a custom distribution.
      We build a zip distribution that pulls in all the dependencies including the offending ones used in testing.

      The distribution has 137MB unpacked. files just James, without the JRE.

      On initial inspection it seems there are test only dependencies that are being pulled as transitive dependencies of the 2 dependencies:

      Bellow is a list of top most large dependencies with ls -lSh james-self-hosting-sandbox/lib | head -n 40
      total 132M
      rw-rr- 1 ieugen ieugen 13M iun 12 13:19 icu4j-64.2.jar
      rw-rr- 1 ieugen ieugen 12M iun 12 13:19 testcontainers-1.12.0.jar
      rw-rr- 1 ieugen ieugen 5,5M iun 12 13:19 scala-library-2.13.1.jar
      rw-rr- 1 ieugen ieugen 5,3M iun 12 13:19 groovy-2.5.6.jar
      rw-rr- 1 ieugen ieugen 5,0M iun 12 13:19 camel-core-2.24.1.jar
      rw-rr- 1 ieugen ieugen 4,4M iun 12 13:19 openjpa-3.1.0.jar
      rw-rr- 1 ieugen ieugen 4,4M iun 12 13:19 bcprov-jdk15on-1.62.jar
      rw-rr- 1 ieugen ieugen 4,2M iun 12 13:19 assertj-core-3.12.2.jar
      rw-rr- 1 ieugen ieugen 3,7M iun 12 13:19 jaxb-osgi-2.2.10.jar
      rw-rr- 1 ieugen ieugen 3,5M iun 12 13:19 scala-reflect-2.13.1.jar
      rw-rr- 1 ieugen ieugen 3,5M iun 12 13:19 lucene-smartcn-3.6.2.jar
      rw-rr- 1 ieugen ieugen 3,2M iun 12 13:19 shapeless_2.13-2.3.3.jar
      rw-rr- 1 ieugen ieugen 3,1M mai 3 05:45 derby-10.14.2.0.jar
      rw-rr- 1 ieugen ieugen 2,8M iun 12 13:19 equalsverifier-3.1.9.jar
      rw-rr- 1 ieugen ieugen 2,7M iun 12 13:19 guava-28.1-jre.jar
      rw-rr- 1 ieugen ieugen 2,6M iun 12 13:19 jna-platform-5.3.1.jar
      rw-rr- 1 ieugen ieugen 2,4M iun 12 13:19 jgroups-3.6.13.Final.jar
      rw-rr- 1 ieugen ieugen 2,2M feb 17 21:24 commons-math3-3.6.1.jar
      rw-rr- 1 ieugen ieugen 1,5M iun 12 13:19 lucene-core-3.6.2.jar
      rw-rr- 1 ieugen ieugen 1,5M iun 12 13:19 reactor-core-3.3.0.RELEASE.jar
      rw-rr- 1 ieugen ieugen 1,5M iun 12 13:19 jna-5.3.1.jar
      rw-rr- 1 ieugen ieugen 1,4M iun 12 13:19 activemq-client-5.15.9.jar
      rw-rr- 1 ieugen ieugen 1,4M iun 12 13:19 jackson-databind-2.10.1.jar
      rw-rr- 1 ieugen ieugen 1,4M iun 12 13:19 httpclient-osgi-4.5.9.jar
      rw-rr- 1 ieugen ieugen 1,3M iun 12 13:19 netty-3.10.6.Final.jar
      rw-rr- 1 ieugen ieugen 1,2M iun 12 13:19 activemq-broker-5.15.9.jar
      rw-rr- 1 ieugen ieugen 1,2M iun 12 13:19 lucene-analyzers-3.6.2.jar
      rw-rr- 1 ieugen ieugen 1,1M iun 12 13:19 jaxb-impl-2.3.1.jar
      rw-rr- 1 ieugen ieugen 851K iun 12 13:19 bcpkix-jdk15on-1.62.jar
      rw-rr- 1 ieugen ieugen 827K iun 12 13:19 guice-4.2.2.jar
      rw-rr- 1 ieugen ieugen 757K iun 12 13:19 httpclient-4.5.10.jar
      rw-rr- 1 ieugen ieugen 737K iun 12 13:19 commons-collections4-4.3.jar
      rw-rr- 1 ieugen ieugen 732K iun 12 13:19 play-json_2.13-2.8.1.jar
      rw-rr- 1 ieugen ieugen 718K iun 12 13:19 javassist-3.21.0-GA.jar
      rw-rr- 1 ieugen ieugen 715K iun 12 13:19 artemis-core-client-2.9.0.jar
      rw-rr- 1 ieugen ieugen 687K iun 12 13:19 rest-assured-4.0.0.jar
      rw-rr- 1 ieugen ieugen 670K iun 12 13:19 activemq-openwire-legacy-5.15.9.jar
      rw-rr- 1 ieugen ieugen 663K iun 12 13:19 activemq-kahadb-store-5.15.9.jar
      rw-rr- 1 ieugen ieugen 644K mai 3 05:45 javax.mail-1.6.2.jar

      I believe this is quite big.

      Attachments

        1. runtimeClasspath.txt
          74 kB
          Ioan Eugen Stan

        Issue Links

          Activity

            People

              ieugen Ioan Eugen Stan
              ieugen Ioan Eugen Stan
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 4h 20m
                  4h 20m