maven-deployment.gradle 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  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. archives javadocJar
  11. }
  12. // Configuration for SpringSource s3 maven deployer
  13. configurations {
  14. deployerJars
  15. }
  16. dependencies {
  17. deployerJars "org.springframework.build.aws:org.springframework.build.aws.maven:3.0.0.RELEASE"
  18. }
  19. install {
  20. customizePom(repositories.mavenInstaller.pom, project)
  21. }
  22. def customizePom(pom, gradleProject) {
  23. pom.whenConfigured { p ->
  24. p.dependencies.findAll{ it.scope == "optional" }.each {
  25. it.scope = "compile"
  26. it.optional = true
  27. }
  28. // sort to make pom dependencies order consistent to ease comparison of older poms
  29. p.dependencies = p.dependencies.sort { dep ->
  30. "$dep.scope:$dep.optional:$dep.groupId:$dep.artifactId"
  31. }
  32. }
  33. pom.project {
  34. name = gradleProject.name
  35. description = gradleProject.name
  36. url = 'http://springsource.org/spring-security'
  37. organization {
  38. name = 'SpringSource'
  39. url = 'http://springsource.org/'
  40. }
  41. licenses {
  42. license {
  43. name 'The Apache Software License, Version 2.0'
  44. url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
  45. distribution 'repo'
  46. }
  47. }
  48. scm {
  49. url = 'https://github.com/SpringSource/spring-security'
  50. connection = 'scm:git:git://github.com/SpringSource/spring-security'
  51. developerConnection = 'scm:git:git://github.com/SpringSource/spring-security'
  52. }
  53. developers {
  54. developer {
  55. id = 'rwinch'
  56. name = 'Rob Winch'
  57. email = 'rwinch@vmware.com'
  58. }
  59. }
  60. dependencies {
  61. dependency {
  62. artifactId = groupId = 'commons-logging'
  63. scope = 'compile'
  64. optional = 'true'
  65. version = '1.1.1'
  66. }
  67. }
  68. }
  69. }
  70. task generatePom {
  71. group = 'Build'
  72. description = 'Generates a Maven pom.xml'
  73. ext.generatedPomFileName = "pom.xml"
  74. onlyIf { install.enabled }
  75. inputs.files(fileTree(project.rootProject.rootDir).include("**/*.gradle").files)
  76. inputs.files(new File(project.rootProject.rootDir, Project.GRADLE_PROPERTIES))
  77. outputs.files(generatedPomFileName)
  78. doLast() {
  79. def p = pom {}
  80. customizePom(p, project)
  81. p.writeTo(generatedPomFileName)
  82. }
  83. }
  84. build.dependsOn generatePom