Maven
  1. Maven
  2. MNG-2045

Maven can't compile against sibling test-jar dependency in multiproject (Test Attached)

    Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.0.2
    • Fix Version/s: 2.0.8
    • Component/s: None
    • Labels:
      None
    • Environment:
      WinXP
    • Complexity:
      Intermediate
    • Testcase included:
      yes
    • Number of attachments :
      6

      Description

      I have 2 projects under a parent like so:

      --Parent
      — sample-jar
      — sample-jar-user

      sample-jar builds and installs a test-jar along with the normal jar. sample-jar-user depends on the test-jar at compile time. When I build from the parent folder, the build fails because it can't find the class. When I go to sample-jar-user and build, it works fine.

      In the attached test case, to reproduce:
      from the root folder, run mvn clean install - See it fail.
      cd sample-jar-user; mvn clean install - see it succeed.

      I remember reading somewhere that in multiprojects, maven attempts to locate the sibling classes in the source tree instead of using the jars from the repository. I'm guessing the problem is here that it's not looking in ../sample-jar/target/test-classes for this code, but really one should expect this to come from the repository.

      1. it1021.tar.gz
        1 kB
        Carlos Sanchez
      2. MNG-2045-maven-project-r577340.patch1
        0.8 kB
        Paul Gier
      3. MNG-2045-maven-project-r577340.patch2
        1 kB
        Paul Gier

        Issue Links

          Activity

          Hide
          Benjamin Bentmann added a comment -

          The issue that was originally reported here, i.e. a bad compile class path when depending on a test JAR and running the install phase of a reactor build, was fixed in 2.0.8. Other issues like only running the test phase (MNG-3043) or the proper way to declare a test JAR dependency (MNG-4056) are addressed by the referenced JIRA tickets.

          Show
          Benjamin Bentmann added a comment - The issue that was originally reported here, i.e. a bad compile class path when depending on a test JAR and running the install phase of a reactor build, was fixed in 2.0.8. Other issues like only running the test phase ( MNG-3043 ) or the proper way to declare a test JAR dependency ( MNG-4056 ) are addressed by the referenced JIRA tickets.
          Hide
          Obi Ezechukwu added a comment -

          I have attemted Joerg's suggestion, and I am afraid that I am experiencing the same problem with maven 2.1.0. So it does not appear that this issue has been fixed for multi-module projects.

          Show
          Obi Ezechukwu added a comment - I have attemted Joerg's suggestion, and I am afraid that I am experiencing the same problem with maven 2.1.0. So it does not appear that this issue has been fixed for multi-module projects.
          Hide
          Archimedes Trajano added a comment -

          Problem occurs on 3.0.3 as well

          Show
          Archimedes Trajano added a comment - Problem occurs on 3.0.3 as well
          Hide
          Michael Osipov added a comment -

          Bang, just hit this one with Maven 3.0.5. All plugins are up-to-date. I ran my project with release args -X. The last test compile is missing *all* transitive dependencies. File attached.

          See line 24627. It looks like this:

              [DEBUG] Classpath: [D:\workspace\dircontextsource\target\checkout\target\test-classes
               D:\workspace\dircontextsource\target\checkout\target\classes
               E:\no-backup\mvn-repository\org\apache\commons\commons-lang3\3.1\commons-lang3-3.1.jar
               E:\no-backup\mvn-repository\junit\junit\4.10\junit-4.10.jar
               E:\no-backup\mvn-repository\org\apache\directory\server\apacheds-core-integ\1.5.7\apacheds-core-integ-1.5.7.jar
               E:\no-backup\mvn-repository\org\slf4j\slf4j-api\1.6.6\slf4j-api-1.6.6.jar
               E:\no-backup\mvn-repository\org\slf4j\slf4j-simple\1.6.6\slf4j-simple-1.6.6.jar
               E:\no-backup\mvn-repository\org\apache\tomcat\catalina\6.0.35\catalina-6.0.35.jar
               E:\no-backup\mvn-repository\org\apache\tomcat\juli\6.0.35\juli-6.0.35.jar
               E:\no-backup\mvn-repository\org\apache\tomcat\coyote\6.0.35\coyote-6.0.35.jar
               E:\no-backup\mvn-repository\org\apache\tomcat\jasper\6.0.35\jasper-6.0.35.jar
               E:\no-backup\mvn-repository\commons-io\commons-io\2.1\commons-io-2.1.jar]
          

          If you search for other testCompiles you'll see this

              [DEBUG] Classpath: [D:\workspace\dircontextsource\target\checkout\target\test-classes
               D:\workspace\dircontextsource\target\checkout\target\classes
               E:\no-backup\mvn-repository\org\apache\commons\commons-lang3\3.1\commons-lang3-3.1.jar
               E:\no-backup\mvn-repository\junit\junit\4.10\junit-4.10.jar
               E:\no-backup\mvn-repository\org\hamcrest\hamcrest-core\1.1\hamcrest-core-1.1.jar
               E:\no-backup\mvn-repository\org\apache\directory\server\apacheds-core-integ\1.5.7\apacheds-core-integ-1.5.7.jar
               E:\no-backup\mvn-repository\org\apache\directory\server\apacheds-i18n\1.5.7\apacheds-i18n-1.5.7.jar
               E:\no-backup\mvn-repository\org\apache\directory\server\apacheds-test-framework\1.5.7\apacheds-test-framework-1.5.7.jar
               E:\no-backup\mvn-repository\org\apache\directory\server\apacheds-server-annotations\1.5.7\apacheds-server-annotations-1.5.7.jar
               E:\no-backup\mvn-repository\org\apache\directory\server\apacheds-core-annotations\1.5.7\apacheds-core-annotations-1.5.7.jar
               E:\no-backup\mvn-repository\org\apache\directory\server\apacheds-core-jndi\1.5.7\apacheds-core-jndi-1.5.7.jar
               E:\no-backup\mvn-repository\org\apache\directory\server\apacheds-core\1.5.7\apacheds-core-1.5.7.jar
               E:\no-backup\mvn-repository\org\apache\directory\server\apacheds-core-api\1.5.7\apacheds-core-api-1.5.7.jar
               E:\no-backup\mvn-repository\org\apache\directory\server\apacheds-core-constants\1.5.7\apacheds-core-constants-1.5.7.jar
               E:\no-backup\mvn-repository\org\apache\directory\server\apacheds-utils\1.5.7\apacheds-utils-1.5.7.jar
               E:\no-backup\mvn-repository\bouncycastle\bcprov-jdk15\140\bcprov-jdk15-140.jar
               E:\no-backup\mvn-repository\org\apache\directory\server\apacheds-jdbm-partition\1.5.7\apacheds-jdbm-partition-1.5.7.jar
               E:\no-backup\mvn-repository\org\apache\directory\server\apacheds-jdbm-store\1.5.7\apacheds-jdbm-store-1.5.7.jar
               E:\no-backup\mvn-repository\org\apache\directory\server\apacheds-jdbm\1.5.7\apacheds-jdbm-1.5.7.jar
               E:\no-backup\mvn-repository\org\apache\directory\server\apacheds-core-entry\1.5.7\apacheds-core-entry-1.5.7.jar
               E:\no-backup\mvn-repository\org\apache\directory\server\apacheds-core-avl\1.5.7\apacheds-core-avl-1.5.7.jar
               E:\no-backup\mvn-repository\org\apache\directory\server\apacheds-xdbm-search\1.5.7\apacheds-xdbm-search-1.5.7.jar
               E:\no-backup\mvn-repository\org\apache\directory\server\apacheds-ldif-partition\1.5.7\apacheds-ldif-partition-1.5.7.jar
               E:\no-backup\mvn-repository\org\apache\directory\server\apacheds-avl-partition\1.5.7\apacheds-avl-partition-1.5.7.jar
               E:\no-backup\mvn-repository\org\apache\directory\server\apacheds-core-mock\1.5.7\apacheds-core-mock-1.5.7.jar
               E:\no-backup\mvn-repository\org\apache\directory\server\apacheds-protocol-ldap\1.5.7\apacheds-protocol-ldap-1.5.7.jar
               E:\no-backup\mvn-repository\org\apache\directory\server\apacheds-kerberos-shared\1.5.7\apacheds-kerberos-shared-1.5.7.jar
               E:\no-backup\mvn-repository\org\apache\directory\server\apacheds-protocol-shared\1.5.7\apacheds-protocol-shared-1.5.7.jar
               E:\no-backup\mvn-repository\org\apache\directory\server\apacheds-xdbm-tools\1.5.7\apacheds-xdbm-tools-1.5.7.jar
               E:\no-backup\mvn-repository\org\apache\directory\server\apacheds-xdbm-base\1.5.7\apacheds-xdbm-base-1.5.7.jar
               E:\no-backup\mvn-repository\org\apache\directory\server\apacheds-protocol-kerberos\1.5.7\apacheds-protocol-kerberos-1.5.7.jar
               E:\no-backup\mvn-repository\org\apache\directory\client\ldap\ldap-client-api\0.1\ldap-client-api-0.1.jar
               E:\no-backup\mvn-repository\commons-pool\commons-pool\1.5.4\commons-pool-1.5.4.jar
               E:\no-backup\mvn-repository\org\apache\mina\mina-core\2.0.0-RC1\mina-core-2.0.0-RC1.jar
               E:\no-backup\mvn-repository\org\apache\directory\shared\shared-ldap\0.9.19\shared-ldap-0.9.19.jar
               E:\no-backup\mvn-repository\commons-lang\commons-lang\2.4\commons-lang-2.4.jar
               E:\no-backup\mvn-repository\commons-collections\commons-collections\3.2.1\commons-collections-3.2.1.jar
               E:\no-backup\mvn-repository\org\apache\directory\shared\shared-i18n\0.9.19\shared-i18n-0.9.19.jar
               E:\no-backup\mvn-repository\antlr\antlr\2.7.7\antlr-2.7.7.jar
               E:\no-backup\mvn-repository\org\apache\directory\shared\shared-ldap-schema\0.9.19\shared-ldap-schema-0.9.19.jar
               E:\no-backup\mvn-repository\org\apache\directory\shared\shared-ldap-schema-loader\0.9.19\shared-ldap-schema-loader-0.9.19.jar
               E:\no-backup\mvn-repository\org\apache\directory\shared\shared-ldap-schema-manager\0.9.19\shared-ldap-schema-manager-0.9.19.jar
               E:\no-backup\mvn-repository\org\apache\directory\shared\shared-cursor\0.9.19\shared-cursor-0.9.19.jar
               E:\no-backup\mvn-repository\org\apache\directory\shared\shared-ldap-jndi\0.9.19\shared-ldap-jndi-0.9.19.jar
               E:\no-backup\mvn-repository\org\apache\directory\shared\shared-asn1-codec\0.9.19\shared-asn1-codec-0.9.19.jar
               E:\no-backup\mvn-repository\org\apache\directory\shared\shared-asn1\0.9.19\shared-asn1-0.9.19.jar
               E:\no-backup\mvn-repository\org\apache\directory\shared\shared-ldap-constants\0.9.19\shared-ldap-constants-0.9.19.jar
               E:\no-backup\mvn-repository\org\apache\directory\shared\shared-ldap-converter\0.9.19\shared-ldap-converter-0.9.19.jar
               E:\no-backup\mvn-repository\org\apache\directory\shared\shared-ldap-schema-dao\0.9.19\shared-ldap-schema-dao-0.9.19.jar
               E:\no-backup\mvn-repository\org\apache\directory\shared\shared-ldif\0.9.19\shared-ldif-0.9.19.jar
               E:\no-backup\mvn-repository\org\apache\directory\shared\shared-dsml-parser\0.9.19\shared-dsml-parser-0.9.19.jar
               E:\no-backup\mvn-repository\dom4j\dom4j\1.6.1\dom4j-1.6.1.jar
               E:\no-backup\mvn-repository\xml-apis\xml-apis\1.0.b2\xml-apis-1.0.b2.jar
               E:\no-backup\mvn-repository\xpp3\xpp3\1.1.4c\xpp3-1.1.4c.jar
               E:\no-backup\mvn-repository\org\slf4j\slf4j-api\1.6.6\slf4j-api-1.6.6.jar
               E:\no-backup\mvn-repository\org\slf4j\slf4j-simple\1.6.6\slf4j-simple-1.6.6.jar
               E:\no-backup\mvn-repository\org\apache\tomcat\catalina\6.0.35\catalina-6.0.35.jar
               E:\no-backup\mvn-repository\org\apache\tomcat\servlet-api\6.0.35\servlet-api-6.0.35.jar
               E:\no-backup\mvn-repository\org\apache\tomcat\annotations-api\6.0.35\annotations-api-6.0.35.jar
               E:\no-backup\mvn-repository\org\apache\tomcat\juli\6.0.35\juli-6.0.35.jar
               E:\no-backup\mvn-repository\org\apache\tomcat\coyote\6.0.35\coyote-6.0.35.jar
               E:\no-backup\mvn-repository\org\apache\tomcat\jasper\6.0.35\jasper-6.0.35.jar
               E:\no-backup\mvn-repository\org\apache\tomcat\jsp-api\6.0.35\jsp-api-6.0.35.jar
               E:\no-backup\mvn-repository\org\apache\tomcat\el-api\6.0.35\el-api-6.0.35.jar
               E:\no-backup\mvn-repository\org\eclipse\jdt\core\compiler\ecj\3.7\ecj-3.7.jar
               E:\no-backup\mvn-repository\org\apache\tomcat\jasper-el\6.0.35\jasper-el-6.0.35.jar
               E:\no-backup\mvn-repository\commons-io\commons-io\2.1\commons-io-2.1.jar]
          

          Someone is setting an incorrect ArtifactFilter.

          Show
          Michael Osipov added a comment - Bang, just hit this one with Maven 3.0.5. All plugins are up-to-date. I ran my project with release args -X . The last test compile is missing * all * transitive dependencies. File attached. See line 24627. It looks like this: [DEBUG] Classpath: [D:\workspace\dircontextsource\target\checkout\target\test-classes D:\workspace\dircontextsource\target\checkout\target\classes E:\no-backup\mvn-repository\org\apache\commons\commons-lang3\3.1\commons-lang3-3.1.jar E:\no-backup\mvn-repository\junit\junit\4.10\junit-4.10.jar E:\no-backup\mvn-repository\org\apache\directory\server\apacheds-core-integ\1.5.7\apacheds-core-integ-1.5.7.jar E:\no-backup\mvn-repository\org\slf4j\slf4j-api\1.6.6\slf4j-api-1.6.6.jar E:\no-backup\mvn-repository\org\slf4j\slf4j-simple\1.6.6\slf4j-simple-1.6.6.jar E:\no-backup\mvn-repository\org\apache\tomcat\catalina\6.0.35\catalina-6.0.35.jar E:\no-backup\mvn-repository\org\apache\tomcat\juli\6.0.35\juli-6.0.35.jar E:\no-backup\mvn-repository\org\apache\tomcat\coyote\6.0.35\coyote-6.0.35.jar E:\no-backup\mvn-repository\org\apache\tomcat\jasper\6.0.35\jasper-6.0.35.jar E:\no-backup\mvn-repository\commons-io\commons-io\2.1\commons-io-2.1.jar] If you search for other testCompiles you'll see this [DEBUG] Classpath: [D:\workspace\dircontextsource\target\checkout\target\test-classes D:\workspace\dircontextsource\target\checkout\target\classes E:\no-backup\mvn-repository\org\apache\commons\commons-lang3\3.1\commons-lang3-3.1.jar E:\no-backup\mvn-repository\junit\junit\4.10\junit-4.10.jar E:\no-backup\mvn-repository\org\hamcrest\hamcrest-core\1.1\hamcrest-core-1.1.jar E:\no-backup\mvn-repository\org\apache\directory\server\apacheds-core-integ\1.5.7\apacheds-core-integ-1.5.7.jar E:\no-backup\mvn-repository\org\apache\directory\server\apacheds-i18n\1.5.7\apacheds-i18n-1.5.7.jar E:\no-backup\mvn-repository\org\apache\directory\server\apacheds-test-framework\1.5.7\apacheds-test-framework-1.5.7.jar E:\no-backup\mvn-repository\org\apache\directory\server\apacheds-server-annotations\1.5.7\apacheds-server-annotations-1.5.7.jar E:\no-backup\mvn-repository\org\apache\directory\server\apacheds-core-annotations\1.5.7\apacheds-core-annotations-1.5.7.jar E:\no-backup\mvn-repository\org\apache\directory\server\apacheds-core-jndi\1.5.7\apacheds-core-jndi-1.5.7.jar E:\no-backup\mvn-repository\org\apache\directory\server\apacheds-core\1.5.7\apacheds-core-1.5.7.jar E:\no-backup\mvn-repository\org\apache\directory\server\apacheds-core-api\1.5.7\apacheds-core-api-1.5.7.jar E:\no-backup\mvn-repository\org\apache\directory\server\apacheds-core-constants\1.5.7\apacheds-core-constants-1.5.7.jar E:\no-backup\mvn-repository\org\apache\directory\server\apacheds-utils\1.5.7\apacheds-utils-1.5.7.jar E:\no-backup\mvn-repository\bouncycastle\bcprov-jdk15\140\bcprov-jdk15-140.jar E:\no-backup\mvn-repository\org\apache\directory\server\apacheds-jdbm-partition\1.5.7\apacheds-jdbm-partition-1.5.7.jar E:\no-backup\mvn-repository\org\apache\directory\server\apacheds-jdbm-store\1.5.7\apacheds-jdbm-store-1.5.7.jar E:\no-backup\mvn-repository\org\apache\directory\server\apacheds-jdbm\1.5.7\apacheds-jdbm-1.5.7.jar E:\no-backup\mvn-repository\org\apache\directory\server\apacheds-core-entry\1.5.7\apacheds-core-entry-1.5.7.jar E:\no-backup\mvn-repository\org\apache\directory\server\apacheds-core-avl\1.5.7\apacheds-core-avl-1.5.7.jar E:\no-backup\mvn-repository\org\apache\directory\server\apacheds-xdbm-search\1.5.7\apacheds-xdbm-search-1.5.7.jar E:\no-backup\mvn-repository\org\apache\directory\server\apacheds-ldif-partition\1.5.7\apacheds-ldif-partition-1.5.7.jar E:\no-backup\mvn-repository\org\apache\directory\server\apacheds-avl-partition\1.5.7\apacheds-avl-partition-1.5.7.jar E:\no-backup\mvn-repository\org\apache\directory\server\apacheds-core-mock\1.5.7\apacheds-core-mock-1.5.7.jar E:\no-backup\mvn-repository\org\apache\directory\server\apacheds-protocol-ldap\1.5.7\apacheds-protocol-ldap-1.5.7.jar E:\no-backup\mvn-repository\org\apache\directory\server\apacheds-kerberos-shared\1.5.7\apacheds-kerberos-shared-1.5.7.jar E:\no-backup\mvn-repository\org\apache\directory\server\apacheds-protocol-shared\1.5.7\apacheds-protocol-shared-1.5.7.jar E:\no-backup\mvn-repository\org\apache\directory\server\apacheds-xdbm-tools\1.5.7\apacheds-xdbm-tools-1.5.7.jar E:\no-backup\mvn-repository\org\apache\directory\server\apacheds-xdbm-base\1.5.7\apacheds-xdbm-base-1.5.7.jar E:\no-backup\mvn-repository\org\apache\directory\server\apacheds-protocol-kerberos\1.5.7\apacheds-protocol-kerberos-1.5.7.jar E:\no-backup\mvn-repository\org\apache\directory\client\ldap\ldap-client-api\0.1\ldap-client-api-0.1.jar E:\no-backup\mvn-repository\commons-pool\commons-pool\1.5.4\commons-pool-1.5.4.jar E:\no-backup\mvn-repository\org\apache\mina\mina-core\2.0.0-RC1\mina-core-2.0.0-RC1.jar E:\no-backup\mvn-repository\org\apache\directory\shared\shared-ldap\0.9.19\shared-ldap-0.9.19.jar E:\no-backup\mvn-repository\commons-lang\commons-lang\2.4\commons-lang-2.4.jar E:\no-backup\mvn-repository\commons-collections\commons-collections\3.2.1\commons-collections-3.2.1.jar E:\no-backup\mvn-repository\org\apache\directory\shared\shared-i18n\0.9.19\shared-i18n-0.9.19.jar E:\no-backup\mvn-repository\antlr\antlr\2.7.7\antlr-2.7.7.jar E:\no-backup\mvn-repository\org\apache\directory\shared\shared-ldap-schema\0.9.19\shared-ldap-schema-0.9.19.jar E:\no-backup\mvn-repository\org\apache\directory\shared\shared-ldap-schema-loader\0.9.19\shared-ldap-schema-loader-0.9.19.jar E:\no-backup\mvn-repository\org\apache\directory\shared\shared-ldap-schema-manager\0.9.19\shared-ldap-schema-manager-0.9.19.jar E:\no-backup\mvn-repository\org\apache\directory\shared\shared-cursor\0.9.19\shared-cursor-0.9.19.jar E:\no-backup\mvn-repository\org\apache\directory\shared\shared-ldap-jndi\0.9.19\shared-ldap-jndi-0.9.19.jar E:\no-backup\mvn-repository\org\apache\directory\shared\shared-asn1-codec\0.9.19\shared-asn1-codec-0.9.19.jar E:\no-backup\mvn-repository\org\apache\directory\shared\shared-asn1\0.9.19\shared-asn1-0.9.19.jar E:\no-backup\mvn-repository\org\apache\directory\shared\shared-ldap-constants\0.9.19\shared-ldap-constants-0.9.19.jar E:\no-backup\mvn-repository\org\apache\directory\shared\shared-ldap-converter\0.9.19\shared-ldap-converter-0.9.19.jar E:\no-backup\mvn-repository\org\apache\directory\shared\shared-ldap-schema-dao\0.9.19\shared-ldap-schema-dao-0.9.19.jar E:\no-backup\mvn-repository\org\apache\directory\shared\shared-ldif\0.9.19\shared-ldif-0.9.19.jar E:\no-backup\mvn-repository\org\apache\directory\shared\shared-dsml-parser\0.9.19\shared-dsml-parser-0.9.19.jar E:\no-backup\mvn-repository\dom4j\dom4j\1.6.1\dom4j-1.6.1.jar E:\no-backup\mvn-repository\xml-apis\xml-apis\1.0.b2\xml-apis-1.0.b2.jar E:\no-backup\mvn-repository\xpp3\xpp3\1.1.4c\xpp3-1.1.4c.jar E:\no-backup\mvn-repository\org\slf4j\slf4j-api\1.6.6\slf4j-api-1.6.6.jar E:\no-backup\mvn-repository\org\slf4j\slf4j-simple\1.6.6\slf4j-simple-1.6.6.jar E:\no-backup\mvn-repository\org\apache\tomcat\catalina\6.0.35\catalina-6.0.35.jar E:\no-backup\mvn-repository\org\apache\tomcat\servlet-api\6.0.35\servlet-api-6.0.35.jar E:\no-backup\mvn-repository\org\apache\tomcat\annotations-api\6.0.35\annotations-api-6.0.35.jar E:\no-backup\mvn-repository\org\apache\tomcat\juli\6.0.35\juli-6.0.35.jar E:\no-backup\mvn-repository\org\apache\tomcat\coyote\6.0.35\coyote-6.0.35.jar E:\no-backup\mvn-repository\org\apache\tomcat\jasper\6.0.35\jasper-6.0.35.jar E:\no-backup\mvn-repository\org\apache\tomcat\jsp-api\6.0.35\jsp-api-6.0.35.jar E:\no-backup\mvn-repository\org\apache\tomcat\el-api\6.0.35\el-api-6.0.35.jar E:\no-backup\mvn-repository\org\eclipse\jdt\core\compiler\ecj\3.7\ecj-3.7.jar E:\no-backup\mvn-repository\org\apache\tomcat\jasper-el\6.0.35\jasper-el-6.0.35.jar E:\no-backup\mvn-repository\commons-io\commons-io\2.1\commons-io-2.1.jar] Someone is setting an incorrect ArtifactFilter .
          Hide
          Michael Osipov added a comment -

          I will have to correct my previous comment. I use the shade plugin. During perform it already uses the dependency reduced pom. All transitive dependencies for my test deps are removed. Watch out for: MSHADE-95

          Show
          Michael Osipov added a comment - I will have to correct my previous comment. I use the shade plugin. During perform it already uses the dependency reduced pom. All transitive dependencies for my test deps are removed. Watch out for: MSHADE-95

            People

            • Assignee:
              brianfox brianfox
              Reporter:
              brianfox brianfox
            • Votes:
              11 Vote for this issue
              Watchers:
              17 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: