-
Notifications
You must be signed in to change notification settings - Fork 0
/
artifactory.gradle
executable file
·92 lines (82 loc) · 2.45 KB
/
artifactory.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
// Fetch Artifactory publishing plugin
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'org.jfrog.buildinfo:build-info-extractor-gradle:4+'
}
}
// Apply plugins
apply plugin: 'maven-publish'
apply plugin: org.jfrog.gradle.plugin.artifactory.ArtifactoryPlugin
// Determine which repositories to pull from and publish to
def pullRelease = 'libs-release'
def pullSnapshot = 'libs-snapshot'
def pushRelease = 'libs-snapshot-webis-gradle'
def pushSnapshot = 'libs-release-webis-gradle'
if (project.ext.has("nonFree") && project.ext.get("nonFree")) {
pullRelease += '-nonfree'
pullSnapshot += '-nonfree'
pushRelease += '-nonfree'
pushSnapshot += '-nonfree'
}
repositories {
maven {
url = 'https://repo.webis.de/artifactory/' + pullRelease
credentials {
username = project.findProperty("artifactoryUsername") ?: ""
password = project.findProperty("artifactoryPassword") ?: ""
}
}
maven {
url = 'https://repo.webis.de/artifactory/' + pullSnapshot
credentials {
username = project.findProperty("artifactoryUsername") ?: ""
password = project.findProperty("artifactoryPassword") ?: ""
}
}
}
// Configure Artifactory remote
artifactory {
contextUrl = "https://repo.webis.de/artifactory"
publish {
repository {
repoKey = version.endsWith('SNAPSHOT') ? pushRelease : pushSnapshot
username = project.findProperty("artifactoryUsername") ?: ""
password = project.findProperty("artifactoryPassword") ?: ""
maven = true
}
defaults {
publications('mavenJava')
}
}
}
// Create tasks for generating source and JavaDoc JARs
task sourcesJar(type: Jar, dependsOn: classes) {
classifier = 'sources'
from sourceSets.main.allSource
}
task javadocJar(type: Jar, dependsOn: javadoc) {
classifier = 'javadoc'
from javadoc.destinationDir
}
artifacts {
archives javadocJar
archives sourcesJar
}
// Configure Maven Publishing Information
publishing {
publications {
mavenJava(MavenPublication) {
// Publish binary, source, and JavaDoc JARs
from components.java
artifact sourcesJar
artifact javadocJar
// Set POM definition
if (project.ext.has("pomDef")) {
pom project.ext.get("pomDef")
}
}
}
}