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

Bad error message with duplicate dependencies that don't declare a version

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 3.0-alpha-3
    • 3.0-alpha-3
    • Dependencies, Errors
    • None

    Description

      Consider the attached project, which builds in Maven 2.1. The "parent" project has a dependencyManagement section that declares the version of JUnit as 3.8.1. The "child" project has duplicate dependency entries for junit; neither one declares a version.

      Maven 3 generates a very misleading error message; it took a long time for me to figure out the real cause of the problem.

      c:\Temp\scratch\parent>mvn clean
      [INFO] Scanning for projects...
      [ERROR] The build could not read 1 project -> [Help 1]
      [ERROR]   The project bug:child:1.0-SNAPSHOT (C:\Temp\scratch\parent\child\pom.xml) has 2 errors
      [ERROR]     'dependencies.dependency.(groupId:artifactId:type:classifier)' must be unique: junit:junit:jar -> null vs null
      [ERROR]     'dependencies.dependency.version' is missing for junit:junit:jar
      [ERROR]
      [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
      [ERROR] Re-run Maven using the -X switch to enable full debug logging.
      [ERROR]
      [ERROR] For more information about the errors and possible solutions, please read the following articles:
      [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/ProjectBuildingException
      

      I expected an error more like:

      'dependencies.dependency.(groupId:artifactId:type:classifier)' must be unique: junit:junit:jar -> duplicate declaration of 3.8.1
      

      That would have been MUCH more helpful.

      Attachments

        1. bug.zip
          3 kB
          Daniel Fabulich

        Activity

          People

            bentmann Benjamin Bentmann
            dfabulich Daniel Fabulich
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: