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

Dependency scopes

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Incomplete
    • 2.0.4
    • None
    • None

    Description

      After reading the article "Introduction to the Dependency Mechanism" [1], several questions remained unclear which may warrant a revisit by its authors.

      The said article mentions the notion of "runtime classpath." While I can see what compile and test classpaths mean, I fail to understand
      what a runtime classpath is, in particular how it differs from the test classpath.

      Moreover, the article defines "provided scope" as follows:

      provided - this is much like compile, but indicates you expect the JDK
      or a container to provide it. It is only available on the compilation
      classpath, and is not transitive.

      However, in a small project I've created to test dependency scopes, it seems that a dependency declared with the "provided" scope is available when compiling the source, compiling the test cases as well as when running them (the test cases). Thus, it looks like the provided scope is the same as the compile scope, except that the provided scope is not transitive.

      The difference between the runtime and test scopes is also not very clear. Talking to colleagues and reading the Maven mailing lists, it seems that different people have different interpretations, which do not translate in technical terms.

      Moreover, the small table which illustrates the effects of scopes on transitivity is not easy to grok. In particular, the explanation (quoted below) preceding the table does not define the direction of any of the dependencies.

      <quote>
      Each of the scopes affects transitive dependencies in different ways, as is demonstrated in the table below. If a dependency is set to the scope in the left column, dependencies with the scope across the top row will result in a dependency in the main project with the scope listed at the intersection. If no scope is listed, it means the dependency will be omitted.
      </quote>

      Thank you in advance for looking into the matter,

      Attachments

        Activity

          People

            Unassigned Unassigned
            gulcu Ceki Gulcu
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: