EC2 서버, 배포시 build 오류

JEONG SUJIN·2023년 1월 10일
0

개발 에러모음집

목록 보기
2/5

./mvnw build 입력시 빌드시 오류 코드..

Warning: JAVA_HOME environment variable is not set.
[INFO] Scanning for projects...

//생략



[INFO] 
[INFO] --------------------------< com.example:blog >--------------------------
[INFO] Building blog 0.0.1-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  13.788 s
[INFO] Finished at: 2023-01-10T18:56:13Z
[INFO] ------------------------------------------------------------------------
[ERROR] Unknown lifecycle phase "build". You must specify a valid lifecycle phase or a goal in the format <plugin-prefix>:<goal> or <plugin-group-id>:<plugin-artifact-id>[:<plugin-version>]:<goal>. Available lifecycle phases are: validate, initialize, generate-sources, process-sources, generate-resources, process-resources, compile, process-classes, generate-test-sources, process-test-sources, generate-test-resources, process-test-resources, test-compile, process-test-classes, test, prepare-package, package, pre-integration-test, integration-test, post-integration-test, verify, install, deploy, pre-clean, clean, post-clean, pre-site, site, post-site, site-deploy. -> [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/LifecyclePhaseNotFoundException
[ec2-user@ip-172-31-32-64 Blog_JPA]$ 

Maven 프로젝트는 빌드 옵션을 정해주어야지만 빌드가 가능하다는 구글링의 결과로..

install
pom.xml에 이 문구를 태그 안에 넣어주는 것으로 오류는 해결된다는 말에
수정하고 깃에 다시 업로드 하고
다시 터미널창에서

$ chmod +x ./mvnw #권한변경
$ ./mvnw clean package 
$ rm -rf Blog_JPA #디렉토리삭제

입력했더니 오류코드가 변경되었다..다행이다 코드가 변경된거면 뭐라도 바뀐건 맞으니까..😂

[INFO] Changes detected - recompiling the module!
[INFO] Compiling 32 source files to /home/ec2-user/apps/Blog_JPA/target/classes
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR : 
[INFO] -------------------------------------------------------------
[ERROR] /home/ec2-user/apps/Blog_JPA/src/main/java/com/mysite/project/test/EncTest.java:[3,29] package org.junit.jupiter.api does not exist
[ERROR] /home/ec2-user/apps/Blog_JPA/src/main/java/com/mysite/project/test/EncTest.java:[9,10] cannot find symbol
  symbol:   class Test
  location: class com.mysite.project.test.EncTest
[INFO] 2 errors 
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  01:27 min
[INFO] Finished at: 2023-01-10T19:30:17Z
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.10.1:compile (default-compile) on project blog: Compilation failure: Compilation failure: 
[ERROR] /home/ec2-user/apps/Blog_JPA/src/main/java/com/mysite/project/test/EncTest.java:[3,29] package org.junit.jupiter.api does not exist
[ERROR] /home/ec2-user/apps/Blog_JPA/src/main/java/com/mysite/project/test/EncTest.java:[9,10] cannot find symbol
[ERROR]   symbol:   class Test
[ERROR]   location: class com.mysite.project.test.EncTest
[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
[ec2-user@ip-172-31-32-64 Blog_JPA]$ 

다시계속오류가

Unknown lifecycle phase "build". You must specify a valid lifecycle phase or a goal in the format <plugin-prefix>:<goal> or <plugin-group-id>:<plugin-artifact-id>[:<plugin-version>]:<goal>. Available lifecycle phases are: validate, initialize, generate-sources, process-sources, generate-resources, process-resources, compile, process-classes, generate-test-sources, process-test-sources, generate-test-resources, process-test-resources, test-compile, process-test-classes, test, prepare-package, package, pre-integration-test, integration-test, post-integration-test, verify, install, deploy, pre-clean, clean, post-clean, pre-site, site, post-site, site-deploy. -> [Help 1]

프로젝트pom.xml

<goalPrefix>somePrefix</goalPrefix> //추가  

./mvnw clean package

test는 성공했지만 빌더는 오류

maven 빌더시 Goals입력란에 package 라고 입력하니깐 빌드 성공 ! !
그리고 AWS 창키고 명령어 입력하면 접속 완료 ✨

profile
기록하기

0개의 댓글