이 시리즈는 이동욱 님의
스프링 부트와 AWS로 혼자 구현하는 웹 서비스
를 읽고 공부한 내용을 정리하는 용도로 작성되었습니다.
build.gradle
에 아래 코드를 추가한다.
buildscript {
// springBootVersion 전역변수 생성 후 '2.1.9.RELEASE' 할당
// spring-boot-gradle-plugin의 2.1.9.RELEASE를 의존성으로 받겠다는 뜻
ext {
springBootVersion = '2.1.9.RELEASE'
}
repositories {
mavenCentral()
jcenter()
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
}
}
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'org.springframework.boot'
apply plugin: 'io.spring.dependency-management'
repositories {
mavenCentral()
jcenter()
}
repositories: 의존성 라이브러리들을 어떤 원격 저장소에서 받을지 결정한다.
dependencies {
compile('org.springframework.boot:spring-boot-starter-web')
testCompile('org.springframework.boot:spring-boot-starter-test')
}
Ctrl
+ Space
: 의존성 자동완성"org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}"
의 버전을 따라가도록 설정해야 각 라이브러리들의 버전 관리가 한 곳에 집중되고, 버전 충돌 문제도 해결할 수 있다.Ctrl
+ Shift
+ A
> share project on github 클릭
깃허브에 로그인 한 뒤, 저장소 이름을 설정하고 Share
를 클릭하면 GitHub 저장소와 동기화가 진행된다.
깃허브 로그인 할 때
invalid authentication data
라는 메시지와 함께 로그인이 되지 않는다면 깃허브의Settings
->Developer settings
->Personal access tokens
에서 새로운 토큰을 생성한 뒤, 토큰을 사용해서 로그인하면 된다. 📁
❗ 만약 토큰으로도 동일한 에러가 발생한다면 인텔리제이의Settings
->Version Control
->Github
에 들어가 계정을 추가해주면 된다.
아래 6가지 파일을 커밋 후 푸시해준다.
gradle-wrapper.jar
gradle-wrapper.properties
build.gradle
gradlew
gradlew.bat
settings.gradle
Ctrl
+ Shift
+ A
> Plugins > .ignore
클릭 후 설치한다..ignore 플러그인의 기능
- 파일 위치 자동완성
- ignore 처리 여부 확인
- .gitignore, .npmignore, .dockerignore 등 다양한 ignore 파일 지원
IntelliJ를 재시작하면 플러그인이 적용된다.
프로젝트 이름 클릭 + Alt
+ Insert
> .gitignore File
클릭
생성된 .gitignore
파일에 .gradle
과 .idea
를 추가한 뒤 .gitignore
파일을 커밋 후 푸시해준다.
Ctrl
+K
: git commit
Ctrl
+Shift
+K
: git push