-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathbase.gradle
executable file
·103 lines (92 loc) · 3.03 KB
/
base.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
93
94
95
96
97
98
99
100
101
102
103
// TIP: Uncomment blocks of commented code if using internal artifactory
apply plugin: 'java'
apply plugin: 'maven'
apply plugin: 'maven-publish'
//apply plugin: "com.jfrog.artifactory"
apply plugin: 'idea'
apply plugin: 'eclipse'
def javaVersion = JavaVersion.VERSION_1_8
sourceCompatibility = javaVersion
targetCompatibility = javaVersion
/*artifactory {
contextUrl = "${artifactory_contextUrl}" //The base Artifactory URL if not overridden by the publisher/resolver
publish {
repository {
repoKey = "${-> version}".endsWith('SNAPSHOT') ? 'mvn-snapshot' : 'mvn-release'
username = "${-> version}".endsWith('SNAPSHOT') ? project["artifactory_user"] : (project.findProperty("artifactory_release_user") ?: "Artifactory release user not specified.")
password = "${-> version}".endsWith('SNAPSHOT') ? project["artifactory_password"] : (project.findProperty("artifactory_release_password") ?: "Artifactory release password not specified.")
maven = true
}
defaults {
publications ('mavenJava')
publishBuildInfo = true //Publish build-info to Artifactory (true by default)
publishArtifacts = true //Publish artifacts to Artifactory (true by default)
}
}
resolve {
repository {
repoKey = 'mvn-snapshot'
username = "${artifactory_user}"
password = "${artifactory_password}"
maven = true
}
}
}
artifactoryPublish.onlyIf {rootProject.hasProperty('artifactory')}*/
repositories {
mavenLocal()
jcenter()
mavenCentral()
/* maven {
url repos.mvnSnapshot
credentials {
username getProperty('artifactory_user')
password getProperty('artifactory_password')
}
}
maven {
url repos.mvnRelease
credentials {
username getProperty('artifactory_user')
password getProperty('artifactory_password')
}
}*/
}
publishing {
publications {
mavenJava(MavenPublication) {
from components.java
}
}
}
/* to prevent IntelliJ to try downloading source and javadoc.
if any source and javadoc are misisng in artifactory it tries to download everytime */
idea {
module {
downloadJavadoc = false
downloadSources = false
}
}
tasks.withType(JavaCompile) {
options.encoding = 'UTF-8'
}
task sourcesJar(type: Jar, dependsOn: classes) {
classifier = 'sources'
from sourceSets.main.allSource
}
task javadocJar(type: Jar, dependsOn: javadoc) {
classifier = 'javadoc'
from javadoc.destinationDir
}
// caching resolution strategy: off
configurations.all {
resolutionStrategy.cacheChangingModulesFor 0, "seconds"
}
/*artifacts {
archives sourcesJar
archives javadocJar
}*/
/*
task wrapper(type: Wrapper) {
distributionUrl = 'https://services.gradle.org/distributions/gradle-${versions.gradleVersion}-bin.zip'
}*/