Details

    • Complexity:
      Intermediate
    • Number of attachments :
      0

      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,

        Activity

        Hide
        Ceki Gulcu added a comment -
        Show
        Ceki Gulcu added a comment - The article is of course located at: http://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html
        Hide
        Jörg Schaible added a comment -

        Runtime dependencies are not available compiling the code. This can be used to avoid unwanted deps e.g. have only deps to javax.xml.* but ensure not to have some on com.sun.xml.*.

        Show
        Jörg Schaible added a comment - Runtime dependencies are not available compiling the code. This can be used to avoid unwanted deps e.g. have only deps to javax.xml.* but ensure not to have some on com.sun.xml.*.
        Hide
        Ceki Gulcu added a comment -

        Instead of the desription quoted above, I would suggest the following wording:

        Each of the scopes affects transitive dependencies in different ways, as is demonstrated in the table below. If D is a direct dependency of your project P, and I is a dependency of D (and indirectly of P), and if D is set to scopes across in the left column, and I is set to scopes across the top row, then the resulting scope for I in P is shown at the intersection.

        Show
        Ceki Gulcu added a comment - Instead of the desription quoted above, I would suggest the following wording: Each of the scopes affects transitive dependencies in different ways, as is demonstrated in the table below. If D is a direct dependency of your project P, and I is a dependency of D (and indirectly of P), and if D is set to scopes across in the left column, and I is set to scopes across the top row, then the resulting scope for I in P is shown at the intersection.
        Hide
        Jason van Zyl added a comment -

        All these issues have been sitting around for years. If someone wants to actually follow up with them they can reopen.

        Show
        Jason van Zyl added a comment - All these issues have been sitting around for years. If someone wants to actually follow up with them they can reopen.

          People

          • Assignee:
            Unassigned
            Reporter:
            Ceki Gulcu
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: