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

Piotr Karwasz commented on VFS-859:
-----------------------------------

This issue is cause by multiple factors:

* {{httpcore}} is *directly* used in the code, so it should be declared as 
*direct* optional dependency. Due to this fact, Moditect adds a {{requires}} 
directive for the module.
* Due to a bug in either Moditect or Maven, the now *transitive* {{httpcore}} 
dependency does not inherit the "optional" flag from {{httpclient}} and the 
{{static}} modifier is not added to the JPMS descriptor (see 
[moditect/moditect#259|https://github.com/moditect/moditect/issues/259]).

> Improper handling of optional JPMS modules
> ------------------------------------------
>
>                 Key: VFS-859
>                 URL: https://issues.apache.org/jira/browse/VFS-859
>             Project: Commons VFS
>          Issue Type: Improvement
>    Affects Versions: 2.10.0
>            Reporter: Piotr Karwasz
>            Priority: Major
>
> The current automatically generated JPMS module descriptor contains a:
> {code:java}
> requires org.apache.httpcomponents.httpcore;
> {code}
> directive, without the {{static}} modifier, which causes runtime exceptions 
> if the *optional* {{httpcore}} dependency is not present at runtime:
> {noformat}
> Error occurred during initialization of boot layer
> java.lang.module.FindException: Module org.apache.httpcomponents.httpcore not 
> found, required by org.apache.commons.vfs2
> {noformat}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to