-
Notifications
You must be signed in to change notification settings - Fork 26
/
maven.gradle
39 lines (35 loc) · 1.63 KB
/
maven.gradle
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
apply plugin: 'maven'
project.ext {
setUploadArchives = { project, groupId, artifactId, version, snapshot ->
project.uploadArchives {
repositories {
mavenDeployer {
// 是否快照版本
def versionName = version
def isSnapshot = Boolean.valueOf(snapshot)
if (isSnapshot) {
versionName += "-SNAPSHOT"
}
// 组件信息
pom.groupId = groupId
pom.artifactId = artifactId
pom.version = versionName
// 快照仓库路径(仓库地址较稳定,不声明为参数)
snapshotRepository(url: uri(MAVEN_SNAPSHOT_URL)) {
authentication(userName: MAVEN_USERNAME, password: MAVEN_USERNAME)
}
// 发布仓库路径
repository(url: uri(MAVEN_RELEASE_URL)) {
authentication(userName: MAVEN_USERNAME, password: MAVEN_USERNAME)
}
println("###################################"
+ "\nuploadArchives = " + pom.groupId + ":" + pom.artifactId + ":" + pom.version + "." + pom.packaging
+ "\nrepository =" + (isSnapshot ? MAVEN_SNAPSHOT_URL : MAVEN_RELEASE_URL)
+ "\n###################################"
)
}
}
}
}
}
setUploadArchives(project, MAVEN_GROUP_ID, MAVEN_ARTIFACTID, MAVEN_VERSION, MAVEN_IS_SNAPSHOT)