Maven
  1. Maven
  2. MNG-4161

possibility to omit version in dependency of same project (and fill in on install/deploy)

    Details

    • Type: New Feature New Feature
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Incomplete
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: Dependencies, Deployment
    • Labels:
      None
    • Complexity:
      Intermediate
    • Number of attachments :
      0

      Description

      I want to suggest a feature discussed on dev-list:

      A <dependency> currently must have <groupId>, <artifactId> and <version>.
      If you have a complex multi-module project you typically have lots of project internal dependencies.
      Typically these dependencies point to the same version that is currently active (on disc/head).
      So for the main usecase you have the version of a module redundant (a lot!)
      causing lots of maintenance overhead, that might be covered by release-plugin
      but might be not (in my case and there are others as well).

      Following the principle "Conventions over Configuration", a coming version of maven should allow
      to omit the version of a dependency if a pom.xml is loaded for a build (NOT from repository)
      AND the reactor contains a module that has the same groupId and artifactId. In that
      case maven will behave as if the version was declared in the pom.xml with the version-value of
      the module in the reactor. In any other case maven will fail.
      The feature can be combined with MNG-2576 so that it also makes sense if just a single
      module or a sub-tree of the project is to be build.

      Additionally the ArtifactInstaller and ArtifactDeployer have to guarantee, that when the pom.xml
      is installed or deployed, that the omitted version(s) are automatically filled in.

      This feature will therefore be 100% compatible with older versions of maven and will never
      be visible in the repository. If a pom is loaded from any repository (including local repo)
      maven should NOT accept it in order to avoid accidental usage or even miss usage of this feature.
      Besides it is just an option that would NOT hurt anybody not interested in the feature.
      But for those that get crazy maintaining large projects and for some reason do NOT follow
      the philosophy of release-plugin, this feature would bring final freedom!

        Issue Links

          Activity

          Show
          Jason van Zyl added a comment - Please refer to https://cwiki.apache.org/confluence/display/MAVEN/The+Great+JIRA+Cleanup+of+2014
          Hide
          Jason van Zyl added a comment -

          Please refer to https://cwiki.apache.org/confluence/display/MAVEN/The+Great+JIRA+Cleanup+of+2014 if you're wondering why this issue was closed out.

          Show
          Jason van Zyl added a comment - Please refer to https://cwiki.apache.org/confluence/display/MAVEN/The+Great+JIRA+Cleanup+of+2014 if you're wondering why this issue was closed out.
          Hide
          Jörg Hohwiller added a comment -

          For those that still suffer with maven and version maintenance there is new hope:
          https://svn.codehaus.org/mojo/trunk/sandbox/consumer-maven-plugin
          Please note that the plugin will move out of sandbox in the future so try mojo instead of sandbox if the link stopped working:
          https://svn.codehaus.org/mojo/trunk/mojo/consumer-maven-plugin

          What you can now do is defining the versions in the dependencyManagement of your parent POM and then omit them in your child POMs. When you install or deploy your child POMs consumer-maven-plugin will resolve the versions and fill them into the consumer POM that gets installed/deployed instead of the original POM. If you like to, you can keep the parent POM version fixed and never release the parent POM as the parent is also removed from the consumer-maven-plugin in its generated POM. Therefore we have a perfect workaround for this feature request.

          Simply check-out and install this plugin. Then add this to your toplevel POMs build-section:
          <plugin>
          <groupId>org.codehaus.mojo</groupId>
          <artifactId>consumer-maven-plugin</artifactId>
          <version>1.0.0-beta-1-SNAPSHOT</version>
          </plugin>

          I hope that the plugin will move out of sandbox and be released soon.

          If you have any feedback please let us know (ideally on MOJOs dev mailing list).

          Show
          Jörg Hohwiller added a comment - For those that still suffer with maven and version maintenance there is new hope: https://svn.codehaus.org/mojo/trunk/sandbox/consumer-maven-plugin Please note that the plugin will move out of sandbox in the future so try mojo instead of sandbox if the link stopped working: https://svn.codehaus.org/mojo/trunk/mojo/consumer-maven-plugin What you can now do is defining the versions in the dependencyManagement of your parent POM and then omit them in your child POMs. When you install or deploy your child POMs consumer-maven-plugin will resolve the versions and fill them into the consumer POM that gets installed/deployed instead of the original POM. If you like to, you can keep the parent POM version fixed and never release the parent POM as the parent is also removed from the consumer-maven-plugin in its generated POM. Therefore we have a perfect workaround for this feature request. Simply check-out and install this plugin. Then add this to your toplevel POMs build-section: <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>consumer-maven-plugin</artifactId> <version>1.0.0-beta-1-SNAPSHOT</version> </plugin> I hope that the plugin will move out of sandbox and be released soon. If you have any feedback please let us know (ideally on MOJOs dev mailing list).
          Hide
          Jörg Hohwiller added a comment -

          The plugin had to be renamed:
          http://mojo.codehaus.org/flatten-maven-plugin/

          Show
          Jörg Hohwiller added a comment - The plugin had to be renamed: http://mojo.codehaus.org/flatten-maven-plugin/
          Hide
          Jörg Hohwiller added a comment -

          For the workaround have a look here:
          http://mojo.codehaus.org/flatten-maven-plugin/examples/example-multiple-versions.html

          2nd release is out in central repo. Just add this to your top-level POM build section:

          <plugin>
          <groupId>org.codehaus.mojo</groupId>
          <artifactId>flatten-maven-plugin</artifactId>
          <version>1.0.0-beta-2</version>
          </plugin>

          Show
          Jörg Hohwiller added a comment - For the workaround have a look here: http://mojo.codehaus.org/flatten-maven-plugin/examples/example-multiple-versions.html 2nd release is out in central repo. Just add this to your top-level POM build section: <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>flatten-maven-plugin</artifactId> <version>1.0.0-beta-2</version> </plugin>

            People

            • Assignee:
              Unassigned
              Reporter:
              Jörg Hohwiller
            • Votes:
              4 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: