gradle implementation vs api 차이
·
Tech/Gradle
implementation의존성을 내부적으로만 사용다른 모듈에 전이되지 않음 // Module Adependencies { implementation 'com.google.gson:gson:2.8.9'}// Module B가 Module A를 의존할 때dependencies { implementation project(':moduleA') // Module B는 Gson을 직접 사용할 수 없음 // Gson이 필요하면 명시적으로 추가해야 함} api의존성을 외부에 노출다른 모듈에 전이됨// Module Adependencies { api 'com.google.gson:gson:2.8.9'}// Module B가 Module A를 의존할 때dependencies { imp..
bootJar,jar 활성,비활성화 (구)/(신) 코드
·
Tech/Gradle
구tasks.getByName("bootJar") { enabled = true}tasks.getByName("jar") { enabled = false} 특징타입 미지정: DSL 안에서 enabled 같은 속성을 설정할 수 있지만 타입 안전하지 않음Eager 방식: 태스크를 즉시 조회 및 구성 -> 빌드 성능에 악영향을 줄 수 있음Gradle 5.1+부터 권장되는 스타일 신import org.springframework.boot.gradle.tasks.bundling.BootJartasks.named("bootJar") { enabled = true}tasks.named("jar") { enabled = false}특징타입 안전: BootJar 타입으로 지정되므로 intellij..
git submodule 추가후 빌드시 resources 폴더에 yml 추가
·
Tech/Gradle
구글링해서 조사해보면 설정방법은 많이 나오니 생략.. 내가 2~3 시간째 삽질한걸 기록 processResources.dependsOn('copySecret') task copySecret(type: Copy) { from './submodule/application-aws-s3.yml' //submoduole에 추가한 노출되면 안되는 파일 into './src/main/resources' //build시 from에 지정한 경로의 파일을 복사할 위치 } 계속 구글링 하다보면 여기까지 설정한 자신을 볼 수 있다. 문제는 gradle에서 아무리 build하고 jar파일을 까봐도 yml이 없었음;; gradle을 리로드 하면 task {작업명} 으로 입력한 copySecret가 other 쪽에 추가된걸 확인할..
SpirngBoot 기준 Gradle 멀티 모듈 세팅
·
Tech/Gradle
gradle init settings.gradle 설정 /* * This file was generated by the Gradle 'init' task. * * The settings file is used to specify which projects to include in your build. * * Detailed information about configuring a multi-project build in Gradle can be found * in the user manual at https://docs.gradle.org/6.8.3/userguide/multi_project_builds.html */ rootProject.name = 'security' ["comp", "web", "s..