spring-module.gradle 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. apply plugin: 'org.springframework.build.compile'
  2. apply plugin: 'org.springframework.build.optional-dependencies'
  3. apply from: "$rootDir/gradle/publications.gradle"
  4. jar {
  5. manifest.attributes["Implementation-Title"] = project.name
  6. manifest.attributes["Implementation-Version"] = project.version
  7. manifest.attributes["Automatic-Module-Name"] = project.name.replace('-', '.') // for Jigsaw
  8. manifest.attributes["Created-By"] =
  9. "${System.getProperty("java.version")} (${System.getProperty("java.specification.vendor")})"
  10. from("${rootDir}/src/docs/dist") {
  11. include "license.txt"
  12. include "notice.txt"
  13. into "META-INF"
  14. expand(copyright: new Date().format("yyyy"), version: project.version)
  15. }
  16. }
  17. normalization {
  18. runtimeClasspath {
  19. ignore "META-INF/MANIFEST.MF"
  20. }
  21. }
  22. javadoc {
  23. description = "Generates project-level javadoc for use in -javadoc jar"
  24. options.encoding = "UTF-8"
  25. options.memberLevel = JavadocMemberLevel.PROTECTED
  26. options.author = true
  27. options.header = project.name
  28. options.use = true
  29. options.links(project.ext.javadocLinks)
  30. options.addStringOption("Xdoclint:none", "-quiet")
  31. // Suppress warnings due to cross-module @see and @link references.
  32. // Note that global 'api' task does display all warnings.
  33. logging.captureStandardError LogLevel.INFO
  34. logging.captureStandardOutput LogLevel.INFO // suppress "## warnings" message
  35. }
  36. task sourcesJar(type: Jar, dependsOn: classes) {
  37. duplicatesStrategy = DuplicatesStrategy.EXCLUDE
  38. archiveClassifier.set("sources")
  39. from sourceSets.main.allSource
  40. // Don't include or exclude anything explicitly by default. See SPR-12085.
  41. }
  42. task javadocJar(type: Jar) {
  43. archiveClassifier.set("javadoc")
  44. from javadoc
  45. }
  46. publishing {
  47. publications {
  48. mavenJava(MavenPublication) {
  49. from components.java
  50. artifact sourcesJar
  51. artifact javadocJar
  52. }
  53. }
  54. }
  55. // Disable publication of test fixture artifacts.
  56. //
  57. // Once we upgrade to Gradle 6.x, we will need to delete the following line ...
  58. components.java.variants.removeAll { it.outgoingConfiguration.name.startsWith("testFixtures") }
  59. // ... and uncomment the following two lines.
  60. // components.java.withVariantsFromConfiguration(configurations.testFixturesApiElements) { skip() }
  61. // components.java.withVariantsFromConfiguration(configurations.testFixturesRuntimeElements) { skip() }