문서의 선택한 두 판 사이의 차이를 보여줍니다.
| 양쪽 이전 판 이전 판 다음 판 | 이전 판 | ||
|
springframework:springboot:jar_publish [2019/06/12 14:09] kwon37xi |
springframework:springboot:jar_publish [2019/06/12 14:24] (현재) kwon37xi [maven-publish plugin 사용 prod/dev 구분해서 release/snapshot 올리기] |
||
|---|---|---|---|
| 줄 19: | 줄 19: | ||
| ===== maven-publish plugin 사용 ===== | ===== maven-publish plugin 사용 ===== | ||
| + | * [[gradle: | ||
| <code groovy> | <code groovy> | ||
| 줄 51: | 줄 52: | ||
| // 불필요하게 publsh.dependsOn bootJar 를 붙일 경우 생성된 jar 에 의존성 *.jar 파일들이 추가가 안되는 형상이 있었음. | // 불필요하게 publsh.dependsOn bootJar 를 붙일 경우 생성된 jar 에 의존성 *.jar 파일들이 추가가 안되는 형상이 있었음. | ||
| + | </ | ||
| + | |||
| + | ===== maven-publish plugin 사용 prod/dev 구분해서 release/ | ||
| + | * '' | ||
| + | import java.time.LocalDateTime | ||
| + | import java.time.format.DateTimeFormatter | ||
| + | |||
| + | apply plugin: ' | ||
| + | apply plugin: " | ||
| + | |||
| + | def isProduction = Boolean.getBoolean(' | ||
| + | def buildDateTime = LocalDateTime.now().format(DateTimeFormatter.ofPattern(" | ||
| + | version = isProduction ? buildDateTime + " | ||
| + | |||
| + | def initializePublishing(String targetGroupId, | ||
| + | publishing { | ||
| + | publications { | ||
| + | zipUpload(MavenPublication) { | ||
| + | groupId targetGroupId | ||
| + | artifactId targetArtifactId | ||
| + | artifact project.bootJar | ||
| + | } | ||
| + | } | ||
| + | repositories { | ||
| + | maven { | ||
| + | credentials { | ||
| + | username ' | ||
| + | password ' | ||
| + | } | ||
| + | |||
| + | def releaseRepoUrl = ' | ||
| + | def snapshotRepoUrl = ' | ||
| + | url version.endsWith(' | ||
| + | } | ||
| + | } | ||
| + | } | ||
| + | } | ||
| + | |||
| + | ext { | ||
| + | initializePublishing = this.& | ||
| + | } | ||
| + | |||
| + | </ | ||
| + | * '' | ||
| + | apply from: ' | ||
| + | |||
| + | bootJar.enabled = true | ||
| + | jar.enabled = true | ||
| + | |||
| + | bootJar { | ||
| + | mainClassName = " | ||
| + | } | ||
| + | |||
| + | initializePublishing(' | ||
| </ | </ | ||