Maven
  1. Maven
  2. MNG-3397

[RFC] change the POM to use attributes

    Details

    • Patch Submitted:
      Yes
    • Number of attachments :
      0

      Issue Links

        Activity

        Hide
        Darren Bell added a comment -

        Or maybe even this:

        <dependency id="org.apache.maven.plugins:org.apache.maven.plugins:2.16" />
        

        or

        <dependency id=":org.apache.maven.plugins:" />
        

        in a management section.

        Show
        Darren Bell added a comment - Or maybe even this: <dependency id="org.apache.maven.plugins:org.apache.maven.plugins:2.16" /> or <dependency id=":org.apache.maven.plugins:" /> in a management section.
        Hide
        Darren Bell added a comment -

        A pity this has been pushed back to 4.x. When is that due for release I wonder.

        Show
        Darren Bell added a comment - A pity this has been pushed back to 4.x. When is that due for release I wonder.
        Hide
        Karl-Heinz Marbaise added a comment -

        So an exclusions could look like this:

        <dependency groupId="junit" artifactId="junit" scope="test" version="4.11">
          <exclusions>
            <exclusion groupId="org.hamcrest" artifactId="hamcrest-core"/>
          </exclusions>
        </dependency>
        

        Or going with the idea of Id's it would look like this:

        <dependency id="org.junit:junit:test:4.11">
          <exclusions>
            <exclusion id="org.hamcrest:hamcest-core"/>
          </exclusions>
        </dependency>
        

        Furthermore some more convenience:

        <dependency id="org.junit:junit:test" exclusions="*"/>
        

        Which brings me to a more formal definition:

        <dependency id="{groupId}:{artifactId}:{version}:{classifier}:{type}:{scope}"/>
        
        Show
        Karl-Heinz Marbaise added a comment - So an exclusions could look like this: <dependency groupId= "junit" artifactId= "junit" scope= "test" version= "4.11" > <exclusions> <exclusion groupId= "org.hamcrest" artifactId= "hamcrest-core" /> </exclusions> </dependency> Or going with the idea of Id's it would look like this: <dependency id= "org.junit:junit:test:4.11" > <exclusions> <exclusion id= "org.hamcrest:hamcest-core" /> </exclusions> </dependency> Furthermore some more convenience: <dependency id= "org.junit:junit:test" exclusions= "*" /> Which brings me to a more formal definition: <dependency id= "{groupId}:{artifactId}:{version}:{classifier}:{type}:{scope}" />
        Hide
        Sergei Ivanov added a comment -

        I support the idea of a compact colon-separated dependency id, however:

        • scope does not really belong to artifact coordinates, it is an additional property of an artifact dependency. As such, IMHO it deserves a separate XML attribute.
        • some plugins are already using colon-separated coordinate notation, but the ordering of the coordinate parts is not consistent. See for example, off the top of my head:
          http://maven.apache.org/plugins/maven-remote-resources-plugin/process-mojo.html#resourceBundles
          versus includes/excludes in
          http://maven.apache.org/plugins/maven-assembly-plugin/assembly.html#class_dependencySet
          I am pretty sure I saw it being used elsewhere, but cannot remember just now. This really needs to be standardised.
        • it could be just me, but I think colon does not really stand out visually as a separator in a stream of characters, maybe we should allow for optional spaces around colons for better readability
        • if possible, we should also try to do away with container elements (e.g. exclusions) or make them optional in all non-ambiguous contexts.

        Example:

        <dependency id="org.junit : junit : 4.11" scope="test">
            <exclusion id="org.hamcrest : hamcest-core"/>
        </dependency>
        

        or

        <dependency id="org.apache.maven : maven-core : 3.2.2" scope="compile">
            <exclusion id="org.codehaus.plexus : plexus-utils"/>
            <exclusion id="org.codehaus.plexus : plexus-interpolation"/>
        </dependency>
        
        Show
        Sergei Ivanov added a comment - I support the idea of a compact colon-separated dependency id, however: scope does not really belong to artifact coordinates, it is an additional property of an artifact dependency. As such, IMHO it deserves a separate XML attribute. some plugins are already using colon-separated coordinate notation, but the ordering of the coordinate parts is not consistent. See for example, off the top of my head: http://maven.apache.org/plugins/maven-remote-resources-plugin/process-mojo.html#resourceBundles versus includes/excludes in http://maven.apache.org/plugins/maven-assembly-plugin/assembly.html#class_dependencySet I am pretty sure I saw it being used elsewhere, but cannot remember just now. This really needs to be standardised. it could be just me, but I think colon does not really stand out visually as a separator in a stream of characters, maybe we should allow for optional spaces around colons for better readability if possible, we should also try to do away with container elements (e.g. exclusions ) or make them optional in all non-ambiguous contexts. Example: <dependency id= "org.junit : junit : 4.11" scope= "test" > <exclusion id= "org.hamcrest : hamcest-core" /> </dependency> or <dependency id= "org.apache.maven : maven-core : 3.2.2" scope= "compile" > <exclusion id= "org.codehaus.plexus : plexus-utils" /> <exclusion id= "org.codehaus.plexus : plexus-interpolation" /> </dependency>
        Hide
        Will Iverson added a comment -

        Question: would this be a breaking, hard change for POMs, or a soft change, (e.g. any of the following specified as an attribute will serve as the declaration unless overridden by a child element, groupId, artifactId, version, classifier, type, scope).

        If going down the hard-change route, it would be really, really easy for IDEs (and/or Maven itself ) to support a 1-click update for existing POMs, and would avoid confusing situations with conflicting declarations in attributes and child elements. The bad news is that you'd have to wait for the IDEs and what not to support Maven 4... but hey, it's another reason to upgrade!

        The colon delimited version is popular (you can see it in use with other build tools at, for example: http://mvnrepository.com/artifact/org.mockito/mockito-all/1.10.8 ) but not standard.

        Show
        Will Iverson added a comment - Question: would this be a breaking, hard change for POMs, or a soft change, (e.g. any of the following specified as an attribute will serve as the declaration unless overridden by a child element, groupId, artifactId, version, classifier, type, scope). If going down the hard-change route, it would be really, really easy for IDEs (and/or Maven itself ) to support a 1-click update for existing POMs, and would avoid confusing situations with conflicting declarations in attributes and child elements. The bad news is that you'd have to wait for the IDEs and what not to support Maven 4... but hey, it's another reason to upgrade! The colon delimited version is popular (you can see it in use with other build tools at, for example: http://mvnrepository.com/artifact/org.mockito/mockito-all/1.10.8 ) but not standard.

          People

          • Assignee:
            Unassigned
            Reporter:
            Brett Porter
          • Votes:
            61 Vote for this issue
            Watchers:
            55 Start watching this issue

            Dates

            • Created:
              Updated: