You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Julia Boes <ju...@oracle.com> on 2020/08/21 15:53:03 UTC
testExcludes/Includes to compile test with different java version
Hi,
I have a question about testExcludes and testIncludes.
My project (a clone of the kryo repo) has 2 profiles, one for >= java 8
(j8) and one for >= java 14 (j14). A test file t has to be compiled with
java 14 --preview-enabled, so j8 compiles all test files except for t.
j14 should only compile t. The aim is that when java 14 is available,
all tests except for t are compiled without --preview-enabled and only t
is compiled with --preview-enabled. However, when run with java 14, j14
compiles t *and* recompiles all other tests.
I assume the testExcludes/testIncludes filters are not set correctly.
Any idea how to fix this?
path of t: /test/com/esotericsoftware/kryo/serializers/java14ge/t.java
Thanks!
Julia
original pom: https://github.com/EsotericSoftware/kryo/blob/master/pom.xml
addition to original pom:
<profiles>
<profile>
<id>java8ge</id>
<activation>
<jdk>[1.8,)</jdk>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<inherited>true</inherited>
<configuration>
<testExcludes>
<testExclude>**/java14ge/**</testExclude>
</testExcludes>
</configuration>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>java14ge</id>
<activation>
<jdk>[14,)</jdk>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<inherited>true</inherited>
<executions>
<execution>
<id>jdk14ge-testCompile</id>
<phase>test-compile</phase>
<goals>
<goal>testCompile</goal>
</goals>
<configuration>
<release>${java.vm.specification.version}</release>
<compilerArgs>
<arg>--enable-preview</arg>
</compilerArgs>
<testIncludes>
<testInclude>**/java14ge/**</testInclude>
</testIncludes>
<testExcludes>-->
<testExclude>com/**</testExclude>
</testExcludes>-->
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
$mvn clean test-compile
...
[INFO] --- maven-compiler-plugin:3.8.1:testCompile (default-testCompile)
@ kryo ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 41 source files to
/Users/jboes/IdeaProjects/kryo-mirror/target/test-classes
[INFO]
/Users/jboes/IdeaProjects/kryo-mirror/test/com/esotericsoftware/kryo/KryoTestCase.java:
Some input files use unchecked or unsafe operations.
[INFO]
/Users/jboes/IdeaProjects/kryo-mirror/test/com/esotericsoftware/kryo/KryoTestCase.java:
Recompile with -Xlint:unchecked for details.
[INFO]
[INFO] --- maven-compiler-plugin:3.8.1:testCompile (jdk14ge-testCompile)
@ kryo ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 42 source files to
/Users/jboes/IdeaProjects/kryo-mirror/target/test-classes
[INFO]
/Users/jboes/IdeaProjects/kryo-mirror/test/com/esotericsoftware/kryo/KryoTestCase.java:
Some input files use unchecked or unsafe operations.
[INFO]
/Users/jboes/IdeaProjects/kryo-mirror/test/com/esotericsoftware/kryo/KryoTestCase.java:
Recompile with -Xlint:unchecked for details.
[INFO]
/Users/jboes/IdeaProjects/kryo-mirror/test/com/esotericsoftware/kryo/serializers/java14ge/RecordSerializerTest.java:
/Users/jboes/IdeaProjects/kryo-mirror/test/com/esotericsoftware/kryo/serializers/java14ge/RecordSerializerTest.java
uses preview language features.
[INFO]
/Users/jboes/IdeaProjects/kryo-mirror/test/com/esotericsoftware/kryo/serializers/java14ge/RecordSerializerTest.java:
Recompile with -Xlint:preview for details.
[INFO]
...
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org