maven-deployment.gradle 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. apply plugin: 'maven'
  2. // Create a source jar for uploading
  3. task sourceJar(type: Jar) {
  4. classifier = 'sources'
  5. from sourceSets.main.java.srcDirs
  6. include '**/*.java', '**/*.aj'
  7. }
  8. artifacts {
  9. archives sourceJar
  10. }
  11. // Configuration for SpringSource s3 maven deployer
  12. configurations {
  13. deployerJars
  14. }
  15. dependencies {
  16. deployerJars "org.springframework.build.aws:org.springframework.build.aws.maven:3.0.0.RELEASE"
  17. }
  18. // Remove the archive configuration from the runtime configuration, so that anything added to archives
  19. // (such as the source jar) is no longer included in the runtime classpath
  20. configurations.default.extendsFrom = [configurations.runtime] as Set
  21. // Add the main jar into the default configuration
  22. artifacts { 'default' jar }
  23. install {
  24. customizePom(repositories.mavenInstaller.pom)
  25. }
  26. def customizePom(pom) {
  27. def optionalDeps = ['ehcache', 'log4j', 'apacheds-core', 'jsp-api', 'jsr250-api', 'ldapsdk', 'aspectjrt', 'aspectjweaver']
  28. pom.scopeMappings.addMapping(10, configurations.provided, 'provided')
  29. pom.whenConfigured { p ->
  30. // Remove test scope dependencies from published poms
  31. p.dependencies = p.dependencies.findAll {it.scope != 'test'}
  32. // Flag optional deps
  33. p.dependencies.findAll { dep ->
  34. optionalDeps.contains(dep.artifactId) ||
  35. dep.groupId.startsWith('org.apache.directory') ||
  36. dep.groupId.startsWith('org.slf4j')
  37. }*.optional = true
  38. // Hack for specific case of config module
  39. if (p.artifactId == 'spring-security-config') {
  40. p.dependencies.find { dep -> dep.artifactId == 'spring-security-web'}.optional = true
  41. p.dependencies.find { dep -> dep.artifactId == 'spring-web'}.optional = true
  42. }
  43. if (p.artifactId == 'spring-security-core') {
  44. p.dependencies.find { dep -> dep.artifactId == 'spring-jdbc'}.optional = true
  45. p.dependencies.find { dep -> dep.artifactId == 'spring-tx'}.optional = true
  46. p.dependencies.removeAll { dep -> dep.artifactId == 'spring-security-crypto' }
  47. }
  48. }
  49. pom.project {
  50. licenses {
  51. license {
  52. name 'The Apache Software License, Version 2.0'
  53. url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
  54. distribution 'repo'
  55. }
  56. }
  57. dependencies {
  58. dependency {
  59. artifactId = groupId = 'commons-logging'
  60. scope = 'compile'
  61. optional = 'true'
  62. version = '1.1.1'
  63. }
  64. }
  65. }
  66. }