You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Slawomir Jaranowski (Jira)" <ji...@apache.org> on 2023/01/07 17:33:00 UTC
[jira] [Closed] (MENFORCER-378) requireReleaseDeps does not support optional dependencies or runtime scope
[ https://issues.apache.org/jira/browse/MENFORCER-378?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Slawomir Jaranowski closed MENFORCER-378.
-----------------------------------------
Resolution: Fixed
Test added
> 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
> Assignee: Slawomir Jaranowski
> Priority: Major
> Fix For: 3.2.0
>
> 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.20.10#820010)