-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmaven.gradle
54 lines (47 loc) · 1.68 KB
/
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
51
52
53
54
apply plugin: 'maven'
if (project.plugins.hasPlugin("com.android.library")) {
task sourcesJar(type: Jar) {
classifier = 'sources'
from android.sourceSets.main.java.srcDirs
}
} else if (project.plugins.hasPlugin("java")) {
task sourcesJar(type: Jar) {
classifier = 'sources'
from sourceSets.main.java.srcDirs
}
} else if (project.plugins.hasPlugin("groovy")) {
task sourcesJar(type: Jar) {
classifier = 'sources'
from sourceSets.main.groovy.srcDirs
}
}
if (project.tasks['sourcesJar']) {
artifacts {
archives sourcesJar
}
}
uploadArchives {
repositories {
mavenDeployer {
File file = new File("${rootProject.projectDir}/local.properties");
Properties properties = new Properties()
if (file.exists()) {
properties.load(file.newDataInputStream())
def USERNAME = properties.getProperty("username")
def PASSWORD = properties.getProperty("password")
if (USERNAME != null && PASSWORD != null) {
repository(url: 'http://maven.91chengguo.com/repository/maven-releases/') {
authentication(userName: USERNAME, password: PASSWORD)
}
snapshotRepository(url: 'http://maven.91chengguo.com/repository/maven-snapshots/') {
authentication(userName: USERNAME, password: PASSWORD)
}
}
}
pom.packaging = 'aar'
pom.version = "$VERSION_NAME"
pom.groupId = "$GROUP_ID" // Attention!
pom.artifactId = "$ARTIFACT_ID"
}
}
}