apache / apache/maven-compiler-plugin

[MCOMPILER-420] Support for testCompileSourceRoots to handle multiReleaseOutput

Open
#643 0 comments 0 reactions 0 assignees View on GitHub
enhancement priority:major
Dominant language
Java
Stars
261
Forks
191
Avg merge
1d 5h
Merged PRs (30d)
8

Description

**[John Patrick](https://issues.apache.org/jira/secure/ViewProfile.jspa?name=nhoj.patrick)** opened **[MCOMPILER-420](https://issues.apache.org/jira/browse/MCOMPILER-420?redirect=false)** and commented

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.

```xml

org.apache.maven.plugins
maven-compiler-plugin
3.8.1

java11-main
compile

compile

11

11

${project.basedir}/src/main/java11

true

java11-test
test-compile

testCompile

11

11

${project.basedir}/src/test/java11

true

```

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] <<>> 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.

---

**Affects:** 3.8.1

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the testCompile execution and multiReleaseOutput configuration, reproducing the shown Java 8/11 source layout and checking target/test-classes. Compare the output needed for Surefire runs on Java 8 and Java 11; done means Java 11 test classes no longer overwrite Java 8 test classes while both test runs work.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
build-system
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.