maven.gradle 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. apply id: 'maven'
  2. // Create a source jar for uploading
  3. task sourceJar(type: Jar) {
  4. classifier = 'sources'
  5. from sourceSets.main.java
  6. }
  7. configurations {
  8. deployerJars
  9. }
  10. artifacts {
  11. archives sourceJar
  12. }
  13. dependencies {
  14. deployerJars "org.springframework.build.aws:org.springframework.build.aws.maven:3.0.0.RELEASE"
  15. }
  16. gradle.taskGraph.whenReady {graph ->
  17. if (graph.hasTask(uploadArchives)) {
  18. // check properties defined and fail early
  19. s3AccessKey
  20. s3SecretAccessKey
  21. }
  22. }
  23. uploadArchives {
  24. def mavenDeployer = repositories.mavenDeployer {
  25. configuration = configurations.deployerJars
  26. pom.whenConfigured {pom ->
  27. def optionalDeps = ['commons-logging', 'ehcache', 'log4j', 'apacheds-core', 'apacheds-server-jndi', 'jsp-api', 'slf4j-api', 'slf4j-log4j12', 'jsr250-api', 'ldapsdk']
  28. def providedDeps = ['servlet-api']
  29. pom.dependencies.findAll {dep -> optionalDeps.contains(dep.artifactId) }*.optional = true
  30. pom.dependencies.findAll {dep -> providedDeps.contains(dep.artifactId) }*.scope = 'provided'
  31. }
  32. }
  33. doFirst {
  34. if (releaseBuild) {
  35. // "mavenSyncRepoDir" should be set in properties
  36. repository(url: mavenSyncRepoDir)
  37. } else {
  38. s3credentials = [userName: s3AccessKey, passphrase: s3SecretAccessKey]
  39. repository(url: "s3://maven.springframework.org/milestone") {
  40. authentication(s3credentials)
  41. }
  42. snapshotRepository(url: "s3://maven.springframework.org/snapshot") {
  43. authentication(s3credentials)
  44. }
  45. }
  46. }
  47. }
  48. conf2ScopeMappings.addMapping(1, configurations.provided, "provided")