maven-deployment.gradle 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  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. }
  61. }
  62. task generatePom {
  63. group = 'Build'
  64. description = 'Generates a Maven pom.xml'
  65. ext.generatedPomFileName = "pom.xml"
  66. onlyIf { install.enabled }
  67. inputs.files(fileTree(project.rootProject.rootDir).include("**/*.gradle").files)
  68. inputs.files(new File(project.rootProject.rootDir, Project.GRADLE_PROPERTIES))
  69. outputs.files(generatedPomFileName)
  70. doLast() {
  71. def p = pom {}
  72. customizePom(p, project)
  73. p.writeTo(generatedPomFileName)
  74. }
  75. }
  76. build.dependsOn generatePom