build.gradle 8.1 KB

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