123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221 |
- buildscript {
- repositories {
- maven { url "https://plugins.gradle.org/m2/" }
- }
- dependencies {
- classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.10")
- classpath 'com.netflix.nebula:gradle-extra-configurations-plugin:3.0.3'
- }
- }
- ext {
- configuration = [
- javaVersion = JavaVersion.VERSION_1_8
- ]
- libraries = [
- mybatisSpringVersion = '1.3.2',
- mybatisVersion = '3.4.6',
- springVersion = '5.1.2.RELEASE',
- springBootVersion = '2.1.0.RELEASE',
- jsqlparserVersion = '1.3',
- ]
- dependencies = [
- "kotlin-reflect" : "org.jetbrains.kotlin:kotlin-reflect:1.3.10",
- "kotlin-stdlib-jdk8" : "org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.3.10",
- "jsqlparser" : "com.github.jsqlparser:jsqlparser:${jsqlparserVersion}",
- "mybatis-spring" : "org.mybatis:mybatis-spring:${mybatisSpringVersion}",
- "mybatis" : "org.mybatis:mybatis:${mybatisVersion}",
- "spring-context-support" : "org.springframework:spring-context-support:${springVersion}",
- "spring-jdbc" : "org.springframework:spring-jdbc:${springVersion}",
- "spring-tx" : "org.springframework:spring-tx:${springVersion}",
- "spring-web" : "org.springframework:spring-web:${springVersion}",
- "spring-aop" : "org.springframework:spring-aop:${springVersion}",
- "cglib" : "cglib:cglib:3.2.6",
- "lombok" : "org.projectlombok:lombok:1.18.4",
- "javax.servlet-api" : "javax.servlet:javax.servlet-api:4.0.1",
- "aspectjweaver" : "org.aspectj:aspectjweaver:1.8.9",
- "mockito" : "org.mockito:mockito-core:2.13.0",
- "mybatis-ehcache" : "org.mybatis.caches:mybatis-ehcache:1.1.0",
- "slf4j-api" : "org.slf4j:slf4j-api:1.7.25",
- "logback-classic" : "ch.qos.logback:logback-classic:1.2.3",
- //test
- "spring-test" : "org.springframework:spring-test:${springVersion}",
- "junit" : "junit:junit:4.12",
- "mockito-all" : "org.mockito:mockito-all:1.10.19",
- "fastjson" : "com.alibaba:fastjson:1.2.49",
- "jackson" : "com.fasterxml.jackson.core:jackson-databind:2.9.6",
- "tomcatjdbc" : "org.apache.tomcat:tomcat-jdbc:9.0.2",
- //datasource
- "hikaricp" : "com.zaxxer:HikariCP:2.7.0",
- "druid" : "com.alibaba:druid:1.0.29",
- "commons-dbcp2" : "org.apache.commons:commons-dbcp2:2.1.1",
- "sqlserver" : "com.microsoft.sqlserver:sqljdbc4:4.0",
- "postgresql" : "org.postgresql:postgresql:9.4.1212",
- "oracle" : fileTree(dir: 'libs', includes: ['ojdbc-11.2.0.3-jdk16.jar']),
- "h2" : "com.h2database:h2:1.4.194",
- "mysql" : "mysql:mysql-connector-java:5.1.38",
- //code generator
- "velocity" : "org.apache.velocity:velocity-engine-core:2.0",
- "freemarker" : "org.freemarker:freemarker:2.3.9",
- // spring boot
- "springboot-autoconfigure" : "org.springframework.boot:spring-boot-autoconfigure:${springBootVersion}",
- "springboot-configuration-processor": "org.springframework.boot:spring-boot-configuration-processor:${springBootVersion}",
- "springboot-starter-jdbc" : "org.springframework.boot:spring-boot-starter-jdbc:${springBootVersion}",
- ]
- }
- allprojects {
- group = 'com.baomidou'
- version = '3.0.7.4-SNAPSHOT'
- }
- description = "Mybatis 增强工具包 - 只做增强不做改变,简化CRUD操作"
- subprojects {
- apply plugin: 'java'
- apply plugin: 'signing'
- apply plugin: 'maven-publish'
- apply plugin: 'nebula.optional-base'
- apply plugin: 'nebula.provided-base'
- sourceCompatibility = "${javaVersion}"
- targetCompatibility = "${javaVersion}"
- tasks.withType(JavaCompile) {
- options.encoding = 'UTF-8'
- }
- jar {
- manifest {
- attributes 'Implementation-Version': version
- }
- }
- repositories {
- mavenLocal()
- maven { url "http://maven.aliyun.com/nexus/content/groups/public/" }
- maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
- maven { url "http://www.cameliatk.jp/maven2/repository/thirdparty" }
- jcenter()
- }
- dependencies {
- provided rootProject.ext.dependencies["lombok"]
- testCompile rootProject.ext.dependencies["mockito-all"]
- testCompile rootProject.ext.dependencies["junit"]
- }
- task sourcesJar(type: Jar, dependsOn: classes) {
- classifier = 'sources'
- from sourceSets.main.allSource
- }
- javadoc {
- options {
- encoding "UTF-8"
- charSet 'UTF-8'
- author true
- version true
- failOnError false
- links "http://docs.oracle.com/javase/8/docs/api"
- }
- }
- task javadocJar(type: Jar, dependsOn: javadoc) {
- classifier = 'javadoc'
- from 'build/docs/javadoc'
- }
- artifacts {
- archives sourcesJar
- archives javadocJar
- }
- tasks.whenTaskAdded { task ->
- if (task.name.contains('signMavenJavaPublication')) {
- task.enabled = new File(project.property('signing.secretKeyRingFile') as String).isFile()
- }
- }
- /*
- * 1.修改 gradle.properties 中 signing.secretKeyRingFile的路径
- * 2.执行 gradle clean build publish -Dun=用户名 -Dps=密码 -x test
- * ---------------------------wrapper------------------------------------------
- * 先执行 gradle wrapper 生成 gradlew 和 gradlew.bat
- * win: gradlew.bat clean build publish -Dun=用户名 -Dps=密码 -x test
- * mac: ./gradlew clean build publish -Dun=用户名 -Dps=密码 -x test
- */
- publishing {
- repositories {
- maven {
- def userName = System.getProperty("un")
- def passWord = System.getProperty("ps")
- def releasesRepoUrl = "https://oss.sonatype.org/service/local/staging/deploy/maven2/"
- def snapshotsRepoUrl = "https://oss.sonatype.org/content/repositories/snapshots/"
- url = version.endsWith('SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl
- credentials {
- username userName
- password passWord
- }
- }
- }
- publications {
- mavenJava(MavenPublication) {
- from components.java
- artifact sourcesJar
- artifact javadocJar
- pom {
- name = 'mybatis-plus'
- packaging 'jar'
- description = 'An enhanced toolkit of Mybatis to simplify development.'
- url = 'https://github.com/baomidou/mybatis-plus'
- scm {
- connection = 'scm:git@github.com:Codearte/gradle-nexus-staging-plugin.git'
- developerConnection = 'scm:git@github.com:Codearte/gradle-nexus-staging-plugin.git'
- url = 'https://github.com/baomidou/mybatis-plus'
- }
- licenses {
- license {
- name = 'The Apache License, Version 2.0'
- url = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
- }
- }
- developers {
- developer {
- id = 'baomidou'
- name = 'hubin'
- email = 'jobob@qq.com'
- }
- }
- withXml {
- asNode().dependencies.'*'.findAll() {
- it.scope.text() == 'compile' && project.configurations.provided.allDependencies.find { dep ->
- dep.name == it.artifactId.text()
- }
- }.each() {
- it.scope*.value = 'provided'
- }
- }
- }
- }
- }
- signing {
- sign publishing.publications.mavenJava
- }
- }
- }
|