You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Nir Lisker (Jira)" <ji...@apache.org> on 2022/06/05 23:00:00 UTC
[jira] [Created] (SUREFIRE-2093) --enable-preview is not recognized
Nir Lisker created SUREFIRE-2093:
------------------------------------
Summary: --enable-preview is not recognized
Key: SUREFIRE-2093
URL: https://issues.apache.org/jira/browse/SUREFIRE-2093
Project: Maven Surefire
Issue Type: Bug
Components: Maven Surefire Plugin
Affects Versions: 3.0.0-M6
Reporter: Nir Lisker
pom:
{code:java}
<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>com.my.example</groupId>
<artifactId>Testing</artifactId>
<version>0.0.1-SNAPSHOT</version> <properties>
<maven-compiler-plugin-version>3.10.1</maven-compiler-plugin-version>
<maven-surefire-plugin-version>3.0.0-M6</maven-surefire-plugin-version>
<java-version>18</java-version>
<junit-version>5.8.2</junit-version>
</properties> <dependencyManagement>
<dependencies>
<dependency>
<groupId>org.junit</groupId>
<artifactId>junit-bom</artifactId>
<version>${junit-version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement> <dependencies>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<scope>test</scope>
</dependency>
</dependencies> <build>
<finalName>Testing</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>${maven-compiler-plugin-version}</version>
<configuration>
<release>${java-version}</release>
<compilerArgs>
<arg>--enable-preview</arg>
<arg>--add-modules=jdk.incubator.foreign</arg>
</compilerArgs>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>${maven-surefire-plugin-version}</version>
<configuration>
<argLine>--enable-preview</argLine>
<argLine>--add-modules=jdk.incubator.foreign</argLine>
<argLine>--enable-native-access=ALL-UNNAMED</argLine>
</configuration>
</plugin>
</plugins>
</build>
</project> {code}
Under src/test/java add this class:
{code:java}
package com.my.example.simple;import org.junit.jupiter.api.Test;import jdk.incubator.foreign.ResourceScope;public class ExampleTest { @Test
public void test1() {
try (ResourceScope scope = ResourceScope.newConfinedScope()) {
} catch (Throwable e) {
e.printStackTrace();
throw e;
}
}
}{code}
Run Maven test.
The project compiles fine. The tests fail with:
Preview features are not enabled for com/my/example/simple/ExampleTest (class file version 62.65535). Try running with '--enable-preview'
--enable-preview is already specified.
--
This message was sent by Atlassian Jira
(v8.20.7#820007)