Skip to content

Commit 43e346b

Browse files
committed
Make full use of the propdeps plugin
Use the plugin’s optional and provided configurations and apply the propdeps-maven plugin so that they are utilised by the pom generation process
1 parent 48799f7 commit 43e346b

File tree

2 files changed

+28
-40
lines changed

2 files changed

+28
-40
lines changed

build.gradle

Lines changed: 23 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ configure(allprojects) {
1818
apply plugin: "maven"
1919
apply plugin: "propdeps-idea"
2020
apply plugin: "propdeps"
21+
apply plugin: "propdeps-maven"
2122

2223
compileJava.options*.compilerArgs = [
2324
"-Xlint:serial", "-Xlint:varargs", "-Xlint:cast", "-Xlint:classfile",
@@ -133,8 +134,8 @@ project('spring-xml') {
133134
compile("org.springframework:spring-context:$springVersion")
134135

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

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

154155
// XML
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
156+
optional("org.jdom:jdom:2.0.1")
157+
optional("dom4j:dom4j:1.6.1")
158+
optional("xom:xom:1.2.5") {
159159
exclude group: 'xml-apis', module: 'xml-apis'
160160
exclude group: 'xerces', module: 'xercesImpl'
161161
exclude group: 'xalan', module: 'xalan'
162162
}
163-
compile("org.apache.ws.xmlschema:xmlschema-core:2.1.0", optional)
163+
optional("org.apache.ws.xmlschema:xmlschema-core:2.1.0")
164164

165165
// SOAP
166-
compile("org.apache.ws.commons.axiom:axiom-api:$axiomVersion", optional)
167-
compile("org.apache.ws.commons.axiom:axiom-impl:$axiomVersion") {
168-
optional
166+
optional("org.apache.ws.commons.axiom:axiom-api:$axiomVersion")
167+
optional("org.apache.ws.commons.axiom:axiom-impl:$axiomVersion") {
169168
exclude group: 'org.codehaus.woodstox', module: 'wstx-asl'
170169
}
171170

172171
// WSDL
173-
compile("wsdl4j:wsdl4j:1.6.1", optional)
172+
optional("wsdl4j:wsdl4j:1.6.1")
174173

175174
// Transport
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)
175+
provided("javax.servlet:javax.servlet-api:3.0.1")
176+
optional("org.apache.httpcomponents:httpclient:4.2.5")
177+
optional("commons-httpclient:commons-httpclient:3.1")
179178
testCompile("org.mortbay.jetty:jetty:6.1.26")
180179

181180
testCompile("log4j:log4j:1.2.16")
@@ -196,10 +195,10 @@ project('spring-ws-support') {
196195
testCompile("org.springframework:spring-test:$springVersion")
197196

198197
// Transport
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("org.igniterealtime.smack:smack:3.2.1", optional)
198+
provided("javax.jms:jms-api:1.1-rev-1")
199+
provided("javax.mail:javax.mail-api:1.4.7")
200+
provided("com.sun.mail:javax.mail:1.4.7")
201+
optional("org.igniterealtime.smack:smack:3.2.1")
203202
testCompile("commons-httpclient:commons-httpclient:3.1")
204203
testRuntime("org.apache.activemq:activemq-core:4.1.2") {
205204
exclude group:'org.apache.geronimo.specs', module:'geronimo-jms_1.1_spec'
@@ -222,20 +221,18 @@ project('spring-ws-security') {
222221

223222
// Spring Security
224223
compile("org.springframework.security:spring-security-core:3.2.3.RELEASE")
225-
compile("net.sf.ehcache:ehcache-core:2.6.9", optional)
224+
optional("net.sf.ehcache:ehcache-core:2.6.9")
226225

227226
// WS-Security
228-
compile("com.sun.xml.wss:xws-security:3.0") {
229-
optional
227+
optional("com.sun.xml.wss:xws-security:3.0") {
230228
exclude group: 'javax.xml.crypto', module: 'xmldsig'
231229
}
232-
compile("org.apache.ws.security:wss4j:1.6.15", optional)
230+
optional("org.apache.ws.security:wss4j:1.6.15")
233231

234232
// SOAP
235-
compile("com.sun.xml.messaging.saaj:saaj-impl:1.3.19", provided) // required for XWSS
236-
compile("org.apache.ws.commons.axiom:axiom-api:$axiomVersion", optional)
237-
compile("org.apache.ws.commons.axiom:axiom-impl:$axiomVersion") {
238-
optional
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") {
239236
exclude group: 'org.codehaus.woodstox', module: 'wstx-asl'
240237
}
241238

publish-maven.gradle

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,5 @@
11
apply plugin: 'maven'
22

3-
ext.optionalDeps = []
4-
ext.providedDeps = []
5-
6-
ext.optional = { optionalDeps << it }
7-
ext.provided = { providedDeps << it }
8-
93
install {
104
repositories.mavenInstaller {
115
customizePom(pom, project)
@@ -14,19 +8,16 @@ install {
148

159
def customizePom(pom, gradleProject) {
1610
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-
2511
// eliminate test-scoped dependencies (no need in maven central poms)
2612
generatedPom.dependencies.removeAll { dep ->
2713
dep.scope == 'test'
2814
}
2915

16+
// Ensure consistent ordering of dependencies to ease comparison with older poms
17+
generatedPom.dependencies = generatedPom.dependencies.sort { dep ->
18+
"$dep.scope:$dep.groupId:$dep.artifactId"
19+
}
20+
3021
// add all items necessary for maven central publication
3122
generatedPom.project {
3223
name = gradleProject.description

0 commit comments

Comments
 (0)