Uploaded image for project: 'Maven Project Info Reports Plugin'
  1. Maven Project Info Reports Plugin
  2. MPIR-193

Compile scoped dependencies replaced by test

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Not A Problem
    • 2.2
    • None
    • None
    • None
    • Windows XP SP2

    Description

      Maven doesn't consider scopes correctly when applying the "nearest definition" rule on competing dependency definitions.

      We experienced an issue where a transitive compile time dependency on antlr was clobbered to test scope since a test framework artifact (at test scope) had also declared a dependency on antlr.

      <dependencies>
      <dependency>
      <!-- some dependency that transitively pulls in antlr 3 levels deep -->
      <scope>compile</scope>
      </dependency>

      <dependency>
      <!-- some test framework dependency that transitively pulls in antlr 2 levels deep -->
      <scope>test</scope>
      </dependency>
      </dependencies>

      Since the test framework pulls in antlr at a shallower depth, it takes priority, but also clobbers antlr's scope to 'test'. Thus, the first declared library will now fail to function correctly at runtime since the required antlr jar hasn't been packaged.

      Since the module is unaware whether it needs antlr at all, it doesn't make sense for it to declare it directly as a dependency or even in a dependency management section.

      If a module requires an artifact at compile time at any depth, the scope should default to 'compile', and not be replaced by 'test' by competing dependency definitions.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              siamraf Siam Rafiee
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: