1

I am building a sample for maven spring boot, using java 9, getting compilation error while doing clean package using maven build plugin.

  • java build path : selected JRE 9
  • Java compiler : Enabled Project specific settings (selected as 9)
  • Eclipse preferences : Java -> Installed JRE -> Selected JRE 9
  • Run Configuration : Workplace default JRE (selected java 9)

Don't know from where maven is picking 1.6

pom.xml

<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 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>com.jaggs.springboot</groupId>
    <artifactId>HelloSpringBoot</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <packaging>jar</packaging>

    <name>HelloSpringBoot</name>
    <url>http://maven.apache.org</url>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <java.ersion>1.9</java.ersion>
    </properties>

    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>1.5.2.RELEASE</version>
    </parent>

    <dependencies>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <configuration>
                    <source>1.9</source>
                    <target>1.9</target>
                </configuration>
            </plugin>
        </plugins>
    </build>

</project>

Build Error Logs

2
  • Can you share your pom.xml? Commented Dec 20, 2017 at 17:47
  • 1
    shared just now, thanks. Commented Dec 20, 2017 at 18:01

1 Answer 1

2

Since you don't specify the maven-compiler-plugin explicitly, it's definition is taken from your project's parent's, spring-boot-starter-parent.

The maven-compiler-plugin's version there is defined by the ${java.version} property which you've attempted to override, but unfortunately had a typo - you set java.ersion instead of java.version (note the missing v). Thus, the plugin's default of 1.6 is used. Just fix the typo, and you should be fine:

<java.version>1.9</java.version>
<!-- -^-----------------^ -->
Sign up to request clarification or add additional context in comments.

1 Comment

ahhhh... such a silly mistake :-(, yes it worked and build is success, thanks for the explanation.

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.