-
Notifications
You must be signed in to change notification settings - Fork 5
/
build.gradle
108 lines (93 loc) · 3.81 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
import org.gradle.api.artifacts.maven.MavenDeployment
/*
* Copyright 2012 the original author or authors.
* 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: 'groovy'
apply plugin: 'idea'
apply plugin: 'maven'
apply plugin: 'signing'
repositories {
mavenCentral()
mavenRepo url:'http://maven.springframework.org/milestone/'
}
dependencies {
compile gradleApi()
compile 'org.cloudfoundry:cloudfoundry-client-lib:0.7.4'
groovy group: 'org.codehaus.groovy', name: 'groovy', version: '1.8.6'
testCompile 'junit:junit:4.8.2'
}
group = 'org.gradle.api.plugins'
version = '0.2.1-SNAPSHOT'
// custom tasks for creating source/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
}
// add javadoc/source jar tasks as artifacts
artifacts {
archives sourcesJar
archives javadocJar
}
signing {
sign configurations.archives
}
def credentials = [userName: System.getProperty('deployUser'), password: System.getProperty('deployPass')]
uploadArchives {
repositories {
mavenDeployer {
beforeDeployment { MavenDeployment deployment -> signPom(deployment) }
repository(id:'sonatype-nexus-staging',url: uri('https://oss.sonatype.org/service/local/staging/deploy/maven2'), authentication: credentials)
snapshotRepository(id:'sonatype-nexus-snapshots', url: uri('https://oss.sonatype.org/content/repositories/snapshots'), authentication: credentials)
pom.project {
name 'CloudFoundry plugin for Gradle'
parent {
groupId 'org.sonatype.oss'
artifactId 'oss-parent'
version '7'
}
licenses {
license {
name 'The Apache Software License, Version 2.0'
url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
distribution 'repo'
}
}
scm(
url:'[email protected]:melix/gradle-cf-plugin.git',
connection:'scm:git:[email protected]:melix/gradle-cf-plugin.git',
developerConnection:'scm:git:[email protected]:melix/gradle-cf-plugin.git')
developers {
developer(id:'melix', name:'Cédric Champeau')
}
description('A plugin for Gradle that allows various operations on the CloudFoundry platform, like deploying, managing services, ...')
}
// courtesy of http://jedicoder.blogspot.com/2011/11/automated-gradle-project-deployment-to.html
pom.withXml { XmlProvider xmlProvider ->
def xml = xmlProvider.asString()
def pomXml = new XmlParser().parse(new ByteArrayInputStream(xml.toString().bytes))
pomXml.version[0] + { packaging('jar') }
def newXml = new StringWriter()
def printer = new XmlNodePrinter(new PrintWriter(newXml))
printer.preserveWhitespace = true
printer.print(pomXml)
xml.setLength(0)
xml.append(newXml.toString())
}
}
}
}