Skip to content

Commit 35b5ad3

Browse files
author
Arjen Poutsma
committed
Merge pull request #18 from wilkinsona/polish-generated-poms
* polish-generated-poms: Polish generated POMs
2 parents 423bc55 + fbef2f7 commit 35b5ad3

File tree

2 files changed

+114
-33
lines changed

2 files changed

+114
-33
lines changed

build.gradle

Lines changed: 39 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ configure(subprojects) { subproject ->
7676

7777
apply plugin: "eclipse"
7878
apply plugin: "maven"
79+
apply from: "${rootProject.projectDir}/publish-maven.gradle"
7980

8081
jar {
8182
manifest.attributes["Created-By"] =
@@ -132,8 +133,8 @@ project('spring-xml') {
132133
compile("org.springframework:spring-context:$springVersion")
133134

134135
//XML
135-
optional("org.apache.ws.xmlschema:xmlschema-core:2.1.0")
136-
optional("jaxen:jaxen:1.1.4")
136+
compile("org.apache.ws.xmlschema:xmlschema-core:2.1.0", optional)
137+
compile("jaxen:jaxen:1.1.4", optional)
137138
}
138139
}
139140

@@ -151,28 +152,30 @@ project('spring-ws-core') {
151152
testCompile("org.springframework:spring-test:$springVersion")
152153

153154
// XML
154-
optional("org.jdom:jdom:2.0.1")
155-
optional("dom4j:dom4j:1.6.1")
156-
optional("xom:xom:1.2.5") {
155+
compile("org.jdom:jdom:2.0.1", optional)
156+
compile("dom4j:dom4j:1.6.1", optional)
157+
compile("xom:xom:1.2.5") {
158+
optional
157159
exclude group: 'xml-apis', module: 'xml-apis'
158160
exclude group: 'xerces', module: 'xercesImpl'
159161
exclude group: 'xalan', module: 'xalan'
160162
}
161-
optional("org.apache.ws.xmlschema:xmlschema-core:2.1.0")
163+
compile("org.apache.ws.xmlschema:xmlschema-core:2.1.0", optional)
162164

163165
// SOAP
164-
optional("org.apache.ws.commons.axiom:axiom-api:$axiomVersion")
165-
optional("org.apache.ws.commons.axiom:axiom-impl:$axiomVersion") {
166+
compile("org.apache.ws.commons.axiom:axiom-api:$axiomVersion", optional)
167+
compile("org.apache.ws.commons.axiom:axiom-impl:$axiomVersion") {
168+
optional
166169
exclude group: 'org.codehaus.woodstox', module: 'wstx-asl'
167170
}
168171

169172
// WSDL
170-
optional("wsdl4j:wsdl4j:1.6.1")
173+
compile("wsdl4j:wsdl4j:1.6.1", optional)
171174

172175
// Transport
173-
provided("javax.servlet:javax.servlet-api:3.0.1")
174-
optional("org.apache.httpcomponents:httpclient:4.2.5")
175-
optional("commons-httpclient:commons-httpclient:3.1")
176+
compile("javax.servlet:javax.servlet-api:3.0.1", provided)
177+
compile("org.apache.httpcomponents:httpclient:4.2.5", optional)
178+
compile("commons-httpclient:commons-httpclient:3.1", optional)
176179
testCompile("org.mortbay.jetty:jetty:6.1.26")
177180

178181
testCompile("log4j:log4j:1.2.16")
@@ -193,10 +196,10 @@ project('spring-ws-support') {
193196
testCompile("org.springframework:spring-test:$springVersion")
194197

195198
// Transport
196-
provided("javax.jms:jms-api:1.1-rev-1")
197-
provided("javax.mail:javax.mail-api:1.4.7")
198-
provided("com.sun.mail:javax.mail:1.4.7")
199-
optional("jivesoftware:smack:3.1.0")
199+
compile("javax.jms:jms-api:1.1-rev-1", provided)
200+
compile("javax.mail:javax.mail-api:1.4.7", provided)
201+
compile("com.sun.mail:javax.mail:1.4.7", provided)
202+
compile("jivesoftware:smack:3.1.0", optional)
200203
testCompile("commons-httpclient:commons-httpclient:3.1")
201204
testRuntime("org.apache.activemq:activemq-core:4.1.2") {
202205
exclude group:'org.apache.geronimo.specs', module:'geronimo-jms_1.1_spec'
@@ -219,24 +222,27 @@ project('spring-ws-security') {
219222

220223
// Spring Security
221224
compile("org.springframework.security:spring-security-core:3.1.0.RELEASE")
222-
optional("net.sf.ehcache:ehcache:2.6.3") {
223-
exclude group: 'net.sf.ehcache', module: 'ehcache-terracotta'
225+
compile("net.sf.ehcache:ehcache:2.6.3") {
226+
optional
227+
exclude group: 'net.sf.ehcache', module: 'ehcache-terracotta'
224228
}
225229

226230
// WS-Security
227-
optional("com.sun.xml.wss:xws-security:3.0") {
231+
compile("com.sun.xml.wss:xws-security:3.0") {
232+
optional
228233
exclude group: 'javax.xml.crypto', module: 'xmldsig'
229234
}
230-
optional("org.apache.ws.security:wss4j:1.6.15")
235+
compile("org.apache.ws.security:wss4j:1.6.15", optional)
231236

232237
// SOAP
233-
provided("com.sun.xml.messaging.saaj:saaj-impl:1.3.19") // required for XWSS
234-
optional("org.apache.ws.commons.axiom:axiom-api:$axiomVersion")
235-
optional("org.apache.ws.commons.axiom:axiom-impl:$axiomVersion") {
238+
compile("com.sun.xml.messaging.saaj:saaj-impl:1.3.19", provided) // required for XWSS
239+
compile("org.apache.ws.commons.axiom:axiom-api:$axiomVersion", optional)
240+
compile("org.apache.ws.commons.axiom:axiom-impl:$axiomVersion") {
241+
optional
236242
exclude group: 'org.codehaus.woodstox', module: 'wstx-asl'
237243
}
238244

239-
}
245+
}
240246
}
241247

242248
project('spring-ws-test') {
@@ -246,7 +252,7 @@ project('spring-ws-test') {
246252
compile project(":spring-xml")
247253
compile project(":spring-ws-core")
248254

249-
// Spring
255+
// Spring
250256
compile("org.springframework:spring-context:$springVersion")
251257

252258

@@ -275,20 +281,20 @@ configure(rootProject) {
275281
description = 'Generates aggregated Javadoc API documentation.'
276282
title = "${rootProject.description} ${version} API"
277283

278-
dependsOn {
279-
subprojects.collect {
280-
it.tasks.getByName("jar")
281-
}
282-
}
284+
dependsOn {
285+
subprojects.collect {
286+
it.tasks.getByName("jar")
287+
}
288+
}
283289

284290
options.memberLevel = org.gradle.external.javadoc.JavadocMemberLevel.PROTECTED
285291
options.author = true
286292
options.header = rootProject.description
287293
options.overview = 'src/api/overview.html'
288-
options.stylesheetFile = file("src/api/stylesheet.css")
294+
options.stylesheetFile = file("src/api/stylesheet.css")
289295
options.splitIndex = true
290-
options.links(project.ext.javadocLinks)
291-
options.addStringOption('Xdoclint:none', '-quiet')
296+
options.links(project.ext.javadocLinks)
297+
options.addStringOption('Xdoclint:none', '-quiet')
292298

293299
source subprojects.collect { project ->
294300
project.sourceSets.main.allJava

publish-maven.gradle

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
apply plugin: 'maven'
2+
3+
ext.optionalDeps = []
4+
ext.providedDeps = []
5+
6+
ext.optional = { optionalDeps << it }
7+
ext.provided = { providedDeps << it }
8+
9+
install {
10+
repositories.mavenInstaller {
11+
customizePom(pom, project)
12+
}
13+
}
14+
15+
def customizePom(pom, gradleProject) {
16+
pom.whenConfigured { generatedPom ->
17+
// respect 'optional' and 'provided' dependencies
18+
gradleProject.optionalDeps.each { dep ->
19+
generatedPom.dependencies.find { it.artifactId == dep.name }?.optional = true
20+
}
21+
gradleProject.providedDeps.each { dep ->
22+
generatedPom.dependencies.find { it.artifactId == dep.name }?.scope = 'provided'
23+
}
24+
25+
// eliminate test-scoped dependencies (no need in maven central poms)
26+
generatedPom.dependencies.removeAll { dep ->
27+
dep.scope == 'test'
28+
}
29+
30+
// add all items necessary for maven central publication
31+
generatedPom.project {
32+
name = gradleProject.description
33+
description = gradleProject.description
34+
url = 'http://projects.spring.io/spring-ws'
35+
organization {
36+
name = 'Spring IO'
37+
url = 'https://spring.io'
38+
}
39+
licenses {
40+
license {
41+
name 'The Apache Software License, Version 2.0'
42+
url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
43+
distribution 'repo'
44+
}
45+
}
46+
47+
scm {
48+
url = 'https://github.com/spring-projects/spring-ws'
49+
connection = 'scm:git:https://github.com/spring-projects/spring-ws.git'
50+
developerConnection = 'scm:git:https://github.com/spring-projects/spring-ws.git'
51+
}
52+
53+
issueManagement {
54+
system = 'JIRA'
55+
url = 'https://jira.spring.io/browse/SWS'
56+
}
57+
58+
developers {
59+
developer {
60+
id = 'apoutsma'
61+
name = 'Arjen Poutsma'
62+
63+
roles = ["Project lead"]
64+
}
65+
developer {
66+
id = 'tareqa'
67+
name = 'Tareq Abed Rabbo'
68+
69+
roles = ["Developer"]
70+
}
71+
}
72+
}
73+
}
74+
}
75+

0 commit comments

Comments
 (0)