Help us understand the problem. What is going on with this article?

mavenのコンパイルjavaバージョンを指定する

More than 3 years have passed since last update.

mavenでコンパイルjavaバージョンを指定する方法です。
maven-compiler-pluginが参照しているプロパティ「maven.compiler.target」と「maven.compiler.source」を設定するだけです。

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>org.test</groupId>
    <artifactId>test</artifactId>
    <version>0.0.1-SNAPSHOT</version>

    <properties>
        <java.version>1.8</java.version>
        <maven.compiler.target>${java.version}</maven.compiler.target>
        <maven.compiler.source>${java.version}</maven.compiler.source>

    </properties>
</project>

maven compiler pluginのパラメータ
http://maven.apache.org/plugins/maven-compiler-plugin/compile-mojo.html

kz1202
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away