-
Notifications
You must be signed in to change notification settings - Fork 3
/
publish_maven.gradle
50 lines (42 loc) · 1.32 KB
/
publish_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
40
41
42
43
44
45
46
47
48
49
50
//将源代码打包进aar
task androidSourcesJar(type: Jar) {
archiveClassifier = "sources"
from android.sourceSets.main.java.getSrcDirs()
}
task sourcesJar(type: Jar) {
archiveClassifier = "sources"
from android.sourceSets.main.java.getSrcDirs()
}
artifacts {
archives androidSourcesJar
archives sourcesJar
}
Properties localProps = new Properties()
File localProperties = new File(rootProject.rootDir, "local.properties")
if (localProperties.exists() && localProperties.isFile()) {
localProperties.withInputStream { localProps.load(it) }
}
apply plugin: 'maven-publish'
afterEvaluate {
publishing {
publications {
// Creates a Maven publication called "release".
release(MavenPublication) {
from components.release
artifact androidSourcesJar
groupId = publishGroup
artifactId = moduleName
version = publishVersion
}
}
repositories {
maven {
credentials {
username = localProps.getProperty("publish.username")
password = localProps.getProperty("publish.password")
}
url 'https://packages.aliyun.com/maven/repository/2433389-release-RMv0jP/'
}
}
}
}