Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

p.303 deploy.sh 오류 #250

Closed
Wonseok1 opened this issue Feb 12, 2020 · 3 comments
Closed

p.303 deploy.sh 오류 #250

Wonseok1 opened this issue Feb 12, 2020 · 3 comments

Comments

@Wonseok1
Copy link

기존에 올라온 질문이 아닌지 먼저 검색해주세요!

가장 자주 나온 제보

어떤 오류인가요?

오류설명: gradlew를 하면 정상적으로 되는데 gradlew build를 하면 gradle이 5버전으로 되면서 오류가 발생합니다. 어떻게 해야하나요?

deploy.sh파일도 기존 step1 폴더에 만들었는데 그럼 git 명령어가 듣지 않아서 프로젝트 폴더 안으로 이동하였습니다.

이것으로 인해 deploy.sh파일이 실행되다 오류가 발생하여 진행하지 못하고 있습니다. 도와주세요

여기서 3일째에요 ㅜㅜ

프로젝트 주소

Github에 오류가 난 프로젝트를 올려주세요.
Github 주소를 작성해주지 않으시면 답변해드릴수가 없어요!

오류 로그

어떤 오류인지 캡쳐해주세요.

[ec2-user@won-EBook won-ebook]$ ./gradlew

Task :help

Welcome to Gradle 4.10.2.

To run a build, run gradlew ...

To see a list of available tasks, run gradlew tasks

To see a list of command-line options, run gradlew --help

To see more detail about a task, run gradlew help --task

For troubleshooting, visit https://help.gradle.org

BUILD SUCCESSFUL in 1s
1 actionable task: 1 executed
[ec2-user@won-EBook won-ebook]$ vi deploy.sh
[ec2-user@won-EBook won-ebook]$ ./gradlew build

Task :test

com.itzon.won.ebook.domain.posts.PostsRepositoryTest > 게시글저장불러오기 FAILED
java.lang.IllegalStateException
Caused by: org.springframework.beans.factory.support.BeanDefinitionOverrideException

com.itzon.won.ebook.domain.posts.PostsRepositoryTest > BaseTimeEntity등록 FAILED
java.lang.IllegalStateException
Caused by: org.springframework.beans.factory.support.BeanDefinitionOverrideException

com.itzon.won.ebook.web.HelloControllerTest > Hello리턴 FAILED
java.lang.IllegalStateException
Caused by: org.springframework.beans.factory.BeanCreationException
Caused by: org.springframework.beans.factory.BeanCreationException
Caused by: java.lang.IllegalArgumentException

com.itzon.won.ebook.web.HelloControllerTest > HelloDto리턴 FAILED
java.lang.IllegalStateException
Caused by: org.springframework.beans.factory.BeanCreationException
Caused by: org.springframework.beans.factory.BeanCreationException
Caused by: java.lang.IllegalArgumentException

com.itzon.won.ebook.web.IndexControllerTest > 메인페이지로딩 FAILED
java.lang.IllegalStateException
Caused by: org.springframework.beans.factory.support.BeanDefinitionOverrideException

com.itzon.won.ebook.web.PostsApiControllerTest > Posts_등록 FAILED
java.lang.IllegalStateException
Caused by: org.springframework.beans.factory.support.BeanDefinitionOverrideException

com.itzon.won.ebook.web.PostsApiControllerTest > Posts_수정 FAILED
java.lang.IllegalStateException
Caused by: org.springframework.beans.factory.support.BeanDefinitionOverrideException

8 tests completed, 7 failed

Task :test FAILED

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ':test'.

There were failing tests. See the report at: file:///home/ec2-user/~.app/step1/won-ebook/build/reports/tests/test/index.html

  • Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

  • Get more help at https://help.gradle.org

Deprecated Gradle features were used in this build, making it incompatible with Gradle 5.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/4.10.2/userguide/command_line_interface.html#sec:command_line_warnings

BUILD FAILED in 14s

--아래는 deploy.sh 파일 내용 입니다.------------------------------------------------------------------------------------------

#!/bin/bash

REPOSITORY=/home/ec2-user/app/step1
PROJECT_NAME=won-ebook

cd $REPOSITORY/$PROJECT_NAME/

echo "> Git Pull"

git pull

echo "> 프로젝트 빌드시작"

./gradlew build

echo "> step1 디렉토리로 이동"

cd $REPOSITORY

echo "> Build 파일 복사"

cp $REPOSITORY/$PROJECT_NAME/build/libs/*.jar $REPOSITORY/

echo "> 현재 구동중인 어플리케이션 pid 확인"

CURRENT_PID=$(pgrep -f ${PROJECT_NAME}*.jar)

echo "현재 구동중인 어플리케이션 pid: $CURRENT_PID"

if [ -z "$CURRENT_PID"]; then
echo "> 현재 구동중인 어플리케이션이 없으므로 종료하지 않습니다."
else
echo ">kill -15 $CURRENT_PID"
kill -15 $CURRENT_PID
sleep 5
fi

echo "> 새어플리케이션 배포"

JAR_NAME=$(ls -tr $REPOSITORY/ |grep *.jar | tail -n 1)

echo "> JAR Name: $JAR_NAME"

nohup java -jar $REPOSITORY/$JAR_NAME 2>&1 &

@Wonseok1
Copy link
Author

살려주세요...

@jojoldu
Copy link
Owner

jojoldu commented Feb 23, 2020

@Wonseok1./gradlew만 하는것은 아무런 작업이 아닙니다.
그래서 당연히 성공할수밖에 없고요 :)
deploy.sh 문제라고 하셨지만, 아마 로컬에서 ./gradlew test 하셔도 실패하실것 같습니다
(제가 해당 프로젝트를 받아서 실행하니 안되네요^^)

확인해보니 제책 221 페이지에서 제거해야된다고 했던 @EnableJpaAuditing 가 그대로 남아 있어서 테스트들이 안되었습니다.

Application.java 파일에 @EnableJpaAuditing 코드를 제거 혹은 주석처리 해주세요

image

이미 JpaConfig 에서 해당 어노테이션이 선언되어있으며, 왜 그래야하는지는 책에서 잘 설명하고 있어서 다시 보시면 좋을것 같습니다 :)

@jojoldu jojoldu closed this as completed Feb 23, 2020
@Wonseok1
Copy link
Author

친절한 답변 감사합니다. 처음부터 정독하겠습니다.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants