개발

vs code + spring boot + vue.js JRE, JDK 버전 다른 환경에서 오류

내공얌냠 2020. 11. 26. 09:30

상황

git 으로 자바 버전이 다른 환경(java 11 <> java 1.8) 에서 작업한 프로젝트를 clone 하고 실행을 해야하는 상황

$ ./mvnw spring-boot:run

라고 할 경우 

오류 내용

Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile (default-compile)

기본 클래스 org.apache.maven.wrapper.MavenWrapperMain을(를) 찾거나 로드할 수 없습니다.

Fatal error compiling: invalid target release

java bad source file file does not contain class

[Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

원인

jdk 버전이 다르기에 발생

처리 내용

java 11을 쓰는데 나는 1.8 을 써야하기에 pom.xml 에서 그렇게 바꿨다.

<!-- <properties>
		<java.version>11</java.version>
		<maven.compiler.source>11</maven.compiler.source>
		<maven.compiler.target>11</maven.compiler.target>
		<m2e.apt.activation>disabled</m2e.apt.activation>
	</properties> -->
    
	<properties>
		<java.version>1.8</java.version>
	</properties>

openjdk 11 을 설치하고 .bash_profile 파일 내의 path, vscode setting.json 파일 내의 java.home 에 바꿔보고 .m2/repository/org/apache 삭제해보고 여러 방법을 해보았는데 도저히 안되겠어서 저런 식으로 마무리했다.

자바버전 확인

/usr/libexec/java_home -V

 

References

stackoverflow.com/questions/42525139/maven-build-compilation-error-failed-to-execute-goal-org-apache-maven-plugins

 

Maven build Compilation error : Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compi

I have a maven project forked and cloned from a git repo onto my eclipse. It is build on Java 8. The first thing i do is perform a mvn clean install But I get following failure message: [INFO]

stackoverflow.com

stackoverflow.com/questions/17223536/failed-to-execute-goal-org-apache-maven-pluginsmaven-compiler-plugin2-3-2comp

 

Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.3.2:compile (default-compile)

I am using Maven 3.0.5 and Spring Tool Source 3.2 with Maven plugin installed. When I try to do 'Run As---> Maven install', I am getting the following error: [INFO] Scanning for projects... [INFO]...

stackoverflow.com

stackoverflow.com/questions/17223536/failed-to-execute-goal-org-apache-maven-pluginsmaven-compiler-plugin2-3-2comp

 

Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.3.2:compile (default-compile)

I am using Maven 3.0.5 and Spring Tool Source 3.2 with Maven plugin installed. When I try to do 'Run As---> Maven install', I am getting the following error: [INFO] Scanning for projects... [INFO]...

stackoverflow.com

pie001.github.io/entry/tech-note/0061/

 

Mac에서 OracleJDK를 삭제하고 OpenJDK 설치하기 + Tomcat 재설치 및 실행

Mac에서 OracleJDK를 삭제하고 OpenJDK 설치하기 + Tomcat 재설치 및 실행

pie001.github.io

 

 

728x90
반응형