Hello Frank,

Are you saying that no matter what version of Commons CLI you use and
then build from the command line with Maven, all is well?

If the above is true, then this suggests one of two things: Something
is wrong with M2E or something is wrong with the OSGi metadata in
Commons CLI,

I don't know if OSGi matters to M2E but you'd hope it wouldn't since
most JARs out there don't have OSGi metadata.

CLI 1.10.0-SNAPSHOT fixes this OSGi issue (see changes.xml):

> Remove -nouses directive from maven-bundle-plugin. OSGi package imports now 
> state 'uses' definitions for package imports, this doesn't affect JPMS (from 
> org.apache.commons:commons-parent:80)

I would test with a local build of git master or 1.10.0-SNAPSHOT from
our snapshot Maven repository:
https://repository.apache.org/content/repositories/snapshots/

This would tell us if the OSGi fix above matters.

You could also write a test and submit a PR that tests loading Commons
CLI using OSGi in the same way as Commons Compress in the test package
org.apache.commons.compress.osgi

HTH,
Gary

On Sun, Jun 22, 2025 at 1:39 PM Frank <software_fr...@runbox.com.invalid> wrote:
>
> Hello,
>
> I have a Java project with a Maven build in which a module uses commons-cli.  
> With version 1.9.0, the Maven build works correctly from the command line, 
> but Eclipse and VS Code give an error that org.apache.commons.cli cannot be 
> resolved to a module.  The strange thing is that if I drop back to version 
> 1.6.0, the error disappears.  The command line build and the IDE build both 
> work.  Any version after that produces the issue.  Eclipse lists the 
> commons-cli jar in the Maven dependencies for any version used and they are 
> physically present in ~/.m2.  Adding it manually to the module path does not 
> help.
>
> This is doubtless some problem buried in M2e, but I have not been able to 
> resolve it for some time.  I'm wondering if you can provide any insight into 
> what changed after 1.6.0 regarding the configuration as a Java 9+ module.  
> The error occurs when the system encounters 'requires transitive 
> org.apache.commons.cli;' in module-info.java.
>
> The project is fully modularized and built with Java 21 and Maven 3.9+.
>
> Thanks in advance,
> Frank
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
> For additional commands, e-mail: user-h...@commons.apache.org
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org

Reply via email to