This repository has been archived by the owner on Nov 12, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
128 lines (109 loc) · 3.71 KB
/
build.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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
apply plugin: 'java-library'
apply plugin: "java"
apply plugin: 'maven'
apply plugin: "maven-publish"
apply plugin: 'signing'
apply plugin: 'eclipse'
import java.text.SimpleDateFormat
sourceCompatibility=1.6
targetCompatibility=1.6
tasks.withType(JavaCompile) {
options.encoding = "UTF-8"
}
tasks.withType(Javadoc) {
options.encoding = "UTF-8"
}
ext {
}
repositories {
mavenCentral()
maven {
url "http://maven.aliyun.com/nexus/content/groups/public/"
}
maven {
url ant.properties['user.home'] + "/.m2/repository"
}
}
task sourcesJar(type: Jar) {
classifier "sources"
from sourceSets.main.java.srcDirs
}
task javadocJar(type: Jar, dependsOn:javadoc) {
classifier = "javadoc"
from javadoc.destinationDir
}
artifacts {
archives jar
archives javadocJar
archives sourcesJar
}
publishing {
publications {
mavenJava(MavenPublication) {
from components.java
artifact (sourcesJar) {
classifier "source"
}
artifact (javadocJar) {
classifier "javadoc"
}
}
}
}
dependencies {
compile group: 'commons-logging', name: 'commons-logging', version: '1.1.1'
testCompile (
'org.testng:testng:6.8.21'
)
testCompile group: 'commons-io', name: 'commons-io', version: '2.5'
}
//为所有的jar包做数字签名
signing {
sign configurations.archives
}
uploadArchives {
repositories {
mavenDeployer {
//为Pom文件做数字签名
beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }
//指定项目部署到的中央库地址,UserName和Password就是Part 1中注册的账号。
//https://oss.sonatype.org/content/repositories/snapshots
//https://oss.sonatype.org/service/local/staging/deploy/maven2
repository(url:"https://oss.sonatype.org/service/local/staging/deploy/maven2") {
authentication(userName: 'yufei', password: 'yufeimvn101')
}
pom.project {
name project.name
packaging 'jar'
description 'baidu push client api with maven'
url 'https://github.com/featherfly/alipay-sdk.git'
scm {
url 'scm:[email protected]:featherfly/alipay-sdk.git'
connection 'scm:[email protected]:featherfly/alipay-sdk.git'
developerConnection '[email protected]:featherfly/alipay-sdk.git'
}
licenses {
license {
name 'The Apache Software License, Version 2.0'
url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
distribution 'repo'
}
}
developers {
developer {
id 'featherfly'
name 'Yufei'
}
}
}
}
}
}
jar {
manifest.attributes 'Build-Name': archivesBaseName
manifest.attributes 'Build-By': "zhong ji"
manifest.attributes 'Build-Tool' : "gradle " + gradle.gradleVersion
manifest.attributes 'Build-Jdk' : ant.properties['java.runtime.version']
manifest.attributes 'Build-At' : new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date());
manifest.attributes 'Bundle-License': 'http://www.apache.org/licenses/LICENSE-2.0'
}