forked from Mobile4You/MobileScripts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathartifactoryConfig.gradle
61 lines (56 loc) · 2.18 KB
/
artifactoryConfig.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
apply plugin: "com.jfrog.artifactory"
apply plugin: 'maven-publish'
task sourceJar(type: Jar) {
from "src/main/java"
from "src/main/kotlin"
classifier = 'sources'
}
publishing {
publications {
aar(MavenPublication) {
groupId = project.group
artifactId project.name
artifact(sourceJar)
artifact "${project.buildDir}/outputs/aar/${project.name}-release.aar"
pom.withXml {
def dependenciesNode = asNode().appendNode('dependencies')
//Iterate over the compile dependencies (we don't want the test ones), adding a <dependency> node for each
configurations.compile.allDependencies.each {
if(it.group != null && (it.name != null || "unspecified".equals(it.name)) && it.version != null)
{
def dependencyNode = dependenciesNode.appendNode('dependency')
dependencyNode.appendNode('groupId', it.group)
dependencyNode.appendNode('artifactId', it.name)
dependencyNode.appendNode('version', it.version)
}
}
}
}
}
}
artifactory {
contextUrl = artifactoryContextUrl
publish {
repository {
// The Artifactory repository key to publish to
repoKey = artifactVersion.endsWith('SNAPSHOT') ? 'libs-snapshot-local' : artifactoryPublishRepoKey
username = artifactoryUser // The publisher user name
password = artifactoryPassword // The publisher password
maven = true
}
defaults {
publishArtifacts = true
publications('aar')
publishPom = true //Publish generated POM files to Artifactory (true by default)
publishIvy = true //Publish generated Ivy descriptor files to Artifactory (true by default)
}
}
resolve {
repository {
repoKey = artifactoryResolveRepoKey
username = artifactoryUser // The resolver user name
password = artifactoryPassword // The resolver password
}
}
}
artifactoryPublish.dependsOn build