forked from Leifzhang/AndroidAutoTrack
-
Notifications
You must be signed in to change notification settings - Fork 0
/
upload.gradle
executable file
·46 lines (39 loc) · 1.5 KB
/
upload.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
apply plugin: 'maven'
def sonatypeRepositoryUrl = "file://" + rootDir.absolutePath + "/.repo"
Properties config = new Properties()
config.load(project.file("nexus.properties").newDataInputStream())
def nexus_versionName = config.getProperty('nexus_versionName')
def nexus_artifactId = config.getProperty('nexus_artifactId')
def nexus_groupId = config.getProperty('nexus_groupId')
def nexus_description = config.getProperty('nexus_description')
def nexus_fileName = config.getProperty('nexus_fileName')
def nexus_type = config.getProperty('nexus_type')
task sourcesJar(type: Jar) {
from sourceSets.main.allSource
classifier = 'sources'
}
artifacts {
archives sourcesJar
}
afterEvaluate { project ->
Properties properties = new Properties()
properties.load(project.rootProject.file('local.properties').newDataInputStream())
uploadArchives {
repositories {
mavenDeployer {
pom.groupId = nexus_groupId
pom.artifactId = nexus_artifactId
pom.packaging = 'aar'
pom.name = nexus_fileName
pom.version = nexus_versionName + '-SNAPSHOT'
repository(url: sonatypeRepositoryUrl) {
try {
authentication(userName: properties.getProperty("userName"), password: properties.getProperty("password"))
} catch (Exception e) {
println(e.getMessage())
}
}
}
}
}
}