Maven compiler -source and -target 이란?

ASHAPPYASIKNOW·2022년 7월 19일
0

MAVEN/Gradle

목록 보기
2/2
post-thumbnail

-source, -target

현재 사용 중인 버전과 다른 버전으로 컴파일할 때 이 옵션을 사용할 수 있다.

주의: source, -target을 명시해도 그 버전으로 컴파일될 확률이 100%가 아니다. 그래서 현재 사용 버전과 컴파일 버전을 동일하게 사용하는 것이 제일 좋다.

만약 JDK 9 이상을 사용하고 있다면 -release option 사용하는 것이 좋다.


<project>
  [...]
  <build>
    [...]
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.10.1</version>
        <configuration>
          <source>1.8</source>
          <target>1.8</target>
        </configuration>
      </plugin>
    </plugins>
    [...]
  </build>
  [...]
</project>

REFERENCES

Setting the -source and -target of the Java Compiler

profile
36.9 It's good time to start something new

0개의 댓글