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

Combine dependency scopes instead of overriding

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Open
    • Minor
    • Resolution: Unresolved
    • 3.9.6
    • None
    • Dependencies
    • None

    Description

      I discovered this situation when combining these dependencies:

      <dependency>
        <groupId>org.hibernate.orm</groupId>
        <artifactId>hibernate-core</artifactId>
        <version>6.4.1.Final</version>
        <scope>compile</scope>
      </dependency>
      <dependency>
        <groupId>io.github.openfeign.querydsl</groupId>
        <artifactId>querydsl-apt</artifactId>
        <classifier>jpa</classifier>
        <version>6.0.2</version>
        <scope>provided</scope>
      </dependency>
      

      This results in two copies of a transient dependency on jakarta.inject:jakarta.inject-api, one with runtime scope and one with provided scope. In my case, Maven resolves this to a single dependency at runtime scope, which causes the build to fail.

      Instead, the two scopes should logically combine into the compile scope. While this can be manually achieved with <dependencyManagement>, it would be nice if Maven did this automatically.

      Attachments

        Activity

          People

            Unassigned Unassigned
            jameshowe James Howe
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated: