build.gradle 7.4 KB

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