Skip to content

Instantly share code, notes, and snippets.

@andromedarabbit
Last active October 30, 2022 08:13
Show Gist options
  • Star 16 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save andromedarabbit/d683f8cfd55dec2f3357 to your computer and use it in GitHub Desktop.
Save andromedarabbit/d683f8cfd55dec2f3357 to your computer and use it in GitHub Desktop.
자주 쓰는 Gradle 명령어

자주 쓰는 Gradle 명령어

단위 테스트 돌리기

gradle test

단위 테스트는 건너뛰고 빌드하기

grade build -x test

특정 하위프로젝트에 포함된 단위 테스트만 돌리기

gradle :subproject:test

특정 테스트 케이스만 돌리기

gradle test --tests *VerificationRepositoryTest*

특정 하위프로젝트에 속한 특정 테스트 케이스만 돌리기

gradle :subproject:test --tests *VerificationRepositoryTest*

특정 프로필을 활성화하기

이 기능은 다음과 같은 전제하에 작동한다.

  • Spring Boot를 사용한다.
  • 환경변수가 gradle을 통해 테스트 케이스까지 전달되도록 build.gradle 파일에 다음과 같은 코드를 추가한다.
    tasks.withType(Test) {
        systemProperties = System.getProperties()
    }

dev란 프로필을 활성화하고 빌드를 하려면

gradle -Dspring.profiles.active=dev build

애플리케이션 띄우기

gradle bootRun

또는

./gradlew build && java -jar ./gate/build/libs/gate-spring-0.0.1-SNAPSHOT.jar

dev 프로필로 서버를 띄우기

gradle -Dspring.profiles.active=dev bootRun

의존성 확인하기

루트 프로젝트의 의존성 확인하기

gradle -q dependencies

특정 하위프로젝트의 의존성 확인하기

gradle -q dependencies subproject:dependencies

@dailymartin
Copy link

안녕하세요. 도움되는 글이네요 :)

@nyeoni
Copy link

nyeoni commented Oct 26, 2022

깔끔한 정리 감사합니다 👍

@andromedarabbit
Copy link
Author

Java 개발을 요새 안 해서 아직도 잘 맞나 모르겠네요 :)

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