123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274 |
- import java.text.SimpleDateFormat
- buildscript {
- repositories {
- maven { url "https://maven.aliyun.com/nexus/content/groups/public" }
- maven { url "https://maven.aliyun.com/nexus/content/repositories/gradle-plugin" }
- mavenCentral()
- maven { url "https://plugins.gradle.org/m2/" }
- }
- dependencies {
- //noinspection DifferentKotlinGradleVersion
- classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.72'
- classpath "gradle.plugin.com.hierynomus.gradle.plugins:license-gradle-plugin:0.15.0"
- }
- }
- ext {
- configuration = [
- javaVersion = JavaVersion.VERSION_1_8
- ]
- libraries = [
- mybatisVersion = '3.5.5',
- mybatisSpringVersion = '2.0.5',
- mybatisSpringBootStarterVersion = '2.1.3',
- springVersion = '5.2.8.RELEASE',
- springBootVersion = '2.3.2.RELEASE',
- jsqlparserVersion = '3.2',
- junitVersion = '5.6.2',
- ]
- lib = [
- "kotlin-reflect" : "org.jetbrains.kotlin:kotlin-reflect:1.3.72",
- "kotlin-stdlib-jdk8" : "org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.3.72",
- "jsqlparser" : "com.github.jsqlparser:jsqlparser:${jsqlparserVersion}",
- "mybatis" : "org.mybatis:mybatis:${mybatisVersion}",
- "mybatis-spring" : "org.mybatis:mybatis-spring:${mybatisSpringVersion}",
- "mybatis-thymeleaf" : "org.mybatis.scripting:mybatis-thymeleaf:1.0.2",
- "mybatis-freemarker" : "org.mybatis.scripting:mybatis-freemarker:1.2.2",
- "mybatis-velocity" : "org.mybatis.scripting:mybatis-velocity:2.1.0",
- "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}",
- "aspectjrt" : "org.aspectj:aspectjrt:1.9.6",
- "cglib" : "cglib:cglib:3.3.0",
- "lombok" : "org.projectlombok:lombok:1.18.12",
- "imadcn" : "com.imadcn.framework:idworker:1.5.0",
- "javax.servlet-api" : "javax.servlet:javax.servlet-api:4.0.1",
- "aspectjweaver" : "org.aspectj:aspectjweaver:1.9.6",
- "slf4j-api" : "org.slf4j:slf4j-api:1.7.30",
- "logback-classic" : "ch.qos.logback:logback-classic:1.2.3",
- //copy
- "mybatis-spring-boot-starter": "org.mybatis.spring.boot:mybatis-spring-boot-starter:${mybatisSpringBootStarterVersion}",
- //test
- "spring-test" : "org.springframework:spring-test:${springVersion}",
- "assertj-core" : "org.assertj:assertj-core:3.16.1",
- "junit-jupiter-api" : "org.junit.jupiter:junit-jupiter-api:${junitVersion}",
- "junit-jupiter-engine" : "org.junit.jupiter:junit-jupiter-engine:${junitVersion}",
- "fastjson" : "com.alibaba:fastjson:1.2.73",
- "jackson" : "com.fasterxml.jackson.core:jackson-databind:2.11.1",
- "gson" : "com.google.code.gson:gson:2.8.6",
- "lagarto" : "org.jodd:jodd-lagarto:5.1.5",
- //datasource
- "p6spy" : "p6spy:p6spy:3.9.1",
- "sqlserver" : "com.microsoft.sqlserver:sqljdbc4:4.0",
- "postgresql" : "org.postgresql:postgresql:42.2.14",
- "oracle" : fileTree(dir: 'libs', includes: ['ojdbc-11.2.0.3-jdk16.jar']),
- "dm" : fileTree(dir: 'libs', includes: ["jdbcDriver-18.jar"]),
- "kingbase" : fileTree(dir: 'libs', includes: ["kingbase8-8.2.0.jar"]),
- "h2" : "com.h2database:h2:1.4.200",
- "mysql" : "mysql:mysql-connector-java:8.0.21",
- "sqlite" : "org.xerial:sqlite-jdbc:3.32.3.1",
- "firebird" : "org.firebirdsql.jdbc:jaybird:4.0.1.java8",
- //code generator
- "velocity" : "org.apache.velocity:velocity-engine-core:2.2",
- "freemarker" : "org.freemarker:freemarker:2.3.30",
- "beetl" : "com.ibeetl:beetl:3.1.8.RELEASE",
- "swagger-annotations" : "io.swagger:swagger-annotations:1.6.2",
- //cache
- "mybatis-ehcache" : "org.mybatis.caches:mybatis-ehcache:1.2.1",
- "mybatis-redis" : "org.mybatis.caches:mybatis-redis:1.0.0-beta2",
- "mybatis-caffeine" : "org.mybatis.caches:mybatis-caffeine:1.0.0-beta1"
- ]
- }
- allprojects {
- group = 'com.baomidou'
- version = "3.4.0.2-SNAPSHOT"
- }
- description = "Mybatis 增强工具包 - 只做增强不做改变,简化CRUD操作"
- subprojects {
- apply plugin: 'java-library'
- apply plugin: 'signing'
- apply plugin: 'maven-publish'
- apply plugin: 'com.github.hierynomus.license'
- sourceCompatibility = "${javaVersion}"
- targetCompatibility = "${javaVersion}"
- tasks.withType(JavaCompile) {
- options.encoding = 'UTF-8'
- options.warnings = false
- options.deprecation = true
- options.compilerArgs += ["-parameters"]
- }
- tasks.withType(GenerateModuleMetadata) {
- enabled = false
- }
- jar {
- afterEvaluate {
- manifest {
- attributes 'Implementation-Version': archiveVersion
- attributes 'Built-Gradle': gradle.gradleVersion
- attributes 'Bundle-DocURL': 'https://mybatis.plus/'
- attributes 'Build-OS': System.getProperty("os.name")
- attributes 'Built-By': System.getProperty("user.name")
- attributes 'Build-Jdk': System.getProperty("java.version")
- attributes 'Build-Timestamp': new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date())
- }
- }
- }
- license {
- encoding = "UTF-8"
- header = rootProject.file("license.txt")
- includes(["**/*.java", "**/*.kt"])
- exclude "**/test/**/*.kt"
- exclude "**/test/**/*.java"
- exclude "**/*Test.java"
- exclude "**/TableNameParser.java"
- exclude "**/Maps.java"
- mapping "java", "SLASHSTAR_STYLE"
- mapping "kt", "SLASHSTAR_STYLE"
- ignoreFailures = true
- }
- repositories {
- mavenLocal()
- maven { url "https://maven.aliyun.com/repository/public" }
- maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
- jcenter()
- }
- dependencies {
- annotationProcessor "${lib.lombok}"
- compileOnly "${lib.lombok}"
- testAnnotationProcessor "${lib.lombok}"
- testCompileOnly "${lib.lombok}"
- testImplementation "${lib["assertj-core"]}"
- testImplementation "${lib["junit-jupiter-api"]}"
- testRuntimeOnly "${lib["junit-jupiter-engine"]}"
- testImplementation "org.mockito:mockito-junit-jupiter:3.4.4"
- testImplementation "${lib["lagarto"]}"
- testImplementation "${lib["logback-classic"]}"
- }
- //noinspection GroovyAssignabilityCheck
- task sourcesJar(type: Jar) {
- archiveClassifier = 'sources'
- from sourceSets.main.allSource
- }
- javadoc {
- afterEvaluate {
- configure(options) {
- encoding "UTF-8"
- charSet 'UTF-8'
- author true
- version true
- failOnError false
- links "http://docs.oracle.com/javase/8/docs/api"
- }
- }
- }
- test {
- dependsOn("cleanTest", "generatePomFileForMavenJavaPublication")
- useJUnitPlatform()
- exclude("**/generator/**")
- exclude("**/mysql/**")
- exclude("**/phoenix/**")
- }
- task javadocJar(type: Jar) {
- archiveClassifier = 'javadoc'
- from javadoc
- }
- tasks.whenTaskAdded { task ->
- if (task.name.contains('signMavenJavaPublication')) {
- task.enabled = new File(project.property('signing.secretKeyRingFile') as String).isFile()
- }
- }
- 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 {
- def root = asNode()
- root.dependencies.'*'.findAll {
- def d = it
- d.scope.text() == 'runtime' && project.configurations.findByName("implementation").allDependencies.find { dep ->
- dep.name == it.artifactId.text()
- }.each() {
- d.scope*.value = 'compile'
- d.appendNode('optional', true)
- }
- }
- }
- }
- }
- }
- signing {
- sign publishing.publications.mavenJava
- }
- }
- }
|