-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpublish.gradle
36 lines (34 loc) · 943 Bytes
/
publish.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
apply plugin: 'maven-publish'
//打包
java {
withJavadocJar()
withSourcesJar()
}
//上传至nexus
publishing {
publications {
// publishProject 为自定义名称,可写多个发布任务
publishProject(MavenPublication) {
groupId project.group
artifactId project.name
version project.version
from components.java // 发布 jar 包
}
}
repositories {
maven {
//指定要上传的 maven 私服仓库
if (project.version.endsWith('-SNAPSHOT')) {
url = "http://nexus.xxx.xx/repository/maven-snapshots/"
} else {
url = "http://nexus.xxx.xx/repository/maven-releases/"
}
allowInsecureProtocol = true
//认证用户和密码
credentials {
username 'xx'
password 'xx'
}
}
}
}