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

Support "include" scope

    XMLWordPrintableJSON

Details

    Description

      I'd like to request an improvement over the current pom import support.

      The current import support only goes so far as adding dependencies to the dependencyManagement section of a pom. The importing pom still is left to add those dependencies to its own dependencies, which is inconvenient, especially for imported poms that define many dependencies.

      Instead, I propose the addition of a new scope called "include" that can be used to add the imported pom's <dependencies> section to the importing pom's <dependencies> section.

      A pom that wants to "include" another pom, then, would simply declare the dependency on the included pom's groupId:artifactId:version, but use a scope of "include", which would imply type "pom". The important thing to realize is that this could be done in the <dependencies> section of the including pom (not necessarily <dependencyManagement><dependencies>). For example, in the including pom's dependencies (at XPath "project/dependencies", not "project/dependencyManagement/dependencies"):

      <dependency>
      <groupId>me.matthewadams</groupId>
      <artifactId>datanucleus-rdbms</artifactId>
      <scope>include</scope> <Unable to render embedded object: File (-- NEW) not found. different from "import"! -->
      <version>3.1.4</version>
      </dependency>

      The scope "include" implies "<type>pom</type>"; declaring it explicitly would be ok, but declaring any other <type> would be an error.

      See the two poms attached to this request for a more thorough example.

      Also, see user list discussion at http://maven.40175.n5.nabble.com/New-Maven-idea-include-import-tp5745916.html

      Attachments

        1. including-pom.xml
          0.9 kB
          Matthew T. Adams
        2. included-pom.xml
          7 kB
          Matthew T. Adams

        Activity

          People

            Unassigned Unassigned
            matthewadams Matthew T. Adams
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: