LoginSignup
23
22

More than 5 years have passed since last update.

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

Last updated at Posted at 2015-09-17

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

23
22
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
23
22