Claudio Corsi created MCOMPILER-447:
---------------------------------------
Summary: Unable to compile modularized test for a multi-version
jar that is not a java module by default
Key: MCOMPILER-447
URL: https://issues.apache.org/jira/browse/MCOMPILER-447
Project: Maven Compiler Plugin
Issue Type: Bug
Affects Versions: 3.8.1
Reporter: Claudio Corsi
I have a single module project that is creating a mult-version jar file. By
default the multi-version jar is not a java module because it is being built
for jdk 7 or newer. The multi-version jar does contain a java module
definition within the /META-INF/versions/9 directory. I am trying to create a
integration test that uses the java module of the code. When I tried building
the module tests I got the UnsupportedOperationException with the message:
Can't compile test sources when main sources are missing a module descriptor
The issue was that the main module does not contain a module descriptor but the
test does contain a module descriptor.
I then forked a copy of the maven compiler plugin. I created an integration
test and was able to fix this issue. The issue was that I needed to find the
latest version of the java-module for the module generated multi-version jar
file. This because the module descriptor and was added to the javac command.
I then tried to build my test source again and this time it stated that it was
not able to find a class because it is part of a jar file that does not contain
any java module definition. I updated the integration test and was able to add
another fix to the forked copy that resolved that issue. The issue was that
all non-java-module jar files should be included as part of the class path.
They were all being included as part of the module path.
I then used the fixed jar file to build my project and it failed again because
of it accessing a unnamed module. I had to finally update my pom to include a
--add-reads command line option. I will not try to add a fix to this issue
since this issue has a workaround unlike the other two that didn't.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)