You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Gili (Jira)" <ji...@apache.org> on 2020/06/29 14:45:00 UTC

[jira] [Comment Edited] (MCOMPILER-423) Unable to define qualified exports to unknown modules without triggering compiler warning

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

Gili edited comment on MCOMPILER-423 at 6/29/20, 2:44 PM:
----------------------------------------------------------

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:
  
{code:java}
<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>
{code}


was (Author: cowwoc):
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:
  
{code:java}
<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>
{code}

> Unable to define qualified exports to unknown modules without triggering compiler warning
> -----------------------------------------------------------------------------------------
>
>                 Key: MCOMPILER-423
>                 URL: https://issues.apache.org/jira/browse/MCOMPILER-423
>             Project: Maven Compiler Plugin
>          Issue Type: Improvement
>    Affects Versions: 3.8.1
>            Reporter: Gili
>            Priority: Major
>         Attachments: qualified-exports-module-source-path.zip
>
>
> Following up on a discussion with [~khmarbaise] 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.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)