maven-compiler-plugin
maven-compiler-plugin copied to clipboard
[MCOMPILER-423] Unable to define qualified exports to unknown modules without triggering compiler warning
Gili opened MCOMPILER-423 and commented
Following up on a discussion with Karl Heinz Marbaise at https://stackoverflow.com/q/53670052/14731
It doesn't seem to be possible to compile the attached testcase without triggering a compiler warning.
Expected behavior: Maven compiler plugin should pass --module-source-path to avoid the compiler warning.
Affects: 3.8.1
Attachments:
- qualified-exports-module-source-path.zip (24.52 kB)
Gili commented
Passing the following options to the compiler plugin fixes the problem, but I am looking for a way to configure Maven to do this automatically on my behalf:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<compilerArgs>
<arg>-Werror</arg>
<arg>--module-source-path</arg>
<arg>${project.basedir}/../*/src/main/java</arg>
<arg>--module</arg>
<arg>${module.name}</arg>
</compilerArgs>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.1.0</version>
<executions>
<execution>
<id>default-jar</id>
<goals>
<goal>jar</goal>
</goals>
<configuration>
<!-- module-source-path causes the compiler to output into classes/${module.name} instead of just classes -->
<classesDirectory>${project.build.outputDirectory}/${module.name}</classesDirectory>
</configuration>
</execution>
</executions>
</plugin>