Compile and execute a JDK preview feature with Maven

Step 1 One can make use of the following maven configurations to compile the code using the –enable-preview along with –release 12+ (e.g. 13, 14, 15) argument. <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>3.8.0</version> <configuration> <release>12</release> <!– <release>13/14/15</release> –> <compilerArgs>–enable-preview</compilerArgs> </configuration> </plugin> <!– This is just to make sure the class is set as main class … Read more