tycho
tycho copied to clipboard
tycho-compiler-jdt unable to compile test code when module-info.java is present
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 Do you like provide an integration-test to demonstrate the issue?
@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.
@akurtakov can you take a look or trigger any of the ECJ/JDT people to take a look?