build.gradle.kts 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
  2. import org.springframework.boot.gradle.tasks.bundling.BootJar
  3. group = "cc-lotus.gaf3"
  4. version = "3.1.714"
  5. extra["springCloudVersion"] = "Hoxton.SR5"
  6. extra["jjwtVersion"] = "0.10.5"
  7. val mavenUser: String? by project
  8. val mavenPassword: String? by project
  9. private val repoConf: String = System.getProperty("repoPath") ?: "/var/repo"
  10. val repoPath: String = file("$rootDir").toPath().root.resolve(repoConf).toString()
  11. plugins {
  12. id("java")
  13. id("maven-publish")
  14. id("io.spring.dependency-management") version "1.0.10.RELEASE"
  15. id("org.springframework.boot") version "2.3.3.RELEASE" apply false
  16. id("org.jetbrains.dokka") version "0.10.1"
  17. kotlin("jvm") version "1.3.72" apply false
  18. kotlin("plugin.spring") version "1.3.72" apply false
  19. kotlin("plugin.jpa") version "1.3.72" apply false
  20. }
  21. dependencyManagement {
  22. imports {
  23. mavenBom(org.springframework.boot.gradle.plugin.SpringBootPlugin.BOM_COORDINATES)
  24. }
  25. }
  26. repositories {
  27. // 阿里云镜像
  28. maven { url = uri("https://maven.aliyun.com/repository/public") }
  29. maven { url = uri("https://maven.aliyun.com/repository/gradle-plugin") }
  30. maven { url = uri("https://maven.aliyun.com/repository/spring") }
  31. maven { url = uri("https://maven.aliyun.com/repository/spring-plugin") }
  32. maven {
  33. name = "localRepo"
  34. url = uri("file://$repoPath")
  35. }
  36. maven {
  37. name = "cc-lotus"
  38. url = uri("http://maven.cc-lotus.info/repository/maven-public/")
  39. }
  40. // mavenCentral()
  41. }
  42. configure(subprojects.filter { it.name != "platform" }) {
  43. apply(plugin = "java")
  44. apply(plugin = "maven-publish")
  45. apply(plugin = "org.jetbrains.kotlin.jvm")
  46. apply(plugin = "org.jetbrains.dokka")
  47. java {
  48. disableAutoTargetJvm()
  49. // withSourcesJar()
  50. // withJavadocJar()
  51. }
  52. tasks.withType<JavaCompile> {
  53. options.encoding = "UTF-8"
  54. sourceCompatibility = "1.8"
  55. targetCompatibility = "1.8"
  56. }
  57. tasks.withType<KotlinCompile> {
  58. kotlinOptions {
  59. freeCompilerArgs = listOf("-Xjsr305=strict")
  60. jvmTarget = "1.8"
  61. }
  62. }
  63. tasks.withType<Javadoc> {
  64. options.encoding = "UTF-8"
  65. }
  66. repositories {
  67. maven {
  68. name = "localRepo"
  69. url = uri("file://$repoPath")
  70. }
  71. maven {
  72. name = "cc-lotus"
  73. url = uri("http://maven.cc-lotus.info/repository/maven-public/")
  74. }
  75. // 阿里云镜像
  76. maven { url = uri("https://maven.aliyun.com/repository/public") }
  77. maven { url = uri("https://maven.aliyun.com/repository/gradle-plugin") }
  78. maven { url = uri("https://maven.aliyun.com/repository/spring") }
  79. maven { url = uri("https://maven.aliyun.com/repository/spring-plugin") }
  80. // mavenCentral()
  81. }
  82. publishing {
  83. // publications {
  84. // create<MavenPublication>("maven") {
  85. // groupId = "cc-lotus.gaf3"
  86. // artifactId = tasks.jar.get().archiveBaseName.get()
  87. // version = "3.0.0"
  88. // from(components["java"])
  89. // }
  90. // }
  91. repositories {
  92. maven {
  93. name = "localRepo"
  94. url = uri("file://$repoPath")
  95. }
  96. }
  97. repositories {
  98. maven {
  99. name = "cc-lotus"
  100. url = uri("http://maven.cc-lotus.info/repository/maven-releases/")
  101. //认证用户和密码
  102. credentials {
  103. username = mavenUser // """${property("mavenUser")}"""
  104. password = mavenPassword // """${property("mavenPassword")}"""
  105. }
  106. }
  107. }
  108. }
  109. }
  110. task<Copy>("dist") {
  111. into("$buildDir/dist")
  112. project(":gateway") {
  113. from(tasks.withType<BootJar>())
  114. }
  115. }
  116. tasks {
  117. // processResources {
  118. // expand(project.properties)
  119. // }
  120. val dokka by getting(org.jetbrains.dokka.gradle.DokkaTask::class) {
  121. outputFormat = "html"
  122. outputDirectory = "$buildDir/dokka"
  123. }
  124. }
  125. //task("printRepo") {
  126. // println(org.jetbrains.kotlin.org.jline.utils.OSUtils.IS_WINDOWS)
  127. // println(repoPath)
  128. //}