maven-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Robert Scholte (JIRA)" <j...@apache.org>
Subject [jira] [Comment Edited] (MCOMPILER-321) Problematic Java 9 modules are silently ignored
Date Sat, 27 Jan 2018 20:07:00 GMT

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

Robert Scholte edited comment on MCOMPILER-321 at 1/27/18 8:06 PM:
-------------------------------------------------------------------

The reason why some modules silently ignored has to do with the java modules. If you refer
to {{java.logging}} then it won't find a matching dependency.
And it is possible that some jars will end up on classpath next to the modulepath.

In the end the error is correct, but I can imagine it can be misleading when you are sure
the dependency is there.
A proposal for a fix should be added to the plexus-languages project first.


was (Author: rfscholte):
The reason why some modules silently ignored has to do with the java modules. If you refer
to {{java.logging}} but won't find a matching dependency.
And it is possible that some jars will end up on classpath next to the modulepath.

In the end the error is correct, but I can imagine it can be misleading when you are sure
the dependency is there.
A proposal for a fix should be added to the plexus-languages project first.

> Problematic Java 9 modules are silently ignored
> -----------------------------------------------
>
>                 Key: MCOMPILER-321
>                 URL: https://issues.apache.org/jira/browse/MCOMPILER-321
>             Project: Maven Compiler Plugin
>          Issue Type: Bug
>            Reporter: Marcel Kolsteren
>            Priority: Major
>         Attachments: maven-compiler-plugin-bug.zip
>
>
> Before the compilation starts, the compiler plugin prepares the module path and the class
path. Unfortunately, this process is very lenient. If the plugin cannot find a module that
is specified in the module-info file, it doesn't report this problem, and it just carries
on. In the end, the compiler will give a "module not found", giving no clue about the root
cause.
> As an example, I attached a simple maven project with a module info file that refers
to an automatic module named {{jython-standalone}}. The dependencies contain a jar file {{jython-standalone-2.7.0.jar}}.
That jar file contains no module information, and it would normally be resolvable as an automatic
module. However, when building the project, the Java compiler fails with this error:
> {{module not found: jython.standalone}}
> The root cause of the error is that the jar file contains a class at top level, which
is illegal for a module. So, the error message "module not found" is misleading.
> I think this is a bug, because the maven-compiler-plugin fails to perform its task of
building a correct module path, but doesn't tell, and just carries on. Instead, it should
stop, and give an informative error message.
> Relevant source code:
> * [https://github.com/apache/maven-compiler-plugin], class {{CompilerMojo}}
> * [https://github.com/codehaus-plexus/plexus-languages], class {{LocationManager}} and
{{MainClassModuleNameExtractor}}
> * [https://docs.oracle.com/javase/9/docs/api/java/lang/module/ModuleFinder.html]
> The {{MainClassModuleNameExtractor}} uses the {{ModuleFinder}} class of the JDK to find
modules. I think that these two error situations should lead to an error and a clear description
of possible causes:
> * {{ModuleFinder#findAll}} returns an empty set.
> * {{ModuleFinder#findAll}} results in a {{FindException}}. When this happens is well
documented in the {{ModuleFinder#of}} method. This exception is currently swallowed.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Mime
View raw message