You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Roel Spilker (JIRA)" <ji...@apache.org> on 2017/09/25 22:02:00 UTC

[jira] [Commented] (MCOMPILER-291) No possible use compilerArgs arg "-J--add-opens" multiple times

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

Roel Spilker commented on MCOMPILER-291:
----------------------------------------

It is a big problem that it is not possible to repeat the {noformat}-J--add-opens{noformat} argument. they are there for a reason.

The only good thing is that, at least for now, it is possible to use lombok without specifying the {noformat}-J--add-opens{noformat} clauses. The following worked for me:

{code:xml}
<dependencies>
	<dependency>
		<groupId>org.projectlombok</groupId>
		<artifactId>lombok</artifactId>
		<version>1.16.18</version>
		<scope>provided</scope>
	</dependency>
</dependencies>
	
<build>
	<pluginManagement>
	<plugins>
		<plugin>
			<groupId>org.apache.maven.plugins</groupId>
			<artifactId>maven-compiler-plugin</artifactId>
			<version>3.7.0</version>
			<configuration>
				<source>1.9</source>
				<target>1.9</target>
				<encoding>utf-8</encoding>
				<fork>true</fork>
				<executable>d:/jdk9/bin/javac.exe</executable>
				<compilerVersion>1.9</compilerVersion>
				</configuration>
			</plugin>
		</plugins>
	</pluginManagement>
</build>
{code}

Sorry for the extra line-breaks. I couldn't convince JIRA not to strike my J's :(

> No possible use compilerArgs arg "-J--add-opens" multiple times
> ---------------------------------------------------------------
>
>                 Key: MCOMPILER-291
>                 URL: https://issues.apache.org/jira/browse/MCOMPILER-291
>             Project: Maven Compiler Plugin
>          Issue Type: Bug
>    Affects Versions: 3.6.1
>            Reporter: Pascal Schumacher
>
> I'm trying to a project with uses lombok to work with java 9.
> {code}
> <plugin>
>     <groupId>org.apache.maven.plugins</groupId>
>     <artifactId>maven-compiler-plugin</artifactId>
>     <version>3.6.1</version>
>     <configuration>
>         <source>1.8</source>
>         <target>1.8</target>
>         <fork>true</fork>
>         <compilerArgs>
>                 <arg>-J--add-opens</arg><arg>-Jjdk.compiler/com.sun.tools.javac.processing=ALL-UNNAMED</arg>
>                 <arg>-J--add-opens</arg><arg>-Jjdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED</arg>
>                 <arg>-J--add-opens</arg><arg>-Jjdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED</arg>
>                 <arg>-J--add-opens</arg><arg>-Jjdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED</arg>
>                 <arg>-J--add-opens</arg><arg>-Jjdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED</arg>
>                 <arg>-J--add-opens</arg><arg>-Jjdk.compiler/com.sun.tools.javac.model=ALL-UNNAMED</arg>
>                 <arg>-J--add-opens</arg><arg>-Jjdk.compiler/com.sun.tools.javac.comp=ALL-UNNAMED</arg>
>                 <arg>-J--add-opens</arg><arg>-Jjdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED</arg>
>                 <arg>-J--add-opens</arg><arg>-Jjdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED</arg>
>             </compilerArgs>
>     </configuration>
> </plugin>
> {code}
> {code}mvn -X compile{code} shows me that the {code}-J--add-opens{code} arguments are collapsed:
> {code}
> cmd.exe /X /C ""C:\Program Files\Java\jdk-9\bin\javac.exe" @C:/Users/User/random-beans/random-beans/target/classes/org.codehaus.plexus.compiler.javac.JavacCompiler9403484282707867963arguments -J--add-opens -Jjdk.compiler/com.sun.tools.javac.processing=ALL-UNNAMED -Jjdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED -Jjdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED -Jjdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED -Jjdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED -Jjdk.compiler/com.sun.tools.javac.model=ALL-UNNAMED -Jjdk.compiler/com.sun.tools.javac.comp=ALL-UNNAMED -Jjdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED -Jjdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED"
> {code}
> which results in:
> {code}Error: Main Class jdk.compiler.com.sun.tools.javac.util=ALL-UNNAMED could not be found or load{code}



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)