Java Compiler Version for Maven Spring Boot Product Build

Here , it says that Spring Boot 1.5.2.RELEASE requires Java 7 or later; and Java 1.6 as the default compiler level.

So will this difference cause a problem?

+5
source share
3 answers

You can specify the JDK to build Maven using the following plugin;

Apache Maven compiler plugin .

<project>
  ...
  <build>
    <pluginManagement>
      <plugins>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-compiler-plugin</artifactId>
          <version>3.6.1</version>
          <configuration>
            <source>1.7</source>
            <target>1.7</target>
          </configuration>
        </plugin>
      </plugins>
    </pluginManagement>
  </build>
  ...
</project>

Trying to compile Java1.7 code with JDK 1.6 will really cause problems.

You can also use the property java.versionto indicate your version of Java, as described here , you can see the usage maven-compiler-pluginin spring-boot-parentpom.xml, here

.

+6

, . .

bureaquete Apache Maven, POM:

<properties>
    <maven.compiler.source>1.7</maven.compiler.source>
    <maven.compiler.target>1.7</maven.compiler.target>
</properties>

, Java 7.

+9

, Maven Eclipse IDE, JDK Maven:

Eclipse IDE " …" → " ". Maven . "JRE" " JRE" JDK. , JRE… .

0
source

Source: https://habr.com/ru/post/1672323/


All Articles