build.gradle 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188
  1. ext {
  2. configuration = [
  3. javaVersion = JavaVersion.VERSION_1_8
  4. ]
  5. libraries = [
  6. mybatisSpringVersion = '1.3.2',
  7. mybatisVersion = '3.4.6',
  8. springVersion = '4.3.5.RELEASE',
  9. springBootVersion = '2.0.1.RELEASE',
  10. jsqlparserVersion = '1.2',
  11. ]
  12. dependencies = [
  13. "jsqlparser" : "com.github.jsqlparser:jsqlparser:${jsqlparserVersion}",
  14. "mybatis-spring" : "org.mybatis:mybatis-spring:${mybatisSpringVersion}",
  15. "mybatis" : "org.mybatis:mybatis:${mybatisVersion}",
  16. "spring-context-support": "org.springframework:spring-context-support:${springVersion}",
  17. "spring-jdbc" : "org.springframework:spring-jdbc:${springVersion}",
  18. "spring-tx" : "org.springframework:spring-tx:${springVersion}",
  19. "aspectjweaver" : "org.aspectj:aspectjweaver:1.8.9",
  20. "mockito" : "org.mockito:mockito-core:2.13.0",
  21. "mybatis-ehcache" : "org.mybatis.caches:mybatis-ehcache:1.1.0",
  22. "slf4j-api" : "org.slf4j:slf4j-api:1.7.25",
  23. "logback-classic" : "ch.qos.logback:logback-classic:1.2.2",
  24. //test
  25. "spring-test" : "org.springframework:spring-test:${springVersion}",
  26. "junit" : "junit:junit:4.12",
  27. "lombok" : "org.projectlombok:lombok:1.16.20",
  28. "fastjson" : "com.alibaba:fastjson:1.2.37",
  29. "tomcatjdbc" : "org.apache.tomcat:tomcat-jdbc:9.0.2",
  30. //datasource
  31. "hikaricp" : "com.zaxxer:HikariCP:2.7.0",
  32. "druid" : "com.alibaba:druid:1.0.29",
  33. "commons-dbcp2" : "org.apache.commons:commons-dbcp2:2.1.1",
  34. "sqlserver" : "com.microsoft.sqlserver:sqljdbc4:4.0",
  35. "postgresql" : "org.postgresql:postgresql:9.4.1212",
  36. "oracle" : "com.oracle:ojdbc14:10.2.0.5.0",
  37. "h2" : "com.h2database:h2:1.4.194",
  38. "mysql" : "mysql:mysql-connector-java:5.1.38",
  39. //code generator
  40. "velocity" : "org.apache.velocity:velocity-engine-core:2.0",
  41. "freemarker" : "org.freemarker:freemarker:2.3.9",
  42. ]
  43. }
  44. allprojects {
  45. group = 'com.baomidou'
  46. version = '3.0.1-SNAPSHOT'
  47. }
  48. description = "Mybatis 增强工具包 - 只做增强不做改变,简化CRUD操作"
  49. buildscript {
  50. repositories {
  51. maven { url "https://repo.spring.io/plugins-release" }
  52. }
  53. dependencies {
  54. classpath("org.springframework.build.gradle:propdeps-plugin:0.0.7")
  55. }
  56. }
  57. configure(subprojects) {
  58. apply plugin: 'propdeps'
  59. apply plugin: 'propdeps-maven'
  60. apply plugin: 'propdeps-idea'
  61. apply plugin: 'propdeps-eclipse'
  62. }
  63. subprojects {
  64. apply plugin: 'java'
  65. apply plugin: 'signing'
  66. sourceCompatibility = "${javaVersion}"
  67. targetCompatibility = "${javaVersion}"
  68. //noinspection GroovyAssignabilityCheck
  69. tasks.withType(JavaCompile) {
  70. options.encoding = 'UTF-8'
  71. }
  72. repositories {
  73. mavenLocal()
  74. maven { url "http://maven.aliyun.com/nexus/content/groups/public/" }
  75. maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
  76. maven { url "http://www.cameliatk.jp/maven2/repository/thirdparty" }
  77. jcenter()
  78. }
  79. dependencies {
  80. compileOnly dependencies["lombok"]
  81. testCompile dependencies["junit"]
  82. }
  83. task sourcesJar(type: Jar, dependsOn: classes) {
  84. classifier = 'sources'
  85. from sourceSets.main.allSource
  86. }
  87. javadoc {
  88. options {
  89. encoding "UTF-8"
  90. charSet 'UTF-8'
  91. author true
  92. version true
  93. failOnError false
  94. links "http://docs.oracle.com/javase/7/docs/api"
  95. }
  96. }
  97. task javadocJar(type: Jar, dependsOn: javadoc) {
  98. classifier = 'javadoc'
  99. from 'build/docs/javadoc'
  100. }
  101. artifacts {
  102. archives sourcesJar
  103. archives javadocJar
  104. }
  105. tasks.whenTaskAdded { task ->
  106. if (task.name.contains('uploadArchives') || task.name.contains("signArchives")) {
  107. task.enabled = new File(project.property('signing.secretKeyRingFile') as String).isFile()
  108. }
  109. }
  110. signing {
  111. sign configurations.archives
  112. }
  113. // gradle clean build uploadArchives -Dun=用户名 -Dps=密码 -x test
  114. uploadArchives {
  115. repositories {
  116. mavenDeployer {
  117. beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }
  118. def userName = System.getProperty("un")
  119. def passWord = System.getProperty("ps")
  120. repository(url: "https://oss.sonatype.org/service/local/staging/deploy/maven2/") {
  121. //noinspection GroovyAssignabilityCheck
  122. authentication(userName: userName, password: passWord)
  123. }
  124. snapshotRepository(url: "https://oss.sonatype.org/content/repositories/snapshots/") {
  125. //noinspection GroovyAssignabilityCheck
  126. authentication(userName: userName, password: passWord)
  127. }
  128. pom.version = "$project.version"
  129. pom.artifactId = "$project.name"
  130. pom.groupId = "$project.group"
  131. pom.project {
  132. //noinspection GroovyAssignabilityCheck
  133. name 'mybatis-plus'
  134. packaging 'jar'
  135. description 'An enhanced toolkit of Mybatis to simplify development.'
  136. url 'https://github.com/baomidou/mybatis-plus'
  137. scm {
  138. connection 'scm:git@github.com:Codearte/gradle-nexus-staging-plugin.git'
  139. developerConnection 'scm:git@github.com:Codearte/gradle-nexus-staging-plugin.git'
  140. url 'https://github.com/baomidou/mybatis-plus'
  141. }
  142. licenses {
  143. license {
  144. //noinspection GroovyAssignabilityCheck
  145. name 'The Apache License, Version 2.0'
  146. url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
  147. }
  148. }
  149. developers {
  150. developer {
  151. id 'baomidou'
  152. //noinspection GroovyAssignabilityCheck
  153. name 'hubin'
  154. email 'jobob@qq.com'
  155. }
  156. }
  157. }
  158. }
  159. }
  160. }
  161. compileJava.dependsOn(processResources)
  162. }