====== Gradle Maven Deployment ======
* [[http://www.gradle.org/docs/current/userguide/artifact_management.html|Chapter 51. Publishing artifacts]]
* [[http://www.gradle.org/docs/current/userguide/maven_plugin.html|Chapter 52. The Maven Plugin]]
* [[https://github.com/bmuschko/gradle-nexus-plugin|bmuschko/gradle-nexus-plugin]]
* [[https://github.com/researchgate/gradle-release|Gradle Release]]
* [[https://vtorosyan.github.io/gradle-s3-private-repo/|Hosting a private repo on S3 (Gradle tricks)]] : Gradle 2.4 부터 s3 지원
* [[https://dzone.com/articles/how-to-upload-a-list-of-jars-into-nexus-or-artifac|Gradle: Upload a List of JARs Into Nexus/Artifactory - DZone Java]]
===== 기본 설정 =====
apply plugin: 'maven'
// ....
project.version = '1.0' : version
project.group = 'kr.pe.kwonnam.blah' // groupId
// project.name이 artifactId 가 되어줌.
uploadArchives {
repositories {
mavenDeployer {
repository(url: 'http://your.maven.repository.com/nexus/content/repositories/releases/') {
authentication(userName: '계정명', password: '비밀번호')
}
snapshotRepository(url: 'http://your.maven.repository.com/nexus/content/repositories/snapshot/') {
authentication(userName: '계정명', password: '비밀번호')
}
}
}
}
// 소스와 JavaDoc 배포를 위한 작업
task sourcesJar(type: Jar, dependsOn: classes) {
classifier = 'sources'
from sourceSets.main.allSource
}
task javadocJar(type: Jar, dependsOn: javadoc) {
classifier = 'javadoc'
from javadoc.destinationDir
}
artifacts {
archives sourcesJar
archives javadocJar
}
* 버전명에 ''-SNAPSHOT''이 붙어있으면 snapshotRepository로 들어간다.
* artifactID는 프로젝트 이름으로 설정된다.
===== 배포 =====
# 로컬 저장소(~/.m2/repository)로 설치
gradle install
# 원격 저장소에 업로드
gradle uploadArchives