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

Duplicate dependency with property causes the build to fail

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Won't Fix
    • Affects Version/s: 3.0.3, 3.0.4
    • Fix Version/s: None
    • Component/s: Plugins and Lifecycle
    • Labels:
    • Environment:

      Description

      The following excerpt from a pom.xml file causes just about any maven command (e.g. mvn package) to fail with the error 'dependencies.dependency.version' for junit:junit:jar is missing:

      <properties>
          <my.type>jar</my.type>
          <my.other.type>jar</my.other.type>
      </properties>
      
      <dependencyManagement>
          <dependencies>
              <dependency>
                  <groupId>junit</groupId>
                  <artifactId>junit</artifactId>
                  <version>4.10</version>
                  <type>${my.type}</type>
              </dependency>
              <dependency>
                  <artifactId>junit</artifactId>
                  <groupId>junit</groupId>
                  <version>4.10</version>
                  <type>${my.other.type}</type>
              </dependency>
          </dependencies>
      </dependencyManagement>
      
      <dependencies>
          <dependency>
              <artifactId>junit</artifactId>
              <groupId>junit</groupId>
              <type>${my.type}</type>
          </dependency>
          <dependency>
              <artifactId>junit</artifactId>
              <groupId>junit</groupId>
              <type>${my.other.type}</type>
              <optional>true</optional>
          </dependency>
      </dependencies>
      

      If the string jar is used instead of the properties, the build succeeds with warnings.

      A SSCCE is attached. Running the command mvn validate inside the my-app-folder should show the symptom.

        Attachments

        1. my-app.zip
          4 kB
          Tarje Killingberg

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              tkill Tarje Killingberg
            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: