Nikitin Mikhail
Nikitin Mikhail

Reputation: 3019

project compile error release 8 requires target 1.8 release

I have an error Error:java: javacTask: source release 8 requires target release 1.8. I use 1.8 java, language level set to 8. The only thing I guess could be the reason is the line in the pom.xml file

         <configuration>
               <executable>${java.home}/bin/java</executable>
               <commandlineArgs>${runfx.args}</commandlineArgs>
         </configuration>

here the line

 <commandlineArgs>${runfx.args}</commandlineArgs>

is red and what to do with this I can't manage to get.

Upvotes: 0

Views: 3129

Answers (1)

Powerlord
Powerlord

Reputation: 88796

To set the compiler version in Maven, you would have something that looks like this in your pom.xml file:

<build>
    <pluginManagement>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.3</version>
                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                </configuration>
            </plugin>
        </plugins>
    </pluginManagement>
</build>

3.3 is the latest Maven Compiler Plugin version. I assumed it was needed for Java 8 support.

This is the same as setting the -source and -target compiler options.

Upvotes: 1

Related Questions