/
maven-deployment.gradle
114 lines (98 loc) · 3.58 KB
/
maven-deployment.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
apply plugin: 'maven'
// Create a source jar for uploading
task sourceJar(type: Jar) {
classifier = 'sources'
from sourceSets.main.java.srcDirs
include '**/*.java', '**/*.aj'
}
artifacts {
archives sourceJar
archives javadocJar
}
// Configuration for SpringSource s3 maven deployer
configurations {
deployerJars
}
dependencies {
deployerJars "org.springframework.build.aws:org.springframework.build.aws.maven:3.0.0.RELEASE"
}
// Remove the archive configuration from the runtime configuration, so that anything added to archives
// (such as the source jar) is no longer included in the runtime classpath
configurations.default.extendsFrom = [configurations.runtime] as Set
// Add the main jar into the default configuration
artifacts { 'default' jar }
install {
customizePom(repositories.mavenInstaller.pom, project)
}
def customizePom(pom, gradleProject) {
def optionalDeps = ['ehcache', 'log4j', 'apacheds-core', 'jsp-api', 'jsr250-api', 'ldapsdk', 'aspectjrt', 'aspectjweaver']
pom.scopeMappings.addMapping(10, configurations.provided, 'provided')
pom.whenConfigured { p ->
// Remove test scope dependencies from published poms
p.dependencies = p.dependencies.findAll {it.scope != 'test'}
// Flag optional deps
p.dependencies.findAll { dep ->
optionalDeps.contains(dep.artifactId) ||
dep.groupId.startsWith('org.apache.directory') ||
dep.groupId.startsWith('org.slf4j')
}*.optional = true
// Hack for specific case of config module
if (p.artifactId == 'spring-security-config') {
p.dependencies.find { dep -> dep.artifactId == 'spring-security-web'}.optional = true
p.dependencies.find { dep -> dep.artifactId == 'spring-web'}.optional = true
}
if (p.artifactId == 'spring-security-core') {
p.dependencies.find { dep -> dep.artifactId == 'spring-jdbc'}.optional = true
p.dependencies.find { dep -> dep.artifactId == 'spring-tx'}.optional = true
p.dependencies.removeAll { dep -> dep.artifactId == 'spring-security-crypto' }
}
}
pom.project {
name = gradleProject.name
description = gradleProject.name
url = 'http://springsource.org/spring-security'
organization {
name = 'SpringSource'
url = 'http://springsource.org/'
}
licenses {
license {
name 'The Apache Software License, Version 2.0'
url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
distribution 'repo'
}
}
scm {
url = 'https://github.com/SpringSource/spring-security'
connection = 'scm:git:git://github.com/SpringSource/spring-security'
developerConnection = 'scm:git:git://github.com/SpringSource/spring-security'
}
developers {
developer {
id = 'rwinch'
name = 'Rob Winch'
email = 'rwinch@vmware.com'
}
}
dependencies {
dependency {
artifactId = groupId = 'commons-logging'
scope = 'compile'
optional = 'true'
version = '1.1.1'
}
}
}
}
task generatePom {
group = 'Build'
description = 'Generates the Maven pom.xml'
ext.generatedPomFileName = 'pom.xml'
inputs.files('**/*.gradle')
outputs.files(generatedPomFileName)
doLast() {
def p = pom {}
customizePom(p, project)
p.writeTo(generatedPomFileName)
}
}