[ 
https://issues.apache.org/jira/browse/MENFORCER-378?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17652326#comment-17652326
 ] 

Petr Široký edited comment on MENFORCER-378 at 12/27/22 11:15 PM:
------------------------------------------------------------------

{{3.2.0-SNAPSHOT}} seems to behave the same, with the added benefit of nicer 
error message:
{code:java}
[INFO] -----------------------< nl.mytest:domain_libs >------------------------
[INFO] Building Common Libraries 0.0.1-SNAPSHOT                           [3/4]
[INFO] --------------------------------[ jar ]---------------------------------
[WARNING] The POM for 
nl.myshared.datafiles:runtime_data:selector:0.0.1-SNAPSHOT is missing, no 
dependency information available
[INFO] 
[INFO] --- maven-enforcer-plugin:3.2.0-SNAPSHOT:enforce (enforce) @ domain_libs 
---
[INFO] Executing rule: org.apache.maven.plugins.enforcer.RequireReleaseDeps
[INFO] Executing rule: org.apache.maven.plugins.enforcer.RequireSameVersions
[ERROR] Rule 0: org.apache.maven.plugins.enforcer.RequireReleaseDeps failed 
with message:
nl.myshared.datafiles:runtime_data:selector:0.0.1-SNAPSHOT <--- is not a 
release dependency
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary for Homeserver Domains 0.0.1-SNAPSHOT:
[INFO] 
[INFO] Homeserver Domains ................................. SUCCESS [  0.001 s]
[INFO] Domeinen ........................................... SUCCESS [  0.138 s]
[INFO] Common Libraries ................................... FAILURE [  0.010 s]
[INFO] Common Libs ........................................ SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  0.192 s
[INFO] Finished at: 2022-12-28T00:12:36+01:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal 
org.apache.maven.plugins:maven-enforcer-plugin:3.2.0-SNAPSHOT:enforce (enforce) 
on project domain_libs: Some Enforcer rules have failed. Look above for 
specific messages explaining why the rule failed. -> [Help 1]{code}


was (Author: psiroky):
{{3.2.0-SNAPSHOT}} seems to behave the same, with the added benefit of snicer 
error message:
{code:java}
[INFO] -----------------------< nl.mytest:domain_libs >------------------------
[INFO] Building Common Libraries 0.0.1-SNAPSHOT                           [3/4]
[INFO] --------------------------------[ jar ]---------------------------------
[WARNING] The POM for 
nl.myshared.datafiles:runtime_data:selector:0.0.1-SNAPSHOT is missing, no 
dependency information available
[INFO] 
[INFO] --- maven-enforcer-plugin:3.2.0-SNAPSHOT:enforce (enforce) @ domain_libs 
---
[INFO] Executing rule: org.apache.maven.plugins.enforcer.RequireReleaseDeps
[INFO] Executing rule: org.apache.maven.plugins.enforcer.RequireSameVersions
[ERROR] Rule 0: org.apache.maven.plugins.enforcer.RequireReleaseDeps failed 
with message:
nl.myshared.datafiles:runtime_data:selector:0.0.1-SNAPSHOT <--- is not a 
release dependency
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary for Homeserver Domains 0.0.1-SNAPSHOT:
[INFO] 
[INFO] Homeserver Domains ................................. SUCCESS [  0.001 s]
[INFO] Domeinen ........................................... SUCCESS [  0.138 s]
[INFO] Common Libraries ................................... FAILURE [  0.010 s]
[INFO] Common Libs ........................................ SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  0.192 s
[INFO] Finished at: 2022-12-28T00:12:36+01:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal 
org.apache.maven.plugins:maven-enforcer-plugin:3.2.0-SNAPSHOT:enforce (enforce) 
on project domain_libs: Some Enforcer rules have failed. Look above for 
specific messages explaining why the rule failed. -> [Help 1]{code}

> 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
>            Priority: Major
>         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)

Reply via email to