5

I am trying to create web app using spring boot, maven and java 12. I started the project with spring-boot-starter-parent version 2.1.5.RELEASE, java 12 and maven-compiler-plugin version 3.8.1. I tried to run ./mvnw package but i got this error:

Fatal error compiling: invalid target release: 12

After that i wrote on the internet that maven compiler plugin uses old dependency for asm and i should specify new version of it. So i selected the latest version of asm which is 7.1 and i added configuration tag with properties release 12 and compilerArgs --enable-preview for java 12. The result was:

Fatal error compiling: invalid flag: --release

The next thing that i tried was to use spring boot starter parent version 2.2.0.M3 and to specify the repository to find milestone versions of spring from http://repo.spring.io/milestone. Unfortunately i got the same result. Any ideas?

3

1 Answer 1

7

Trying with previous versions to spring boot 2.2.0.MX it also failed for me, but I have managed to make it work with 2.2.0.M6 including some plugins and tweaking them to adapt with the preview features like:

       <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <configuration>
                    <arguments>--enable-preview</arguments>
                    <jvmArguments>--enable-preview</jvmArguments>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>2.22.2</version>
                <configuration>
                    <argLine>--enable-preview</argLine>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.8.1</version>
                <configuration>
                    <compilerArgs>--enable-preview</compilerArgs>
                </configuration>
            </plugin>
       </plugins>    

This is now working with Java 13.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.