스프링 클라우드 컨트랙트 공식 레퍼런스를 한글로 번역한 문서입니다.
전체 목차는 여기에 있습니다.
목차
9.1.1. Cloning the repository on Windows
Windows에서 Spring Cloud Contract 프로젝트를 클론받는 경우, git 레포지토리의 일부 파일이 Windows 최대 파일 경로 제한인 255자를 초과해서 제대로 체크아웃받지 못할 수도 있다 (아마 일부만).
이 문제를 해결하려면 core.longPaths
속성을 true
로 설정해서 Spring Cloud Contract 레포지토리를 클론하면 된다.
core.longPaths
속성을 true
로 설정할 때에는 세 가지 옵션이 있다:
- 컴퓨터의 모든 사용자에 대해 변경사항을 적용한다 (이땐 관리자 권한이 필요하다):
git config --system core.longPaths true
git clone https://github.com/spring-cloud/spring-cloud-contract.git
- 현재 사용자에 대해서만 변경사항을 적용한다 (관리자 권한이 없어도 된다):
git config --global core.longPaths true
git clone https://github.com/spring-cloud/spring-cloud-contract.git
- 이번 레포지토리에서만 변경사항을 반영한다 (레포지토리를 어디에 클론받느냐에 따라 관리자 권한이 필요할 수도 있다):
git clone -c core.longPaths=true https://github.com/spring-cloud/spring-cloud-contract.git
소스 코드를 제대로 가져오려면 IDE에 필요한 모든 Groovy 플러그인이 설치되어 있어야 한다. 예를 들어 Intellij IDEA에서는 Eclipse Groovy Compiler 플러그인과 GMavenPlus Intellij 플러그인이 모두 설치돼 있어야 프로젝트를 제대로 임포트할 수 있다.
Spring Cloud Contract는 Docker 이미지를 빌드한다. Docker가 설치되어 있어야 한다.
오프라인 모드에서 빌드를 실행하려면 Maven 3.5.2 버전 이상이 설치되어 있어야 한다.
9.1.2. Project structure
Spring Cloud Contract 폴더의 구조는 다음과 같다:
├── config
├── docker
├── samples
├── scripts
├── specs
├── spring-cloud-contract-dependencies
├── spring-cloud-contract-shade
├── spring-cloud-contract-starters
├── spring-cloud-contract-stub-runner
├── spring-cloud-contract-stub-runner-boot
├── spring-cloud-contract-tools
├── spring-cloud-contract-verifier
├── spring-cloud-contract-wiremock
└── tests
프로젝트 구조에서 가장 최상위에 있는 폴더에 대해 설명해보면:
config
: Spring Cloud Release Tools의 자동 배포를 위한 설정을 담고 있는 폴더docker
: 도커 이미지들을 포함하고 있는 폴더scripts
:Spring Cloud Contract
를 메이븐, 그래들을 이용해 빌드하고 테스트하기 위한 스크립트specs
: Contract DSL을 위한 specification들을 포함하고 있는 폴더spring-cloud-contract-dependencies
: Spring Cloud Contract BOMspring-cloud-contract-shade
: 여러 플러그인에서 사용하는 통합shaded 의존성spring-cloud-contract-starters
: Spring Cloud Contract Starter들이 포함돼 있다spring-cloud-contract-spec
: specification 모듈들이 포함돼있다 (Contract 개념 포함)spring-cloud-contract-stub-runner
: Stub Runner 관련 모듈들이 포함돼있다spring-cloud-contract-stub-runner-boot
: Stub Runner Boot 애플리케이션이 포함돼있다spring-cloud-contract-tools
:Spring Cloud Contract Verifier
를 위한 그래들, 메이븐 플러그인spring-cloud-contract-verifier
:Spring Cloud Contract Verifier
의 핵심 기능spring-cloud-contract-wiremock
: WireMock과 관련된 모든 기능tests
: 다양한 메시지 처리 기술들을 위한 통합 테스트
9.1.3. Commands
Maven 플러그인과 핵심 기능을 함께 빌드하려면 다음 명령어를 실행해라:
./mvnw clean install -P integration
위 함수를 호출하면 코어 모듈과, Maven 플러그인, Gradle 플러그인이 빌드된다.
그래들 플러그인만 빌드하려면 아래 명령어를 실행하면 된다:
cd spring-cloud-contract-tools/spring-cloud-contract-gradle-plugin
./gradlew clean build
9.1.4. Helpful scripts
프로젝트를 빌드할 때 유용할만한 스크립트를 몇 가지 제공한다.
프로젝트를 병렬로 빌드하려면 (기본적으로 코어를 4개 사용하지만 변경할 수 있다), 다음 명령어를 실행해라:
./scripts/parallelBuild.sh
코어 8개를 사용하려면 다음 명령어를 실행해라:
CORES=8 ./scripts/parallelBuild.sh
통합 테스트 없이 프로젝트를 빌드하려면 (기본적으로 하나의 코어를 사용한다), 다음 명령어를 실행해라:
./scripts/noIntegration.sh
코어 8개를 사용하려면 다음 명령어를 실행해라:
CORES=8 ./scripts/noIntegration.sh
문서를 생성하려면 (루트 프로젝트 문서와 maven 플러그인 문서), 다음 명령어를 실행해라:
./scripts/generateDocs.sh
Next :
9.2. Configuration Properties
Spring Cloud Contract 설정 프로퍼티 정리
전체 목차는 여기에 있습니다.