forked from jovezhao/nest-plus
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpublish.gradle
76 lines (68 loc) · 2.53 KB
/
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
// ... 在最下面新增以下代码
apply plugin: 'maven-publish'
apply plugin: 'signing'
task sourcesJar(type: Jar) {
from sourceSets.main.allJava
classifier = 'sources'
}
task javadocJar(type: Jar) {
from javadoc
classifier = 'javadoc'
}
javadoc {
options{
encoding "UTF-8"
charSet 'UTF-8'
}
}
publishing {
publications {
mavenJava(MavenPublication) {
groupId project.group
artifactId project.name
version "${version}"
from components.java
artifact sourcesJar
artifact javadocJar
// https://docs.gradle.org/current/dsl/org.gradle.api.publish.maven.MavenPublication.html
pom {
name = "Nest-Plus"
description = "spring for nest"
url = "https://github.com/jovezhao/nest-plus"
licenses {
license {
name = "The Apache License, Version 2.0"
url = "http://www.apache.org/licenses/LICENSE-2.0.txt"
}
}
developers {
developer {
id = "jovezhao"
name = "zhaofujun"
email = "[email protected]"
}
}
scm {
connection = "scm:git:https://github.com/jovezhao/nest-plus"
developerConnection = "scm:git:https://github.com/jovezhao/nest-plus"
url = "https://github.com/jovezhao/nest-plus"
}
}
}
}
repositories {
maven {
def releasesRepoUrl = "https://oss.sonatype.org/service/local/staging/deploy/maven2"
def snapshotsRepoUrl = "https://oss.sonatype.org/content/repositories/snapshots"
// 如果version以SNAPSHOT结尾就会上传到快照仓库,如果不是就上传到release仓库
url = version.endsWith('SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl
credentials {
username = project.properties.NEXUS_USERNAME
password = project.properties.NEXUS_PASSWORD
}
}
}
}
signing {
sign publishing.publications.mavenJava
}