카테고리 없음

spring gradle project 빌드하고 EC2 에 살포시 얹어보기

lluna 2022. 2. 7. 14:15

1. 빌드 한 번 하기 어렵다.

 ./gradlew build

 

1.

오류 

permission denied

 

원인

권한문제

 

해결

chmod +x gradlew 

 

2.

오류

zsh: ./gradlew: bad interpreter: /bin/sh^M: no such file or directory

 

원인

window - linux 호환 문제

linux 에서 스크립트 실행할 때/bin/sh^M: bad interpreter: No such file or directory와 같은 에러 메시지가 나타날 때가 있다. 이것은 십중 팔구 윈도우에서 스크립트 파일을 만든 뒤, linux 에서 실행했기 때문에 나타나는 오류이다.정확히는 줄 끝 (줄바꿈)을 의미하는 개행문자가 달라서 발생하는 문제이다.

(참고)

Gradle 래퍼를 만드는 개발자만 Gradle을 로컬에 설치 해야 합니다 . Gradle이 준비되면 래퍼를 만드는 개발자라도 팀의 누구도 기본 Gradle을 필요로 하지 않습니다.

gradle wrapper

완료되면 다음 개발자는 Gradle을 다시 설치할 필요가 없습니다. 스크립트는 Gradle 폴더와 두 개의 스크립트 파일을 생성했습니다. 하나는 Windows용 gradlew.bat이고 다른 하나는 Linux용 gradlew입니다.

 

 

해결

쉘 스크립트 형식을 unix 로 변경

vi gradlew
:set ff=unix
:wq!

 

2. 살포시 EC2에 얹어보기

feat. 인간 젠킨스

1. 자바 설치

2. jar 실행

3. 백그라운드 실행

4. PID 확인하고 필요시 꺼주기 

 

사용가능한 자바 버젼 두 가지가 있다.

아래 두 개는 뭐가 다를까..

 

openjdk-8-jdk-headless/focal-updates,focal-security 8u312-b07-0ubuntu1~20.04 amd64
openjdk-8-jdk/focal-updates,focal-security 8u312-b07-0ubuntu1~20.04 amd64

 

 

 

https://deeplify.dev/back-end/spring/executable-jar

 

[spring boot/스프링] Spring boot jar 배포 하는 방법

스프링 부트 jar 실행 가능한 파일 만는 방법 및 실행하여 배포하는 방법에 대해서 소개합니다.

deeplify.dev

 

https://www.studytonight.com/post/solved-getting-error-while-executing-a-sh-file-binbashm-bad-interpreter

 

[SOLVED] Getting Error while executing a .sh file: /bin/bash^M: bad interpreter - Studytonight

If you are trying to run a shell script and getting the following error, /bin/bash^M: bad interpreter: No such file or directory You may think that this is a permission issue and might try running the chmod 777 command to provide all the permissions to the

www.studytonight.com

 

https://blog.gaerae.com/2016/02/remove-m-character-from-log-files.html

 

Uinx/Linux: ^M 개행 문자 삭제하는 방법

리눅스에서 간혹 ^M 개행 문자를 제거하고 싶을 때가 있습니다.리눅스에서 Ctrl + V + M 클릭하면 위와 같은 문자가 표시되며 이렇게 입력해야 위의 문자를 찾을 수 있습니다.

blog.gaerae.com