Building Loom from Maven

Lutz Horn code at lhorn.de
Thu Aug 4 16:02:08 UTC 2022


Hi,

Am 04.08.22 um 02:33 schrieb eric at kolotyluk.net:
> Has anyone had any success using Structured Concurrency from JDK 19?

Using 19.ea.33-open from SDKMAN, this makes `mvn compile` work:

```
<plugin>
   <groupId>org.apache.maven.plugins</groupId>
   <artifactId>maven-compiler-plugin</artifactId>
   <version>3.8.1</version>
   <configuration>
     <release>19</release>
     <compilerArgs>
       <arg>--enable-preview</arg>
       <arg>--add-modules</arg>
       <arg>jdk.incubator.concurrent</arg>
     </compilerArgs>
   </configuration>
</plugin>
```

Note that `--add-modules jdk.incubator.concurrent` ist split on *two* 
`arg`s.


Strangely, I fail to run `mvn test` using the following configuration of 
the `maven-surefire-plugin` which worked with the old Loom preview build 
19.ea.5.lm-open.

```
<configuration>
   <argLine>--enable-preview --add-modules 
jdk.incubator.concurrent</argLine>
</configuration>
```

`mvn test-compile` works but `mvn test` fails like this:

```
java.lang.NoSuchMethodError: 'void 
jdk.incubator.concurrent.StructuredTaskScope$ShutdownOnFailure.join()'
```

Both `main` and `test` can be compiled but running the tests fails.

Lutz


More information about the loom-dev mailing list