Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug 543631 - Eclipse - Maven - JPMS (m2e ignores compilerArgs in pom.xml) #129

Open
LAlves91 opened this issue Mar 30, 2021 · 6 comments
Open

Comments

@LAlves91
Copy link

Originally reported by Imanuel Rohlfing at bug.eclipse.org. There's also a Stack Overflow discussion on the subject.

Currently im migrating legacy-projects from java 8 to java 11. There are some issues using vm args like add-modules, add-> > > exports and add-opens:

Some base informations:

  • eclipse 2018-12 for Java developers
  • buildin maven (3.5.3)
  • java 11 (open-jdk-hotspot_11.0.1_13-windows-x64)

Within the pom im adding modules and exports:

<plugin>
	<groupId>org.apache.maven.plugins</groupId>
	<artifactId>maven-compiler-plugin</artifactId>
	<version>${compiler.plugin.version}</version>
	<configuration>
		<source>11</source>
		<target>11</target>
		<compilerArgs>
			<arg>--add-modules=java.desktop</arg>
			<arg>--add-exports=java.desktop/com.sun.java.swing.plaf.motif=ALL-UNNAMED</arg>
		</compilerArgs>
	</configuration>
</plugin>

Thats working fine. Using maven to compile the project ends with success.
But eclipse shows problems (the type xxx is not accessable).

To avoid these problems i can modify the project configurtaion:
Java Build Path -> Libraries -> JRE System Library [JavaSE-11] -> Is modular -> Edit

BUT: m2e is controlling the project settings. maven update command removes the changes in the project settings every time.

In the project I work on, we've managed to find a temporary fix by adding the modules we need at the project's configuration (or by adding them in our .classpath file). It stays functional as long as we don't forget to turn off the option 'Update project configuration from pom.xml' when running 'Maven > Update project...'.

@leerho
Copy link

leerho commented Jan 8, 2022

This bug has been open for 3 years now. I thought this was going to be fixed in 4.22, (2021-12) but the problem is still there. In fact, it not only impacts compiler JPMS args specified with the compiler plugin, it also impacts JPMS args specified in the surefire plugin.

This bug severely impacts smooth migration from Java 8 to Java 9+.

@laeubi
Copy link
Member

laeubi commented Jan 8, 2022

This bug has been open for 3 years now.
This bug severely impacts smooth migration from Java 8 to Java 9+.

I think lots of project where migrated in the past years so it seem not to impact at least that people that contribute to m2e. Can you try to provide a PR that mitigates the problem?

@howlger
Copy link

howlger commented Mar 7, 2022

For me it is working when <arg>--add-exports=java.desktop/com.sun.java.swing.plaf.motif=ALL-UNNAMED</arg> is correctly specified as <arg>--add-exports</arg> and <arg>java.desktop/com.sun.java.swing.plaf.motif=ALL-UNNAMED</arg> .

See also here.

@klaus52
Copy link

klaus52 commented Aug 30, 2022

I can confirm that "--add-exports" is working for me, too.
"--add-modules", however, seems to be not working, yet.

@b-fio
Copy link

b-fio commented Oct 5, 2022

I am on Version: 2022-06 (4.24.0), m2e 1.20.1.20220227-1319
and still, the bug is there, every time I update the project from maven, all the maven-compiler-plugin compilerArgs exports (I am on JDK11) are lost.
The only way I can mitigate this is to duplicate the args to the Run/Debug configuration VM args, that sucks.

@laeubi
Copy link
Member

laeubi commented Oct 5, 2022

It seems this issue is not relevant to any current m2e contributor and no one else cared enough to propose a patch.
So if this is crucial to someones business and likes to speed up the development in that area a sponsoring would allow me to assign more time-slots particular issue.

Beside that, please note that m2e 2.x is the current version, so bugifxes of any kind for m2e 1.x are very unlikely.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants