This repository was archived by the owner on May 20, 2021. It is now read-only.
forked from ceefour/webdav-servlet
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
128 lines (106 loc) · 3.66 KB
/
build.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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
/*
* Copyright 1999,2004 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'java-library-distribution'
apply plugin: 'maven'
archivesBaseName = 'webdav-servlet'
project.group = 'net.sf.webdav-servlet'
project.version = '2.5-TOPICUS-SNAPSHOT'
sourceCompatibility = 1.6
targetCompatibility = 1.6
defaultTasks 'clean', 'build', 'sourcesJar', 'javadocJar', 'uploadArchives'
configurations {
deployerJars
providedCompile
}
repositories {
mavenCentral()
}
dependencies {
providedCompile group: 'javax.servlet', name: 'servlet-api', version: '2.5'
compile group: 'org.slf4j', name: 'slf4j-api', version: '1.7.5'
testCompile group: 'ch.qos.logback', name: 'logback-classic', version: '1.0.12'
testCompile group: 'junit', name: 'junit', version: '4.+'
testCompile group: 'org.jmock', name: 'jmock', version: '2.6.0'
testCompile group: 'org.jmock', name: 'jmock-junit4', version: '2.6.0'
testCompile group: 'org.springframework', name: 'spring-test', version: '3.2.2.RELEASE'
testCompile group: 'org.springframework', name: 'spring-core', version: '3.2.2.RELEASE'
testRuntime group: 'org.codehaus.groovy', name: 'groovy-all', version: '2.1.3'
deployerJars 'org.apache.maven.wagon:wagon-http:2.2'
}
sourceSets {
main.compileClasspath += configurations.providedCompile
test.compileClasspath += configurations.providedCompile
test.runtimeClasspath += configurations.providedCompile
}
task wrapper(type: Wrapper) {
gradleVersion = '1.5'
}
task sourcesJar(type: Jar, dependsOn: classes) {
classifier = 'sources'
from sourceSets.main.allSource
}
task myJavadocs(type: Javadoc) {
source = sourceSets.main.allJava
classpath = sourceSets.main.compileClasspath + configurations.providedCompile
}
task javadocJar(type: Jar, dependsOn: myJavadocs) {
classifier = 'javadoc'
from javadoc.destinationDir
}
artifacts {
archives sourcesJar
archives javadocJar
}
test {
include '**/*Test.class'
exclude '**/net/sf/webdav/testutil/**/*Test.class'
}
distributions {
main{
baseName = "$archivesBaseName-${project.version}"
}
}
def getMavenSettingsCredentials = {
String userHome = System.getProperty( "user.home" );
File mavenSettings = new File(userHome, ".m2/settings.xml")
def xmlSlurper = new XmlSlurper()
def output = xmlSlurper.parse(mavenSettings)
return output."servers"."server"
}
def getCredentials = {
def entries = getMavenSettingsCredentials()
for (entry in entries) {
if ( entry."id".text() == "deployment.external" ) {
return [username: entry.username.text(), password: entry.password.text()]
}
}
}
uploadArchives {
def creds = getCredentials()
repositories {
repositories.mavenDeployer {
configuration = configurations.deployerJars
uniqueVersion = false
configureAuth = {
authentication(userName: creds["username"], password: creds["password"])
}
snapshotRepository(url: "http://vaatwasser:8081/nexus/content/repositories/external-snapshot/", configureAuth)
repository(url: "http://vaatwasser:8081/nexus/content/repositories/external-releases/", configureAuth)
}
}
}