build.gradle 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. apply plugin: 'java'
  2. apply plugin: 'maven'
  3. apply plugin: 'signing'
  4. ext {
  5. configuration = [
  6. javaVersion = JavaVersion.VERSION_1_7
  7. ]
  8. libraries = [
  9. mybatisSpringVersion = '1.3.1',
  10. mybatisVersion = '3.4.5',
  11. springVersion = '4.3.5.RELEASE',
  12. ]
  13. }
  14. group = 'com.baomidou'
  15. version = '2.1.4-SNAPSHOT'
  16. description = "Mybatis 增强工具包 - 只做增强不做改变,简化CRUD操作"
  17. sourceCompatibility = "${javaVersion}"
  18. targetCompatibility = "${javaVersion}"
  19. tasks.withType(JavaCompile) {
  20. options.encoding = 'UTF-8'
  21. }
  22. repositories {
  23. mavenLocal()
  24. maven { url 'http://maven.aliyun.com/nexus/content/groups/public/' }
  25. jcenter()
  26. }
  27. def common = [
  28. "org.springframework:spring-tx:${springVersion}",
  29. "org.springframework:spring-jdbc:${springVersion}",
  30. "org.springframework:spring-context-support:${springVersion}",
  31. "com.zaxxer:HikariCP:2.7.0",
  32. "org.apache.velocity:velocity-engine-core:2.0"
  33. ]
  34. dependencies {
  35. compile("org.mybatis:mybatis-spring:${mybatisSpringVersion}")
  36. compile("org.mybatis:mybatis:${mybatisVersion}")
  37. compile("com.github.jsqlparser:jsqlparser:1.1")
  38. compileOnly common
  39. testCompileOnly("javax.servlet:servlet-api:2.5")
  40. testCompile("org.mybatis.caches:mybatis-ehcache:1.1.0")
  41. testCompile("ch.qos.logback:logback-classic:1.2.2")
  42. testCompile("junit:junit:4.12")
  43. testCompile("org.apache.commons:commons-dbcp2:2.1.1") {
  44. exclude(module: 'commons-logging')
  45. }
  46. testCompile("org.apache.commons:commons-pool2:2.4.2")
  47. testCompile("com.microsoft.sqlserver:sqljdbc4:4.0")
  48. testCompile("org.postgresql:postgresql:9.4.1212")
  49. testCompile("com.oracle:ojdbc14:10.2.0.5.0")
  50. testCompile("com.h2database:h2:1.4.194")
  51. testCompile("mysql:mysql-connector-java:5.1.38")
  52. testCompile common
  53. testCompile("org.slf4j:slf4j-api:1.7.25")
  54. testCompile("org.slf4j:jcl-over-slf4j:1.7.25")
  55. testCompile("org.springframework:spring-test:${springVersion}")
  56. testCompile("org.springframework:spring-webmvc:${springVersion}")
  57. testCompile("org.aspectj:aspectjweaver:1.8.9")
  58. testCompile("javax.servlet:servlet-api:2.5")
  59. testCompile("org.projectlombok:lombok:1.16.16")
  60. }
  61. task sourcesJar(type: Jar, dependsOn: classes) {
  62. classifier = 'sources'
  63. from sourceSets.main.allSource
  64. }
  65. javadoc {
  66. options {
  67. encoding "UTF-8"
  68. charSet 'UTF-8'
  69. author true
  70. version true
  71. failOnError false
  72. links "http://docs.oracle.com/javase/7/docs/api"
  73. }
  74. }
  75. task javadocJar(type: Jar, dependsOn: javadoc) {
  76. classifier = 'javadoc'
  77. from 'build/docs/javadoc'
  78. }
  79. artifacts {
  80. archives sourcesJar
  81. archives javadocJar
  82. }
  83. signing {
  84. sign configurations.archives
  85. }
  86. // gradle clean build uploadArchives -Dun=用户名 -Dps=密码 -x test
  87. uploadArchives {
  88. repositories {
  89. mavenDeployer {
  90. beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }
  91. def userName = System.getProperty("un")
  92. def passWord = System.getProperty("ps")
  93. repository(url: "https://oss.sonatype.org/service/local/staging/deploy/maven2/") {
  94. authentication(userName: userName, password: passWord)
  95. }
  96. snapshotRepository(url: "https://oss.sonatype.org/content/repositories/snapshots/") {
  97. authentication(userName: userName, password: passWord)
  98. }
  99. pom.version = "$project.version"
  100. pom.artifactId = "$project.name"
  101. pom.groupId = "$project.group"
  102. pom.project {
  103. name 'mybatis-plus'
  104. packaging 'jar'
  105. description 'An enhanced toolkit of Mybatis to simplify development.'
  106. url 'https://github.com/baomidou/mybatis-plus'
  107. scm {
  108. connection 'scm:git@github.com:Codearte/gradle-nexus-staging-plugin.git'
  109. developerConnection 'scm:git@github.com:Codearte/gradle-nexus-staging-plugin.git'
  110. url 'https://github.com/baomidou/mybatis-plus'
  111. }
  112. licenses {
  113. license {
  114. name 'The Apache License, Version 2.0'
  115. url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
  116. }
  117. }
  118. developers {
  119. developer {
  120. id 'baomidou'
  121. name 'hubin'
  122. email 'jobob@qq.com'
  123. }
  124. }
  125. }
  126. }
  127. }
  128. }