diff --git a/publish-maven.gradle b/publish-maven.gradle index 98c813c..44c6719 100644 --- a/publish-maven.gradle +++ b/publish-maven.gradle @@ -1,11 +1,5 @@ apply plugin: 'maven' -ext.optionalDeps = [] -ext.providedDeps = [] - -ext.optional = { optionalDeps << it } -ext.provided = { providedDeps << it } - install { repositories.mavenInstaller { customizePom(pom, project) @@ -14,19 +8,16 @@ install { def customizePom(pom, gradleProject) { pom.whenConfigured { generatedPom -> - // respect 'optional' and 'provided' dependencies - gradleProject.optionalDeps.each { dep -> - generatedPom.dependencies.find { it.artifactId == dep.name }?.optional = true - } - gradleProject.providedDeps.each { dep -> - generatedPom.dependencies.find { it.artifactId == dep.name }?.scope = 'provided' - } - // eliminate test-scoped dependencies (no need in maven central poms) generatedPom.dependencies.removeAll { dep -> dep.scope == 'test' } + // Ensure consistent ordering of dependencies to ease comparison with older poms + generatedPom.dependencies = generatedPom.dependencies.sort { dep -> + "$dep.scope:$dep.groupId:$dep.artifactId" + } + // add all items necessary for maven central publication generatedPom.project { name = gradleProject.description diff --git a/spring-service-connector/build.gradle b/spring-service-connector/build.gradle index a59327f..3148e21 100644 --- a/spring-service-connector/build.gradle +++ b/spring-service-connector/build.gradle @@ -15,33 +15,29 @@ dependencies { testRuntime("javax.mail:javax.mail-api:$javaxMailVersion") - compile("org.springframework:spring-jdbc:$springVersion", optional) - compile("org.springframework:spring-context-support:$springVersion", optional) - compile("org.apache.tomcat:tomcat-jdbc:$tomcatVersion", optional) - compile("org.apache.tomcat:tomcat-dbcp:$tomcatVersion", optional) - compile("org.apache.commons:commons-dbcp2:$commonDbcp2Version") { - optional + optional("org.springframework:spring-jdbc:$springVersion") + optional("org.springframework:spring-context-support:$springVersion") + optional("org.apache.tomcat:tomcat-jdbc:$tomcatVersion") + optional("org.apache.tomcat:tomcat-dbcp:$tomcatVersion") + optional("org.apache.commons:commons-dbcp2:$commonDbcp2Version") { exclude(module: 'commons-logging') exclude(module: 'xerces') exclude(module: 'xercesImpl') exclude(module: 'xml-apis') } - compile("commons-dbcp:commons-dbcp:$commonDbcpVersion") { - optional + optional("commons-dbcp:commons-dbcp:$commonDbcpVersion") { exclude(module: 'commons-logging') exclude(module: 'xerces') exclude(module: 'xercesImpl') exclude(module: 'xml-apis') } - compile("org.springframework.amqp:spring-rabbit:$springAmqpVersion", optional) - compile("org.springframework.data:spring-data-redis:$springDataRedisVersion") { - optional + optional("org.springframework.amqp:spring-rabbit:$springAmqpVersion") + optional("org.springframework.data:spring-data-redis:$springDataRedisVersion") { exclude(module: 'spring-context-support') } - compile("redis.clients:jedis:$jedisVersion", optional) + optional("redis.clients:jedis:$jedisVersion") - compile("org.springframework.data:spring-data-mongodb:$springDataMongoVersion") { - optional + optional("org.springframework.data:spring-data-mongodb:$springDataMongoVersion") { exclude(module: 'spring-beans') exclude(module: 'spring-expression') exclude(module: 'spring-tx')