maven-deployment.gradle 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. import org.apache.tools.ant.filters.ReplaceTokens
  2. apply plugin: 'maven'
  3. // Create a source jar for uploading
  4. task sourceJar(type: Jar) {
  5. classifier = 'sources'
  6. from sourceSets.main.java.srcDirs
  7. include '**/*.java', '**/*.aj'
  8. }
  9. // Configuration for SpringSource s3 maven deployer
  10. configurations {
  11. deployerJars
  12. }
  13. dependencies {
  14. deployerJars "org.springframework.build.aws:org.springframework.build.aws.maven:3.0.0.RELEASE"
  15. }
  16. // Remove the archive configuration from the runtime configuration, so that anything added to archives
  17. // (such as the source jar) is no longer included in the runtime classpath
  18. configurations.default.extendsFrom = [configurations.runtime] as Set
  19. // Add the main jar into the default configuration
  20. artifacts { 'default' jar }
  21. install {
  22. customizePom(repositories.mavenInstaller.pom, project)
  23. }
  24. if(project != project(":spring-security-parent")) {
  25. install.dependsOn ':spring-security-parent:install'
  26. artifacts {
  27. archives sourceJar
  28. archives javadocJar
  29. }
  30. }
  31. task generatePom(type: Copy) {
  32. from 'pom.xml'
  33. into 'build/'
  34. filter(ReplaceTokens, tokens: [pomVersion : project.properties.version])
  35. }
  36. install.dependsOn generatePom
  37. def customizePom(pom, gradleProject) {
  38. pom.withXml { provider ->
  39. def builder = provider.asString()
  40. builder.length = 0 // delete existing content
  41. builder.append(file("build/pom.xml").text)
  42. }
  43. }