[jira] [Commented] (MCOMPILER-436) Cannot compile code that depends on on Apache Mina SSH due to JPMS error
[ https://issues.apache.org/jira/browse/MCOMPILER-436?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17215649#comment-17215649 ] Gili commented on MCOMPILER-436: Got it. So let's leave things as-is. For future reference (in case someone else runs across this issue) it looks like this logic is happening at https://github.com/codehaus-plexus/plexus-languages/blob/15031cc226516d0fa30a43aa38d8159e6e2e9115/plexus-java/src/main/java/org/codehaus/plexus/languages/java/jpms/LocationManager.java#L201 which invokes https://github.com/codehaus-plexus/plexus-languages/blob/15031cc226516d0fa30a43aa38d8159e6e2e9115/plexus-java/src/main/java/org/codehaus/plexus/languages/java/jpms/LocationManager.java#L357 which invokes https://github.com/codehaus-plexus/plexus-languages/blob/dc2d4d45edb7b63de7575fe10bd2af4a6b577e4b/plexus-java/src/main/java9/org/codehaus/plexus/languages/java/jpms/CmdModuleNameExtractor.java#L90 > Cannot compile code that depends on on Apache Mina SSH due to JPMS error > > > Key: MCOMPILER-436 > URL: https://issues.apache.org/jira/browse/MCOMPILER-436 > Project: Maven Compiler Plugin > Issue Type: Bug >Affects Versions: 3.8.1 >Reporter: Gili >Priority: Major > Attachments: extract-module-name.zip > > > 1. Extract Testcase > 2. Run "mvn clean install" > 3. Build fails with: > [WARNING] Can't extract module name from sshd-core-2.5.1.jar: Provider class > org.apache.sshd.common.file.root.RootedFileSystemProvider not in module > [ERROR] module not found: sshd.core > Expected behavior: The plugin should be able to extract the module name given > that sshd-core depends on sshd-commons which contains the aforementioned > provider and automatic modules can access classes outside their module. -- This message was sent by Atlassian Jira (v8.3.4#803005)
[jira] [Commented] (MCOMPILER-436) Cannot compile code that depends on on Apache Mina SSH due to JPMS error
[ https://issues.apache.org/jira/browse/MCOMPILER-436?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17215565#comment-17215565 ] Robert Scholte commented on MCOMPILER-436: -- No, step one is read the module descriptor based the single line of code I gave you before. If that fails, the rest will fail too. > Cannot compile code that depends on on Apache Mina SSH due to JPMS error > > > Key: MCOMPILER-436 > URL: https://issues.apache.org/jira/browse/MCOMPILER-436 > Project: Maven Compiler Plugin > Issue Type: Bug >Affects Versions: 3.8.1 >Reporter: Gili >Priority: Major > Attachments: extract-module-name.zip > > > 1. Extract Testcase > 2. Run "mvn clean install" > 3. Build fails with: > [WARNING] Can't extract module name from sshd-core-2.5.1.jar: Provider class > org.apache.sshd.common.file.root.RootedFileSystemProvider not in module > [ERROR] module not found: sshd.core > Expected behavior: The plugin should be able to extract the module name given > that sshd-core depends on sshd-commons which contains the aforementioned > provider and automatic modules can access classes outside their module. -- This message was sent by Atlassian Jira (v8.3.4#803005)
[jira] [Commented] (MCOMPILER-436) Cannot compile code that depends on on Apache Mina SSH due to JPMS error
[ https://issues.apache.org/jira/browse/MCOMPILER-436?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17215505#comment-17215505 ] Gili commented on MCOMPILER-436: Looking at https://github.com/codehaus-plexus/plexus-languages/blob/master/plexus-java/src/main/java/org/codehaus/plexus/languages/java/jpms/LocationManager.java it seems that the module name *can* be extracted. The problem is that LocationManager.resolvePaths() does a lot more than extracting the module name. It tries resolving all line entries inside module-info.java. If we were to tease apart the different functionality, what would happen? Would we get past the module name extraction but at runtime the JRE would fail with a module load error? From a user perspective I think this would be a much nicer experience. I just don't know how much extra work will be involved to make this happen. > Cannot compile code that depends on on Apache Mina SSH due to JPMS error > > > Key: MCOMPILER-436 > URL: https://issues.apache.org/jira/browse/MCOMPILER-436 > Project: Maven Compiler Plugin > Issue Type: Bug >Affects Versions: 3.8.1 >Reporter: Gili >Priority: Major > Attachments: extract-module-name.zip > > > 1. Extract Testcase > 2. Run "mvn clean install" > 3. Build fails with: > [WARNING] Can't extract module name from sshd-core-2.5.1.jar: Provider class > org.apache.sshd.common.file.root.RootedFileSystemProvider not in module > [ERROR] module not found: sshd.core > Expected behavior: The plugin should be able to extract the module name given > that sshd-core depends on sshd-commons which contains the aforementioned > provider and automatic modules can access classes outside their module. -- This message was sent by Atlassian Jira (v8.3.4#803005)
[jira] [Commented] (MCOMPILER-436) Cannot compile code that depends on on Apache Mina SSH due to JPMS error
[ https://issues.apache.org/jira/browse/MCOMPILER-436?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17215253#comment-17215253 ] Robert Scholte commented on MCOMPILER-436: -- This is just one edge case, there are other cases where the exception is clear enough. [https://github.com/apache/maven-compiler-plugin/blob/master/src/main/java/org/apache/maven/plugin/compiler/CompilerMojo.java#L238-L247] builds the error message. You can't now for sure that the loading of the file was the issue, unless you analyze the exception. I've tried to keep it as simple as possible, but if you think that handling the InvalidModuleDescriptorException deserves a special message, I suggest to provide a PR. > Cannot compile code that depends on on Apache Mina SSH due to JPMS error > > > Key: MCOMPILER-436 > URL: https://issues.apache.org/jira/browse/MCOMPILER-436 > Project: Maven Compiler Plugin > Issue Type: Bug >Affects Versions: 3.8.1 >Reporter: Gili >Priority: Major > Attachments: extract-module-name.zip > > > 1. Extract Testcase > 2. Run "mvn clean install" > 3. Build fails with: > [WARNING] Can't extract module name from sshd-core-2.5.1.jar: Provider class > org.apache.sshd.common.file.root.RootedFileSystemProvider not in module > [ERROR] module not found: sshd.core > Expected behavior: The plugin should be able to extract the module name given > that sshd-core depends on sshd-commons which contains the aforementioned > provider and automatic modules can access classes outside their module. -- This message was sent by Atlassian Jira (v8.3.4#803005)
[jira] [Commented] (MCOMPILER-436) Cannot compile code that depends on on Apache Mina SSH due to JPMS error
[ https://issues.apache.org/jira/browse/MCOMPILER-436?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17215209#comment-17215209 ] Gili commented on MCOMPILER-436: [~rfscholte] I see your point but I still feel that the error message is missing an important line of reasoning. >From the perspective of someone who is not familiar with the implementation >details of Java Modules, one would think that you should be able to extract >the module name for the aforementioned case. I mean, there is a well-defined >algorithm for converting the filenames into automatic module names. There is >also an Automatic-Module-Name entry in the manifest file. So from the user's >perspective you have everything you need to extract a module name. What the error message fails to explain is that although we can theoretically extract a module name, we can't in fact load the JAR file as a module. > Cannot compile code that depends on on Apache Mina SSH due to JPMS error > > > Key: MCOMPILER-436 > URL: https://issues.apache.org/jira/browse/MCOMPILER-436 > Project: Maven Compiler Plugin > Issue Type: Bug >Affects Versions: 3.8.1 >Reporter: Gili >Priority: Major > Attachments: extract-module-name.zip > > > 1. Extract Testcase > 2. Run "mvn clean install" > 3. Build fails with: > [WARNING] Can't extract module name from sshd-core-2.5.1.jar: Provider class > org.apache.sshd.common.file.root.RootedFileSystemProvider not in module > [ERROR] module not found: sshd.core > Expected behavior: The plugin should be able to extract the module name given > that sshd-core depends on sshd-commons which contains the aforementioned > provider and automatic modules can access classes outside their module. -- This message was sent by Atlassian Jira (v8.3.4#803005)
[jira] [Commented] (MCOMPILER-436) Cannot compile code that depends on on Apache Mina SSH due to JPMS error
[ https://issues.apache.org/jira/browse/MCOMPILER-436?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17214981#comment-17214981 ] Robert Scholte commented on MCOMPILER-436: -- Well, that is the message you get, but being more explicit that is was caused when trying to get the module name: \{{Can't extract module name from sshd-core-2.5.1.jar: Provider class org.apache.sshd.common.file.root.RootedFileSystemProvider not in module. }} > Cannot compile code that depends on on Apache Mina SSH due to JPMS error > > > Key: MCOMPILER-436 > URL: https://issues.apache.org/jira/browse/MCOMPILER-436 > Project: Maven Compiler Plugin > Issue Type: Bug >Affects Versions: 3.8.1 >Reporter: Gili >Priority: Major > Attachments: extract-module-name.zip > > > 1. Extract Testcase > 2. Run "mvn clean install" > 3. Build fails with: > [WARNING] Can't extract module name from sshd-core-2.5.1.jar: Provider class > org.apache.sshd.common.file.root.RootedFileSystemProvider not in module > [ERROR] module not found: sshd.core > Expected behavior: The plugin should be able to extract the module name given > that sshd-core depends on sshd-commons which contains the aforementioned > provider and automatic modules can access classes outside their module. -- This message was sent by Atlassian Jira (v8.3.4#803005)
[jira] [Commented] (MCOMPILER-436) Cannot compile code that depends on on Apache Mina SSH due to JPMS error
[ https://issues.apache.org/jira/browse/MCOMPILER-436?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17214948#comment-17214948 ] Gili commented on MCOMPILER-436: [~rfscholte] I get: bq. InvalidModuleDescriptorException: Provider class org.apache.sshd.common.file.root.RootedFileSystemProvider not in module which says nothing about not being able to extract a module name. Are you using {{ModuleFinder}} to derive a module name? If so, consider changing the error message to something along the lines of "Failed to load {filename}: {exception.getMessage()}" > Cannot compile code that depends on on Apache Mina SSH due to JPMS error > > > Key: MCOMPILER-436 > URL: https://issues.apache.org/jira/browse/MCOMPILER-436 > Project: Maven Compiler Plugin > Issue Type: Bug >Affects Versions: 3.8.1 >Reporter: Gili >Priority: Major > Attachments: extract-module-name.zip > > > 1. Extract Testcase > 2. Run "mvn clean install" > 3. Build fails with: > [WARNING] Can't extract module name from sshd-core-2.5.1.jar: Provider class > org.apache.sshd.common.file.root.RootedFileSystemProvider not in module > [ERROR] module not found: sshd.core > Expected behavior: The plugin should be able to extract the module name given > that sshd-core depends on sshd-commons which contains the aforementioned > provider and automatic modules can access classes outside their module. -- This message was sent by Atlassian Jira (v8.3.4#803005)
[jira] [Commented] (MCOMPILER-436) Cannot compile code that depends on on Apache Mina SSH due to JPMS error
[ https://issues.apache.org/jira/browse/MCOMPILER-436?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17214871#comment-17214871 ] Robert Scholte commented on MCOMPILER-436: -- 1. The plugin uses JDK code, the split package is not the issue, but the service. 2. Yes, now that is illegal 3. It is a JDK message, can't be changed. To simply check, just run the following line in JShell {code} java.lang.module.ModuleFinder.of(java.nio.file.Paths.get("sshd-core-2.5.1.jar")).findAll() {code} > Cannot compile code that depends on on Apache Mina SSH due to JPMS error > > > Key: MCOMPILER-436 > URL: https://issues.apache.org/jira/browse/MCOMPILER-436 > Project: Maven Compiler Plugin > Issue Type: Bug >Affects Versions: 3.8.1 >Reporter: Gili >Priority: Major > Attachments: extract-module-name.zip > > > 1. Extract Testcase > 2. Run "mvn clean install" > 3. Build fails with: > [WARNING] Can't extract module name from sshd-core-2.5.1.jar: Provider class > org.apache.sshd.common.file.root.RootedFileSystemProvider not in module > [ERROR] module not found: sshd.core > Expected behavior: The plugin should be able to extract the module name given > that sshd-core depends on sshd-commons which contains the aforementioned > provider and automatic modules can access classes outside their module. -- This message was sent by Atlassian Jira (v8.3.4#803005)
[jira] [Commented] (MCOMPILER-436) Cannot compile code that depends on on Apache Mina SSH due to JPMS error
[ https://issues.apache.org/jira/browse/MCOMPILER-436?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17214854#comment-17214854 ] Gili commented on MCOMPILER-436: Hi Robert, 1. It sounds to me like the plugin should be able to extract a module name from the JAR file even if later on that module cannot be used due to the split package issue. Therefore the first message is misleading and should be corrected. 2. Is it really illegal for a Java Module to reference a service contained in an external module? Assuming both are legal modules (no split package) this should work, right? 3. Can we improve the error message to mention that "although can be used on the classpath, it cannot be loaded on the module path due to split package found in both and "? > Cannot compile code that depends on on Apache Mina SSH due to JPMS error > > > Key: MCOMPILER-436 > URL: https://issues.apache.org/jira/browse/MCOMPILER-436 > Project: Maven Compiler Plugin > Issue Type: Bug >Affects Versions: 3.8.1 >Reporter: Gili >Priority: Major > Attachments: extract-module-name.zip > > > 1. Extract Testcase > 2. Run "mvn clean install" > 3. Build fails with: > [WARNING] Can't extract module name from sshd-core-2.5.1.jar: Provider class > org.apache.sshd.common.file.root.RootedFileSystemProvider not in module > [ERROR] module not found: sshd.core > Expected behavior: The plugin should be able to extract the module name given > that sshd-core depends on sshd-commons which contains the aforementioned > provider and automatic modules can access classes outside their module. -- This message was sent by Atlassian Jira (v8.3.4#803005)
[jira] [Commented] (MCOMPILER-436) Cannot compile code that depends on on Apache Mina SSH due to JPMS error
[ https://issues.apache.org/jira/browse/MCOMPILER-436?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17214828#comment-17214828 ] Robert Scholte commented on MCOMPILER-436: -- sshd-core-2.5.1.jar contains META-INF/services/java.nio.file.spi.FileSystemProvider, saying this jar contains an implementation called org.apache.sshd.common.file.root.RootedFileSystemProvider. However, it is not sshd-core that contains this class, but sshd-common. When compiling with the module path, this is verified as well, and it just means that these jars are invalid and must be fixed by sshd. Worst solution is to turn it into a Maven multimodule project, shade both sshd jars into a new jar, and let you other module depend on that on. But as said: let sshd fix this, they created invalid jars (that might work on the classpath, but not on the modulepath anymore) > Cannot compile code that depends on on Apache Mina SSH due to JPMS error > > > Key: MCOMPILER-436 > URL: https://issues.apache.org/jira/browse/MCOMPILER-436 > Project: Maven Compiler Plugin > Issue Type: Bug >Affects Versions: 3.8.1 >Reporter: Gili >Priority: Major > Attachments: extract-module-name.zip > > > 1. Extract Testcase > 2. Run "mvn clean install" > 3. Build fails with: > [WARNING] Can't extract module name from sshd-core-2.5.1.jar: Provider class > org.apache.sshd.common.file.root.RootedFileSystemProvider not in module > [ERROR] module not found: sshd.core > Expected behavior: The plugin should be able to extract the module name given > that sshd-core depends on sshd-commons which contains the aforementioned > provider and automatic modules can access classes outside their module. -- This message was sent by Atlassian Jira (v8.3.4#803005)
[jira] [Commented] (MCOMPILER-436) Cannot compile code that depends on on Apache Mina SSH due to JPMS error
[ https://issues.apache.org/jira/browse/MCOMPILER-436?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17214792#comment-17214792 ] Michael Osipov commented on MCOMPILER-436: -- We should ask our expert [~rfscholte]. > Cannot compile code that depends on on Apache Mina SSH due to JPMS error > > > Key: MCOMPILER-436 > URL: https://issues.apache.org/jira/browse/MCOMPILER-436 > Project: Maven Compiler Plugin > Issue Type: Bug >Affects Versions: 3.8.1 >Reporter: Gili >Priority: Major > Attachments: extract-module-name.zip > > > 1. Extract Testcase > 2. Run "mvn clean install" > 3. Build fails with: > [WARNING] Can't extract module name from sshd-core-2.5.1.jar: Provider class > org.apache.sshd.common.file.root.RootedFileSystemProvider not in module > [ERROR] module not found: sshd.core > Expected behavior: The plugin should be able to extract the module name given > that sshd-core depends on sshd-commons which contains the aforementioned > provider and automatic modules can access classes outside their module. -- This message was sent by Atlassian Jira (v8.3.4#803005)
[jira] [Commented] (MCOMPILER-436) Cannot compile code that depends on on Apache Mina SSH due to JPMS error
[ https://issues.apache.org/jira/browse/MCOMPILER-436?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17214787#comment-17214787 ] Gili commented on MCOMPILER-436: [~michael-o] You are right. The last comment was posted on the wrong JIRA issue. It was meant for the MINA developers. That said, the following error message seems like an issue in the compiler plugin: [WARNING] Can't extract module name from sshd-core-2.5.1.jar: Provider class org.apache.sshd.common.file.root.RootedFileSystemProvider not in module [ERROR] module not found: sshd.core What are your thoughts on this? > Cannot compile code that depends on on Apache Mina SSH due to JPMS error > > > Key: MCOMPILER-436 > URL: https://issues.apache.org/jira/browse/MCOMPILER-436 > Project: Maven Compiler Plugin > Issue Type: Bug >Affects Versions: 3.8.1 >Reporter: Gili >Priority: Major > Attachments: extract-module-name.zip > > > 1. Extract Testcase > 2. Run "mvn clean install" > 3. Build fails with: > [WARNING] Can't extract module name from sshd-core-2.5.1.jar: Provider class > org.apache.sshd.common.file.root.RootedFileSystemProvider not in module > [ERROR] module not found: sshd.core > Expected behavior: The plugin should be able to extract the module name given > that sshd-core depends on sshd-commons which contains the aforementioned > provider and automatic modules can access classes outside their module. -- This message was sent by Atlassian Jira (v8.3.4#803005)
[jira] [Commented] (MCOMPILER-436) Cannot compile code that depends on on Apache Mina SSH due to JPMS error
[ https://issues.apache.org/jira/browse/MCOMPILER-436?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17214779#comment-17214779 ] Michael Osipov commented on MCOMPILER-436: -- I am confused, if you say it contains split packages, shouldn't it be handled by the MINA project rather? > Cannot compile code that depends on on Apache Mina SSH due to JPMS error > > > Key: MCOMPILER-436 > URL: https://issues.apache.org/jira/browse/MCOMPILER-436 > Project: Maven Compiler Plugin > Issue Type: Bug >Affects Versions: 3.8.1 >Reporter: Gili >Priority: Major > Attachments: extract-module-name.zip > > > 1. Extract Testcase > 2. Run "mvn clean install" > 3. Build fails with: > [WARNING] Can't extract module name from sshd-core-2.5.1.jar: Provider class > org.apache.sshd.common.file.root.RootedFileSystemProvider not in module > [ERROR] module not found: sshd.core > Expected behavior: The plugin should be able to extract the module name given > that sshd-core depends on sshd-commons which contains the aforementioned > provider and automatic modules can access classes outside their module. -- This message was sent by Atlassian Jira (v8.3.4#803005)
[jira] [Commented] (MCOMPILER-436) Cannot compile code that depends on on Apache Mina SSH due to JPMS error
[ https://issues.apache.org/jira/browse/MCOMPILER-436?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17212607#comment-17212607 ] Gili commented on MCOMPILER-436: The hardest problem to solve is the split packages. The most straightforward way would be to assign each artifact a unique package (e.g. move all packages of sshd-core under org.apache.sshd.core, all packages of sshd-common under org.apache.sshd.common and so on) but this will break backwards compatibility. Another approach would be to merge any artifacts that split a package. This would retain the same package names but the artifacts would change (this would be a lesser breakage of backwards compatibility but might reduce the modularity of the library). There are many possibilities. Once you decide which way you want to proceed, we can move forward. > Cannot compile code that depends on on Apache Mina SSH due to JPMS error > > > Key: MCOMPILER-436 > URL: https://issues.apache.org/jira/browse/MCOMPILER-436 > Project: Maven Compiler Plugin > Issue Type: Bug >Affects Versions: 3.8.1 >Reporter: Gili >Priority: Major > Attachments: extract-module-name.zip > > > 1. Extract Testcase > 2. Run "mvn clean install" > 3. Build fails with: > [WARNING] Can't extract module name from sshd-core-2.5.1.jar: Provider class > org.apache.sshd.common.file.root.RootedFileSystemProvider not in module > [ERROR] module not found: sshd.core > Expected behavior: The plugin should be able to extract the module name given > that sshd-core depends on sshd-commons which contains the aforementioned > provider and automatic modules can access classes outside their module. -- This message was sent by Atlassian Jira (v8.3.4#803005)
[jira] [Commented] (MCOMPILER-436) Cannot compile code that depends on on Apache Mina SSH due to JPMS error
[ https://issues.apache.org/jira/browse/MCOMPILER-436?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17212166#comment-17212166 ] Gili commented on MCOMPILER-436: I've lost 5 hours of my life to this issue. I've tried: * I added Automatic-Module-Name to Apache Mina SSH. This caused it to show up as a JPMS module so my applications' module-info could finally refer to it. But I cannot use it because it has a split package problem. * I tried using --patch-module per https://nipafx.dev/five-command-line-options-hack-java-module-system to add all the packages of org.apache.sshd.common into the org.apache.sshd.core JPMS module but I was never able to get this to work. The compiler keeps on complaining that the org.apache.sshd.core JPMS module does not contain the packages I am trying to add using patch-module. I finally got this working using the workaround described at https://stackoverflow.com/a/53329288/14731 but it's a rather ugly hack. I am hoping to improve upon this. > Cannot compile code that depends on on Apache Mina SSH due to JPMS error > > > Key: MCOMPILER-436 > URL: https://issues.apache.org/jira/browse/MCOMPILER-436 > Project: Maven Compiler Plugin > Issue Type: Bug >Affects Versions: 3.8.1 >Reporter: Gili >Priority: Major > Attachments: extract-module-name.zip > > > 1. Extract Testcase > 2. Run "mvn clean install" > 3. Build fails with: > [WARNING] Can't extract module name from sshd-core-2.5.1.jar: Provider class > org.apache.sshd.common.file.root.RootedFileSystemProvider not in module > [ERROR] module not found: sshd.core > Expected behavior: The plugin should be able to extract the module name given > that sshd-core depends on sshd-commons which contains the aforementioned > provider and automatic modules can access classes outside their module. -- This message was sent by Atlassian Jira (v8.3.4#803005)