Uploaded image for project: 'Clover'
  1. Clover
  2. CLOV-379

Surefire classpath is incorrect when depending on a jar and a test-jar from the same maven module

    • Icon: Bug Bug
    • Resolution: Won't Fix
    • Icon: Medium Medium
    • open-source
    • 2.3.2
    • Maven plugin
    • None
    • Severity 2 - Major

      We have two different applications that have the same symptom. Their test cases work properly when executed without clover, but when we run them with clover, they fail because classes or resource files are missing from the classpath.

      When running the builds with clover, the test cases are executed multiple times. Only the last time they run they fail. When checking the maven debug output (using the -X option), I found that the last time the test cases are run, a JAR file is missing from the classpath. With both applications it is a jar file from a maven module for which we both depend on the jar and test-jar types of the module.

      For example we have the following in the pom.xml file:

      <dependency>
      <groupId>${parent.groupId}</groupId>
      <artifactId>server-data-access</artifactId>
      <version>${version}</version>
      <type>test-jar</type>
      <scope>test</scope>
      </dependency>
      <dependency>
      <groupId>${parent.groupId}</groupId>
      <artifactId>server-data-access</artifactId>
      <version>${version}</version>
      </dependency>

      And for some reason, when the test cases are executed for the last time, the following second dependency is not included in the list of jars in the classpath.

      I have attached the pom.xml files from the module for which the test cases fail (server-web.pom), the pom.xml files from its parents, the pom.xml file for the module that generates both a jar and a test-jar (server-data-access.pom) and the log file that I get when running maven with the -X option.

      This is the classpath when the test cases fail (notice that /opt/bamboo/Bamboo/xml-data/build-dir/MONITORING-NIGHTLY/monitoring-server/server-data-access/target/server-data-access-1.0.2-SNAPSHOT.jar is missing):
      build 20-Nov-2008 08:47:57 [DEBUG] /opt/bamboo/Bamboo/xml-data/build-dir/MONITORING-NIGHTLY/monitoring-server/server-web/target/test-classes
      build 20-Nov-2008 08:47:57 [DEBUG] /opt/bamboo/Bamboo/xml-data/build-dir/MONITORING-NIGHTLY/monitoring-server/server-web/target/classes
      build 20-Nov-2008 08:47:57 [DEBUG] /opt/bamboo/.m2/repository/xerces/xercesImpl/2.9.1/xercesImpl-2.9.1.jar
      build 20-Nov-2008 08:47:57 [DEBUG] /opt/bamboo/.m2/repository/xml-apis/xml-apis/1.3.04/xml-apis-1.3.04.jar
      build 20-Nov-2008 08:47:57 [DEBUG] /opt/bamboo/Bamboo/xml-data/build-dir/MONITORING-NIGHTLY/monitoring-server/server-model/target/server-model-1.0.2-SNAPSHOT.jar
      build 20-Nov-2008 08:47:57 [DEBUG] /opt/bamboo/.m2/repository/commons-lang/commons-lang/2.1/commons-lang-2.1.jar
      build 20-Nov-2008 08:47:57 [DEBUG] /opt/bamboo/Bamboo/xml-data/build-dir/MONITORING-NIGHTLY/monitoring-server/server-actions/target/server-actions-1.0.2-SNAPSHOT.jar
      build 20-Nov-2008 08:47:57 [DEBUG] /opt/bamboo/.m2/repository/commons-logging/commons-logging/1.0.4/commons-logging-1.0.4.jar
      build 20-Nov-2008 08:47:57 [DEBUG] /opt/bamboo/.m2/repository/log4j/log4j/1.2.13/log4j-1.2.13.jar
      build 20-Nov-2008 08:47:57 [DEBUG] /opt/bamboo/.m2/repository/com/i4commerce/bml/util/8.19.0/util-8.19.0.jar
      build 20-Nov-2008 08:47:57 [DEBUG] /opt/bamboo/.m2/repository/com/i4commerce/bml/tk-util/8.19.0/tk-util-8.19.0.jar
      build 20-Nov-2008 08:47:57 [DEBUG] /opt/bamboo/.m2/repository/org/jboss/netty/netty/3.0.0.GA/netty-3.0.0.GA.jar
      build 20-Nov-2008 08:47:57 [DEBUG] /opt/bamboo/.m2/repository/org/springframework/spring/2.5.6/spring-2.5.6.jar
      build 20-Nov-2008 08:47:57 [DEBUG] /opt/bamboo/Bamboo/xml-data/build-dir/MONITORING-NIGHTLY/monitoring-server/server-core/target/server-core-1.0.2-SNAPSHOT.jar
      build 20-Nov-2008 08:47:57 [DEBUG] /opt/bamboo/Bamboo/xml-data/build-dir/MONITORING-NIGHTLY/monitoring-server/server-data-access/target/server-data-access-1.0.2-SNAPSHOT-tests.jar
      build 20-Nov-2008 08:47:57 [DEBUG] /opt/bamboo/.m2/repository/org/hibernate/hibernate/3.2.6.ga/hibernate-3.2.6.ga.jar
      build 20-Nov-2008 08:47:57 [DEBUG] /opt/bamboo/.m2/repository/net/sf/ehcache/ehcache/1.2.3/ehcache-1.2.3.jar
      build 20-Nov-2008 08:47:57 [DEBUG] /opt/bamboo/.m2/repository/commons-collections/commons-collections/2.1.1/commons-collections-2.1.1.jar
      build 20-Nov-2008 08:47:57 [DEBUG] /opt/bamboo/.m2/repository/javax/transaction/jta/1.0.1B/jta-1.0.1B.jar
      build 20-Nov-2008 08:47:57 [DEBUG] /opt/bamboo/.m2/repository/asm/asm-attrs/1.5.3/asm-attrs-1.5.3.jar
      build 20-Nov-2008 08:47:57 [DEBUG] /opt/bamboo/.m2/repository/dom4j/dom4j/1.6.1/dom4j-1.6.1.jar
      build 20-Nov-2008 08:47:57 [DEBUG] /opt/bamboo/.m2/repository/antlr/antlr/2.7.6/antlr-2.7.6.jar
      build 20-Nov-2008 08:47:57 [DEBUG] /opt/bamboo/.m2/repository/cglib/cglib/2.1_3/cglib-2.1_3.jar
      build 20-Nov-2008 08:47:57 [DEBUG] /opt/bamboo/.m2/repository/asm/asm/1.5.3/asm-1.5.3.jar
      build 20-Nov-2008 08:47:57 [DEBUG] /opt/bamboo/.m2/repository/org/hibernate/hibernate-annotations/3.3.0.ga/hibernate-annotations-3.3.0.ga.jar
      build 20-Nov-2008 08:47:57 [DEBUG] /opt/bamboo/.m2/repository/javax/persistence/persistence-api/1.0/persistence-api-1.0.jar
      build 20-Nov-2008 08:47:57 [DEBUG] /opt/bamboo/.m2/repository/org/hibernate/hibernate-commons-annotations/3.3.0.ga/hibernate-commons-annotations-3.3.0.ga.jar
      build 20-Nov-2008 08:47:57 [DEBUG] /opt/bamboo/.m2/repository/org/hibernate/hibernate-validator/3.0.0.ga/hibernate-validator-3.0.0.ga.jar
      build 20-Nov-2008 08:47:57 [DEBUG] /opt/bamboo/.m2/repository/org/hibernate/hibernate-search/3.0.0.GA/hibernate-search-3.0.0.GA.jar
      build 20-Nov-2008 08:47:57 [DEBUG] /opt/bamboo/.m2/repository/org/apache/lucene/lucene-core/2.2.0/lucene-core-2.2.0.jar
      build 20-Nov-2008 08:47:57 [DEBUG] /opt/bamboo/.m2/repository/javax/servlet/servlet-api/2.3/servlet-api-2.3.jar
      build 20-Nov-2008 08:47:57 [DEBUG] /opt/bamboo/.m2/repository/org/drools/drools-core/4.0.7/drools-core-4.0.7.jar
      build 20-Nov-2008 08:47:57 [DEBUG] /opt/bamboo/.m2/repository/org/mvel/mvel/1.3.1-java1.4/mvel-1.3.1-java1.4.jar
      build 20-Nov-2008 08:47:57 [DEBUG] /opt/bamboo/.m2/repository/commons-io/commons-io/1.4/commons-io-1.4.jar
      build 20-Nov-2008 08:47:57 [DEBUG] /opt/bamboo/.m2/repository/javax/j2ee/1.3/j2ee-1.3.jar
      build 20-Nov-2008 08:47:57 [DEBUG] /opt/bamboo/.m2/repository/com/sun/xml/bind/jaxb-impl/2.1.3/jaxb-impl-2.1.3.jar
      build 20-Nov-2008 08:47:57 [DEBUG] /opt/bamboo/.m2/repository/javax/xml/bind/jaxb-api/2.1/jaxb-api-2.1.jar
      build 20-Nov-2008 08:47:57 [DEBUG] /opt/bamboo/.m2/repository/javax/xml/stream/stax-api/1.0-2/stax-api-1.0-2.jar
      build 20-Nov-2008 08:47:57 [DEBUG] /opt/bamboo/.m2/repository/javax/activation/activation/1.1/activation-1.1.jar
      build 20-Nov-2008 08:47:57 [DEBUG] /opt/bamboo/.m2/repository/com/i4commerce/common/common-configuration/1.0.25/common-configuration-1.0.25.jar
      build 20-Nov-2008 08:47:57 [DEBUG] /opt/bamboo/.m2/repository/opensymphony/oscache/2.1.1/oscache-2.1.1.jar
      build 20-Nov-2008 08:47:57 [DEBUG] /opt/bamboo/.m2/repository/com/i4commerce/bml/bml-core/8.20.0-SNAPSHOT/bml-core-8.20.0-SNAPSHOT.jar
      build 20-Nov-2008 08:47:57 [DEBUG] /opt/bamboo/.m2/repository/com/i4commerce/bml/cache/8.20.0-SNAPSHOT/cache-8.20.0-SNAPSHOT.jar
      build 20-Nov-2008 08:47:57 [DEBUG] /opt/bamboo/.m2/repository/com/i4commerce/common/common-spring-util/1.0.25/common-spring-util-1.0.25.jar
      build 20-Nov-2008 08:47:57 [DEBUG] /opt/bamboo/.m2/repository/esper/esper/2.2.0/esper-2.2.0.jar
      build 20-Nov-2008 08:47:57 [DEBUG] /opt/bamboo/.m2/repository/org/antlr/antlr-runtime/3.0.1/antlr-runtime-3.0.1.jar
      build 20-Nov-2008 08:47:57 [DEBUG] /opt/bamboo/.m2/repository/org/antlr/stringtemplate/3.1-b1/stringtemplate-3.1-b1.jar
      build 20-Nov-2008 08:47:57 [DEBUG] /opt/bamboo/.m2/repository/quartz/quartz/1.5.2/quartz-1.5.2.jar
      build 20-Nov-2008 08:47:57 [DEBUG] /opt/bamboo/.m2/repository/junit/junit/3.8.1/junit-3.8.1.jar
      build 20-Nov-2008 08:47:57 [DEBUG] /opt/bamboo/.m2/repository/com/mockrunner/mockrunner/0.3.1/mockrunner-0.3.1.jar
      build 20-Nov-2008 08:47:57 [DEBUG] /opt/bamboo/.m2/repository/com/i4commerce/common/common-abstract-unit-tests/1.0.25/common-abstract-unit-tests-1.0.25-tests.jar
      build 20-Nov-2008 08:47:57 [DEBUG] /opt/bamboo/.m2/repository/com/i4commerce/bml/unittest/8.20.0-SNAPSHOT/unittest-8.20.0-SNAPSHOT.jar
      build 20-Nov-2008 08:47:57 [DEBUG] /opt/bamboo/Bamboo/xml-data/build-dir/MONITORING-NIGHTLY/monitoring-server/server-data-access/target/server-data-access-1.0.2-SNAPSHOT-tests.jar
      build 20-Nov-2008 08:47:57 [DEBUG] /opt/bamboo/.m2/repository/com/oracle/oracle_jdbc/10.2.0.2.0/oracle_jdbc-10.2.0.2.0.jar

      This is the classpath for when it succeeds:
      build 20-Nov-2008 08:45:07 [DEBUG] /opt/bamboo/Bamboo/xml-data/build-dir/MONITORING-NIGHTLY/monitoring-server/server-web/target/test-classes
      build 20-Nov-2008 08:45:07 [DEBUG] /opt/bamboo/Bamboo/xml-data/build-dir/MONITORING-NIGHTLY/monitoring-server/server-web/target/classes
      build 20-Nov-2008 08:45:07 [DEBUG] /opt/bamboo/.m2/repository/xerces/xercesImpl/2.9.1/xercesImpl-2.9.1.jar
      build 20-Nov-2008 08:45:07 [DEBUG] /opt/bamboo/.m2/repository/xml-apis/xml-apis/1.3.04/xml-apis-1.3.04.jar
      build 20-Nov-2008 08:45:07 [DEBUG] /opt/bamboo/Bamboo/xml-data/build-dir/MONITORING-NIGHTLY/monitoring-server/server-model/target/server-model-1.0.2-SNAPSHOT.jar
      build 20-Nov-2008 08:45:07 [DEBUG] /opt/bamboo/.m2/repository/commons-lang/commons-lang/2.1/commons-lang-2.1.jar
      build 20-Nov-2008 08:45:07 [DEBUG] /opt/bamboo/Bamboo/xml-data/build-dir/MONITORING-NIGHTLY/monitoring-server/server-actions/target/server-actions-1.0.2-SNAPSHOT.jar
      build 20-Nov-2008 08:45:07 [DEBUG] /opt/bamboo/.m2/repository/commons-logging/commons-logging/1.0.4/commons-logging-1.0.4.jar
      build 20-Nov-2008 08:45:07 [DEBUG] /opt/bamboo/.m2/repository/log4j/log4j/1.2.13/log4j-1.2.13.jar
      build 20-Nov-2008 08:45:07 [DEBUG] /opt/bamboo/.m2/repository/com/i4commerce/bml/util/8.19.0/util-8.19.0.jar
      build 20-Nov-2008 08:45:07 [DEBUG] /opt/bamboo/.m2/repository/com/i4commerce/bml/tk-util/8.19.0/tk-util-8.19.0.jar
      build 20-Nov-2008 08:45:07 [DEBUG] /opt/bamboo/.m2/repository/org/jboss/netty/netty/3.0.0.GA/netty-3.0.0.GA.jar
      build 20-Nov-2008 08:45:07 [DEBUG] /opt/bamboo/.m2/repository/org/springframework/spring/2.5.6/spring-2.5.6.jar
      build 20-Nov-2008 08:45:07 [DEBUG] /opt/bamboo/Bamboo/xml-data/build-dir/MONITORING-NIGHTLY/monitoring-server/server-core/target/server-core-1.0.2-SNAPSHOT.jar
      build 20-Nov-2008 08:45:07 [DEBUG] /opt/bamboo/Bamboo/xml-data/build-dir/MONITORING-NIGHTLY/monitoring-server/server-data-access/target/server-data-access-1.0.2-SNAPSHOT.jar
      build 20-Nov-2008 08:45:07 [DEBUG] /opt/bamboo/.m2/repository/org/hibernate/hibernate/3.2.6.ga/hibernate-3.2.6.ga.jar
      build 20-Nov-2008 08:45:07 [DEBUG] /opt/bamboo/.m2/repository/net/sf/ehcache/ehcache/1.2.3/ehcache-1.2.3.jar
      build 20-Nov-2008 08:45:07 [DEBUG] /opt/bamboo/.m2/repository/commons-collections/commons-collections/2.1.1/commons-collections-2.1.1.jar
      build 20-Nov-2008 08:45:07 [DEBUG] /opt/bamboo/.m2/repository/javax/transaction/jta/1.0.1B/jta-1.0.1B.jar
      build 20-Nov-2008 08:45:07 [DEBUG] /opt/bamboo/.m2/repository/asm/asm-attrs/1.5.3/asm-attrs-1.5.3.jar
      build 20-Nov-2008 08:45:07 [DEBUG] /opt/bamboo/.m2/repository/dom4j/dom4j/1.6.1/dom4j-1.6.1.jar
      build 20-Nov-2008 08:45:07 [DEBUG] /opt/bamboo/.m2/repository/antlr/antlr/2.7.6/antlr-2.7.6.jar
      build 20-Nov-2008 08:45:07 [DEBUG] /opt/bamboo/.m2/repository/cglib/cglib/2.1_3/cglib-2.1_3.jar
      build 20-Nov-2008 08:45:07 [DEBUG] /opt/bamboo/.m2/repository/asm/asm/1.5.3/asm-1.5.3.jar
      build 20-Nov-2008 08:45:07 [DEBUG] /opt/bamboo/.m2/repository/org/hibernate/hibernate-annotations/3.3.0.ga/hibernate-annotations-3.3.0.ga.jar
      build 20-Nov-2008 08:45:07 [DEBUG] /opt/bamboo/.m2/repository/javax/persistence/persistence-api/1.0/persistence-api-1.0.jar
      build 20-Nov-2008 08:45:07 [DEBUG] /opt/bamboo/.m2/repository/org/hibernate/hibernate-commons-annotations/3.3.0.ga/hibernate-commons-annotations-3.3.0.ga.jar
      build 20-Nov-2008 08:45:07 [DEBUG] /opt/bamboo/.m2/repository/org/hibernate/hibernate-validator/3.0.0.ga/hibernate-validator-3.0.0.ga.jar
      build 20-Nov-2008 08:45:07 [DEBUG] /opt/bamboo/.m2/repository/org/hibernate/hibernate-search/3.0.0.GA/hibernate-search-3.0.0.GA.jar
      build 20-Nov-2008 08:45:07 [DEBUG] /opt/bamboo/.m2/repository/org/apache/lucene/lucene-core/2.2.0/lucene-core-2.2.0.jar
      build 20-Nov-2008 08:45:07 [DEBUG] /opt/bamboo/.m2/repository/javax/servlet/servlet-api/2.3/servlet-api-2.3.jar
      build 20-Nov-2008 08:45:07 [DEBUG] /opt/bamboo/.m2/repository/org/drools/drools-core/4.0.7/drools-core-4.0.7.jar
      build 20-Nov-2008 08:45:07 [DEBUG] /opt/bamboo/.m2/repository/org/mvel/mvel/1.3.1-java1.4/mvel-1.3.1-java1.4.jar
      build 20-Nov-2008 08:45:07 [DEBUG] /opt/bamboo/.m2/repository/commons-io/commons-io/1.4/commons-io-1.4.jar
      build 20-Nov-2008 08:45:07 [DEBUG] /opt/bamboo/.m2/repository/javax/j2ee/1.3/j2ee-1.3.jar
      build 20-Nov-2008 08:45:07 [DEBUG] /opt/bamboo/.m2/repository/com/sun/xml/bind/jaxb-impl/2.1.3/jaxb-impl-2.1.3.jar
      build 20-Nov-2008 08:45:07 [DEBUG] /opt/bamboo/.m2/repository/javax/xml/bind/jaxb-api/2.1/jaxb-api-2.1.jar
      build 20-Nov-2008 08:45:07 [DEBUG] /opt/bamboo/.m2/repository/javax/xml/stream/stax-api/1.0-2/stax-api-1.0-2.jar
      build 20-Nov-2008 08:45:07 [DEBUG] /opt/bamboo/.m2/repository/javax/activation/activation/1.1/activation-1.1.jar
      build 20-Nov-2008 08:45:07 [DEBUG] /opt/bamboo/.m2/repository/com/i4commerce/common/common-configuration/1.0.25/common-configuration-1.0.25.jar
      build 20-Nov-2008 08:45:07 [DEBUG] /opt/bamboo/.m2/repository/opensymphony/oscache/2.1.1/oscache-2.1.1.jar
      build 20-Nov-2008 08:45:07 [DEBUG] /opt/bamboo/.m2/repository/com/i4commerce/bml/bml-core/8.20.0-SNAPSHOT/bml-core-8.20.0-SNAPSHOT.jar
      build 20-Nov-2008 08:45:07 [DEBUG] /opt/bamboo/.m2/repository/com/i4commerce/bml/cache/8.20.0-SNAPSHOT/cache-8.20.0-SNAPSHOT.jar
      build 20-Nov-2008 08:45:07 [DEBUG] /opt/bamboo/.m2/repository/com/i4commerce/common/common-spring-util/1.0.25/common-spring-util-1.0.25.jar
      build 20-Nov-2008 08:45:07 [DEBUG] /opt/bamboo/.m2/repository/esper/esper/2.2.0/esper-2.2.0.jar
      build 20-Nov-2008 08:45:07 [DEBUG] /opt/bamboo/.m2/repository/org/antlr/antlr-runtime/3.0.1/antlr-runtime-3.0.1.jar
      build 20-Nov-2008 08:45:07 [DEBUG] /opt/bamboo/.m2/repository/org/antlr/stringtemplate/3.1-b1/stringtemplate-3.1-b1.jar
      build 20-Nov-2008 08:45:07 [DEBUG] /opt/bamboo/.m2/repository/quartz/quartz/1.5.2/quartz-1.5.2.jar
      build 20-Nov-2008 08:45:07 [DEBUG] /opt/bamboo/.m2/repository/junit/junit/3.8.1/junit-3.8.1.jar
      build 20-Nov-2008 08:45:07 [DEBUG] /opt/bamboo/.m2/repository/com/mockrunner/mockrunner/0.3.1/mockrunner-0.3.1.jar
      build 20-Nov-2008 08:45:07 [DEBUG] /opt/bamboo/.m2/repository/com/i4commerce/common/common-abstract-unit-tests/1.0.25/common-abstract-unit-tests-1.0.25-tests.jar
      build 20-Nov-2008 08:45:07 [DEBUG] /opt/bamboo/.m2/repository/com/i4commerce/bml/unittest/8.20.0-SNAPSHOT/unittest-8.20.0-SNAPSHOT.jar
      build 20-Nov-2008 08:45:07 [DEBUG] /opt/bamboo/Bamboo/xml-data/build-dir/MONITORING-NIGHTLY/monitoring-server/server-data-access/target/server-data-access-1.0.2-SNAPSHOT-tests.jar
      build 20-Nov-2008 08:45:07 [DEBUG] /opt/bamboo/.m2/repository/com/oracle/oracle_jdbc/10.2.0.2.0/oracle_jdbc-10.2.0.2.0.jar

        1. clovertest.tar.gz
          3 kB
        2. clovertest-mvn.log.gz
          50 kB
        3. maven-build-2.1.1.pom
          17 kB
        4. monitoring.pom
          9 kB
        5. MONITORING-NIGHTLY-18.log.zip
          1.22 MB
        6. monitoring-server.pom
          1.0 kB
        7. server-data-access.pom
          3 kB
        8. server-web.pom
          16 kB

            [CLOV-379] Surefire classpath is incorrect when depending on a jar and a test-jar from the same maven module

            Michael Andreacchio made changes -
            Resolution New: Won't Fix [ 2 ]
            Status Original: Open [ 1 ] New: Closed [ 6 ]
            Marek Parfianowicz made changes -
            Assignee Original: Marek Parfianowicz [ mparfianowicz ]
            Marek Parfianowicz made changes -
            Fix Version/s New: 4.2.0 [ 56395 ]
            Fix Version/s Original: 5.1.0 [ 29104 ]
            jonah (Inactive) made changes -
            Symptom Severity New: Major [ 14431 ]
            Owen made changes -
            Workflow Original: New Clover Workflow [ 898090 ] New: New Clover Workflow - Restricted [ 1474555 ]
            Piotr Swiecicki made changes -
            Workflow Original: Clover Workflow [ 896581 ] New: New Clover Workflow [ 898090 ]
            Piotr Swiecicki made changes -
            Workflow Original: reviewflow [ 148265 ] New: Clover Workflow [ 896581 ]
            Marek Parfianowicz made changes -
            Rank New: Ranked higher
            Marek Parfianowicz made changes -
            Fix Version/s New: 3.2.3 [ 29104 ]
            Fix Version/s Original: 3.1.11 [ 29693 ]
            Marek Parfianowicz made changes -
            Rank New: Ranked lower

              Unassigned Unassigned
              97ee5f961203 Sigurd Knippenberg
              Affected customers:
              0 This affects my team
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved: