Uploaded image for project: 'Maven'
  1. Maven
  2. MNG-4018

Maven doesn't resolve correct the dependency with classifier in the multi-part project.

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Duplicate
    • None
    • None
    • None
    • None
    • *) Fedora release 8 (Werewolf)
      *) java version "1.6.0_06"
      Java(TM) SE Runtime Environment (build 1.6.0_06-b02)
      *) Maven version: 2.0.9

    Description

      Dear Maven-Community,

      Last Thursday I have got a mistake in the build of my project. At first I was trying to check all pom-files in my project, but I couldn't find the cause or what I did wrong. Therefore I created a small project which a small copy of my project is. It seems to me, that this mistake, which I have got, is the the bug of maven.

      So, I have a multi-module project (5 parts):

      1) The "project_maven_base" - this project contains the parent pom of all my projects.
      2) The "project" - this project contains the general or abstract classes: for example 'EasyDate'
      3) The "project_test" - this project contains the classes which use classes from the project "project". Furthermore this project contains the test-classes which
      are used in other projects, for example 'DateWrapperTest'.
      4) The "project_web" - this project is a normal web-project. But it contains the test-classes which base upon the test-classes from project "project-test".
      These test-classes from the project "project-test" are included with the scope "test".

      <dependency>
      <groupId>project</groupId>
      <artifactId>project_test</artifactId>
      <version>0.0.1-SNAPSHOT</version>
      <classifier>tests</classifier>
      <scope>test</scope>
      </dependency>

      5) The "project_test_web" - this project is a normal web-project too. But this project contains the test business logic which uses the test-classes from the project "project-test" with the scope compile, for example class 'TestClient' uses the class 'DateWrapperTest'. The dependency is:

      <dependency>
      <groupId>project</groupId>
      <artifactId>project_test</artifactId>
      <version>0.0.1-SNAPSHOT</version>
      <classifier>tests</classifier>
      <scope>compile</scope>
      </dependency>

      If the build is executed from parent project, all modules could be created except for "project_test_web", see the 'creation_log.txt' - File. The dependencies couldn't be resolved for this project. The library 'project_test-0.0.1-SNAPSHOT-tests.jar' couldn't be found.

      But if I try to create the project "project_test_web" as stand-alone project, then the project build is successful, see the 'creation_log_alone' - File.

      It seems to me, that if the dependency with classifier is used in the previous project, than this dependency can be used in the next project only with the same scope.

      Thanks a lot
      Best regards

      Veniamin

      Attachments

        1. creation_log_alone.txt
          2 kB
          Paul Anderson
        2. creation_log.txt
          7 kB
          Paul Anderson
        3. workspace_project_mistake.tar.gz
          4.04 MB
          Paul Anderson

        Issue Links

          Activity

            People

              brett Brett Porter
              wanderer Paul Anderson
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: