Uploaded image for project: 'Maven Enforcer Plugin'
  1. Maven Enforcer Plugin
  2. MENFORCER-378

requireReleaseDeps does not support optional dependencies or runtime scope

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 3.0.0-M3
    • None
    • Standard Rules
    • None
    • Windows
    • Important

    Description

      With using the <requireReleaseDeps> the enforcer throws a RuntimeException due to the following error:

      Caused by: org.apache.maven.shared.dependency.graph.DependencyGraphBuilderException: Could not resolve following dependencies: [nl.myshared.datafiles:runtime_data:selector:0.0.1-SNAPSHOT (runtime?)]
          at org.apache.maven.shared.dependency.graph.internal.Maven31DependencyGraphBuilder.resolveDependencies (Maven31DependencyGraphBuilder.java:133)
          at org.apache.maven.shared.dependency.graph.internal.Maven31DependencyGraphBuilder.buildDependencyGraph (Maven31DependencyGraphBuilder.java:113)
          at org.apache.maven.shared.dependency.graph.internal.DefaultDependencyGraphBuilder.buildDependencyGraph (DefaultDependencyGraphBuilder.java:91)
          at org.apache.maven.shared.dependency.graph.internal.DefaultDependencyGraphBuilder.buildDependencyGraph (DefaultDependencyGraphBuilder.java:66)
          at org.apache.maven.plugins.enforcer.AbstractBanDependencies.getDependenciesToCheck (AbstractBanDependencies.java:122)
          at org.apache.maven.plugins.enforcer.AbstractBanDependencies.execute (AbstractBanDependencies.java:86)
          at org.apache.maven.plugins.enforcer.RequireReleaseDeps.execute (RequireReleaseDeps.java:105)
          at org.apache.maven.plugins.enforcer.EnforceMojo.execute (EnforceMojo.java:205)

      This file is an optional dependency and the POM is sometimes not available. I have given the optional parameter in the POM

      		<dependency>
      			<groupId>nl.myshared.datafiles</groupId>
      			<artifactId>runtime_data</artifactId>
      			<version>${project.version}</version>
      			<type>selector</type>
      			<scope>runtime</scope>
      			<optional>true</optional>
      		</dependency>
      

      I report this as a bug, since the <optional> parameter is long supported in maven.

      In my opinion "AbstractBanDependencies.getDependenciesToCheck" line 139 should have a 'if present and if optional' check. If so, no RuntimeException should be thrown. I'll leave it to you if <scope>runtime should also be excused from the RuntimeException.

      I have no other option (no workaround) than to skip the Enforcer for this project.

      Attachments

        1. test.zip
          3 kB
          Casper Roubos

        Activity

          People

            Unassigned Unassigned
            Casper_NL Casper Roubos
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated: