본문 바로가기

개발

mvn package 실행시 Source option 5 is no longer supported. Use 6 or later. 에러발생

728x90
반응형

 

mvn package 실행시 자바컴파일이 실패되면서 jdk 1.6이상으로 사용하라고 에러 메세지 발생

error: Source option 5 is no longer supported. Use 6 or later.

[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  4.683 s
[INFO] Finished at: 2022-01-07T17:41:38+09:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.6.1:compile (default-compile) on project swt-play: Compilation failure: Compilation failure:
[ERROR] error: Source option 5 is no longer supported. Use 6 or later.
[ERROR] error: Target option 1.5 is no longer supported. Use 1.6 or later.
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException

 

이클립스 JRE 설정을 11버전으로 변경, pom.xml 설정에서 maven-compiler-plugin 설정을 변경하여도 해결이 안된다.

해결방법은 간단하다. 

pom.xml 에서 maven.compiler.source, maven.compiler.target 속성을 지정해주면 된다.

pom.xml - maven.compiler 설정

<properties>
	<java.version>11</java.version>
	<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
	<maven.compiler.source>11</maven.compiler.source>
	<maven.compiler.target>11</maven.compiler.target>
	<swt.version>4.3</swt.version>
	<swt.mainclass>com.wyleedp.swt.play.AppLauncher</swt.mainclass>
</properties>

 

메이븐에서 자바 컴파일을 실행할때 기본값이 1.5로 설정되어 있어 발생되는 사항으로 파악된다.

 

728x90
반응형