반응형

@notepad_jj2

츄르사려고 코딩하는집사입니다.


Maven Build 에러 : Fatal error compiling: tools.jar not found: C:\Program Files\Java\jre1.8.0_241\..\lib\tools.jar -> [Help 1] 문제 해결 방법

 

이클립스(Eclipse)에서 스프링 프레임워크(Spring FrameWork, STS) 를 사용하면서 Maven의 자바(Java), 스프링(Spring) 버전을 수정하고 Maven Build를 했더니 아래와 같이 문제가 발생했다.

Fatal error compiling: tools.jar not found: C:\Program Files\Java\jre1.8.0_241\..\lib\tools.jar -> [Help 1]

 

에러 콘솔 창에는 아래와 같이 출력이 된다.

[INFO] Scanning for projects...
[INFO] 
[INFO] ---------------------------< YG.spring:test >---------------------------
[INFO] Building YGTest 1.0.0-BUILD-SNAPSHOT
[INFO] --------------------------------[ war ]---------------------------------
[INFO] 
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ test ---
[WARNING] Using platform encoding (MS949 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 1 resource
[INFO] 
[INFO] --- maven-compiler-plugin:2.5.1:compile (default-compile) @ test ---
[WARNING] File encoding has not been set, using platform encoding MS949, i.e. build is platform dependent!
[INFO] Compiling 1 source file to C:\test\new\YGTest\target\classes
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  0.622 s
[INFO] Finished at: 2021-10-14T09:00:34+09:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.5.1:compile (default-compile) on project test: Fatal error compiling: tools.jar not found: C:\Program Files\Java\jre1.8.0_241\..\lib\tools.jar -> [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/MojoExecutionException

 

이 문제는 C:\Program Files\Java\jre1.8.0_241\..\lib\tools.jar 이 경로에 있는 tools.jar 파일을 찾지 못해 발생하는 에러다.

 

이 문제를 해결하는 방법은 아래와 같다.

 

1. [Window] - [Preferences]에 들어간다.

 

2. [Preferences]에서 [Java] - [Installed JREs] - [Edit] 를 누른다.

 

3. [Add External JARs...]를 누른다.

 

4. 경로에서 tools.jar를 넣어준다.

 

5. Finish를 누르고, Apply and Close를 누른다.

 

6. 그리고 나서, 아래와 같이 해준다.

  • [Project] - [Clean]
  • [프로젝트 오른쪽 클릭] - [Run As] - [Maven Clean]
  • [프로젝트 오른쪽 클릭] - [Run As] - [Maven Build]

 

7. 그러면 BUILD에 성공했다고 아래와 같이, 콘솔창이 나온다.

[INFO] Scanning for projects...
[INFO] 
[INFO] ---------------------------< YG.spring:test >---------------------------
[INFO] Building YGTest 1.0.0-BUILD-SNAPSHOT
[INFO] --------------------------------[ war ]---------------------------------
[INFO] 
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ test ---
[WARNING] Using platform encoding (MS949 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 1 resource
[INFO] 
[INFO] --- maven-compiler-plugin:2.5.1:compile (default-compile) @ test ---
[WARNING] File encoding has not been set, using platform encoding MS949, i.e. build is platform dependent!
[INFO] Compiling 1 source file to C:\test\new\YGTest\target\classes
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  1.542 s
[INFO] Finished at: 2021-10-14T09:21:19+09:00
반응형
  • 네이버 블러그 공유하기
  • 네이버 밴드에 공유하기
  • 페이스북 공유하기
  • 카카오스토리 공유하기