Casper Roubos created MENFORCER-378:
---------------------------------------

             Summary: requireReleaseDeps does not support optional dependencies 
or runtime scope
                 Key: MENFORCER-378
                 URL: https://issues.apache.org/jira/browse/MENFORCER-378
             Project: Maven Enforcer Plugin
          Issue Type: Bug
          Components: Standard Rules
    Affects Versions: 3.0.0-M3
         Environment: Windows
            Reporter: Casper Roubos
         Attachments: test.zip

With using the <requireReleaseDeps> the enforcer throws a RuntimeException due 
to the following error:
<code>
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)</code>

This file is an optional dependency and the POM is sometimes not available. I 
have given the optional parameter in the POM
<code>
                <dependency>
                        <groupId>nl.myshared.datafiles</groupId>
                        <artifactId>runtime_data</artifactId>
                        <version>${project.version}</version>
                        <type>selector</type>
                        <scope>runtime</scope>
                        <optional>true</optional>
                </dependency>
</code>

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.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to