tycho icon indicating copy to clipboard operation
tycho copied to clipboard

tycho-compiler-jdt unable to compile test code when module-info.java is present

Open jason-faust opened this issue 3 years ago • 3 comments

The Tycho Compiler JDT adapter is unable to compile test code/classes when module-info.java is present in the main source directory. Ends with an error of: (when running mvn clean test) [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:testCompile (default-testCompile) on project tycho.compiler.jdt.test: Fatal error compiling: Unrecognized option : --patch-module -> [Help 1]

A minimal set of files that can trigger this issue is:

pom.xml

<project xmlns="http://maven.apache.org/POM/4.0.0"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
	<modelVersion>4.0.0</modelVersion>
	<groupId>test</groupId>
	<artifactId>tycho.compiler.jdt.test</artifactId>
	<version>0.0.1-SNAPSHOT</version>
	<pluginRepositories>
		<pluginRepository>
			<id>tycho-snapshots</id>
			<url>https://repo.eclipse.org/content/repositories/tycho-snapshots/</url>
		</pluginRepository>
	</pluginRepositories>
	<properties>
		<maven.compiler.release>16</maven.compiler.release>
	</properties>
	<build>
		<pluginManagement>
			<plugins>
				<plugin>
					<groupId>org.apache.maven.plugins</groupId>
					<artifactId>maven-compiler-plugin</artifactId>
					<version>3.8.1</version>
					<configuration>
						<compilerId>jdt</compilerId>
					</configuration>
					<dependencies>
						<dependency>
							<groupId>org.eclipse.tycho</groupId>
							<artifactId>tycho-compiler-jdt</artifactId>
							<version>2.5.0-SNAPSHOT</version>
						</dependency>
					</dependencies>
				</plugin>
			</plugins>
		</pluginManagement>
	</build>
</project>

src/main/java/module-info.java

module ex {}

src/main/java/eg/A.java

package ex;
public class A {}

src/test/java/eg/ATest.java

package ex;
class ATest {}

jason-faust avatar Aug 21 '21 20:08 jason-faust

@jason-faust Do you like provide an integration-test to demonstrate the issue?

laeubi avatar Mar 08 '22 18:03 laeubi

@laeubi I was unable to get any of the tests to run targeting the 3.0.0 work, so hopefully setting this up against 2.7.x is ok.

jason-faust avatar Mar 27 '22 04:03 jason-faust

@akurtakov can you take a look or trigger any of the ECJ/JDT people to take a look?

laeubi avatar Jun 15 '22 04:06 laeubi