maven-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "John Patrick (Jira)" <j...@apache.org>
Subject [jira] [Created] (MCOMPILER-420) Support for testCompileSourceRoots to handle multiReleaseOutput
Date Tue, 16 Jun 2020 00:19:00 GMT
John Patrick created MCOMPILER-420:
--------------------------------------

             Summary: Support for testCompileSourceRoots to handle multiReleaseOutput
                 Key: MCOMPILER-420
                 URL: https://issues.apache.org/jira/browse/MCOMPILER-420
             Project: Maven Compiler Plugin
          Issue Type: Improvement
    Affects Versions: 3.8.1
            Reporter: John Patrick


Testing out surefire v3.0.0-M5 and coming across issues with testCompile.

I've got;
```
src/main/java/aaa
src/main/java11/module-info.java
src/test/java/bbb
src/test/java11/module-info.java
```

My current working copy of the compile configuration looks like this but am trying multiple
different versions.
```
<plugin>
	<groupId>org.apache.maven.plugins</groupId>
	<artifactId>maven-compiler-plugin</artifactId>
	<version>3.8.1</version>
	<executions>
		<execution>
			<id>java11-main</id>
			<phase>compile</phase>
			<goals>
				<goal>compile</goal>
			</goals>
			<configuration>
				<release>11</release>
				<jdkToolchain>
					<version>11</version>
				</jdkToolchain>
				<compileSourceRoots>
					<compileSourceRoot>${project.basedir}/src/main/java11</compileSourceRoot>
				</compileSourceRoots>
				<multiReleaseOutput>true</multiReleaseOutput>
			</configuration>
		</execution>
		<execution>
			<id>java11-test</id>
			<phase>test-compile</phase>
			<goals>
				<goal>testCompile</goal>
			</goals>
			<configuration>
				<release>11</release>
				<jdkToolchain>
					<version>11</version>
				</jdkToolchain>
				<compileSourceRoots>
					<compileSourceRoot>${project.basedir}/src/test/java11</compileSourceRoot>
				</compileSourceRoots>
				<multiReleaseOutput>true</multiReleaseOutput>
			</configuration>
		</execution>
	</executions>
</plugin>
```

The java11-tests configuration for multiReleaseOutput appears to be ignored as java 1.8 is
being compiled into `target/test-classes` and then it's recompiled using java 11 also into
`target/test-classes`

So when surefire executes using java 1.8 I get;
```
[INFO] -------------------------------------------------------
[INFO]  T E S T S
[INFO] -------------------------------------------------------
[ERROR] <<<TestClass>>> has been compiled by a more recent version of the
Java Runtime (class file version 55.0), this version of the Java Runtime only recognizes class
file versions up to 52.0
```

Because I'm creating jar's with base version 1.8 and additional java 11 classes, i need to
test against java 1.8 and execute again using java 11 to check no regression issues.

Adding support for multiReleaseOutput or testMultiReleaseOutput, might solve the issue or
I might still have issues to resolve.




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

Mime
View raw message