|
| 1 | +// 编译脚本 |
| 2 | +buildscript { |
| 3 | + ext { |
| 4 | + springBootVersion = "2.7.0" |
| 5 | + springBoot3Version = "3.5.7" |
| 6 | + springBoot4Version = "4.0.0" |
| 7 | + mybatisPlusVersion = "3.5.14" |
| 8 | + mybatisSpringVersion = "2.1.2" |
| 9 | + p6spyVersion = "3.9.1" |
| 10 | + seataVersion = "1.4.2" |
| 11 | + h2Version = "2.2.224" |
| 12 | + commonsDbcp2Version = "2.10.0" |
| 13 | + atomikosVersion = "4.0.6" |
| 14 | + oracleUcpVersion = "23.4.0" |
| 15 | + hikaricpVersion = "2.4.13" |
| 16 | + beeCpVersion = "3.4.2" |
| 17 | + c3p0Version = "0.10.1" |
| 18 | + druidVersion = "1.2.27" |
| 19 | + } |
| 20 | + // 仓库配置 |
| 21 | + repositories { |
| 22 | + mavenLocal() |
| 23 | + maven { url 'https://maven.aliyun.com/repository/central' } |
| 24 | + maven { url 'https://maven.aliyun.com/repository/spring' } |
| 25 | + maven { url 'https://maven.aliyun.com/repository/google' } |
| 26 | + mavenCentral() |
| 27 | + } |
| 28 | + |
| 29 | + dependencies { |
| 30 | + classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}") |
| 31 | + classpath("com.vanniktech:gradle-maven-publish-plugin:0.32.0") |
| 32 | + } |
| 33 | +} |
| 34 | + |
| 35 | +description = "mybatis dynamic datasource" |
| 36 | + |
| 37 | +// 项目配置 |
| 38 | +allprojects { |
| 39 | + group APP_GROUP |
| 40 | + version APP_VERSION |
| 41 | +} |
| 42 | + |
| 43 | +// 子模块配置 |
| 44 | +subprojects { |
| 45 | + apply plugin: 'java-library' |
| 46 | + apply plugin: 'com.vanniktech.maven.publish' |
| 47 | + apply plugin: 'signing' |
| 48 | + apply plugin: 'io.spring.dependency-management' |
| 49 | + |
| 50 | + // 仓库配置 |
| 51 | + repositories { |
| 52 | + mavenLocal() |
| 53 | + maven { url 'https://maven.aliyun.com/repository/central' } |
| 54 | + maven { url 'https://maven.aliyun.com/repository/spring' } |
| 55 | + maven { url 'https://maven.aliyun.com/repository/google' } |
| 56 | + maven { url "https://oss.sonatype.org/content/repositories/snapshots/" } |
| 57 | + mavenCentral() |
| 58 | + } |
| 59 | + |
| 60 | + // 依赖管理 |
| 61 | + dependencyManagement { |
| 62 | + imports { |
| 63 | + mavenBom "org.springframework.boot:spring-boot-dependencies:${springBootVersion}" |
| 64 | + } |
| 65 | + |
| 66 | + dependencies { |
| 67 | + dependency("mysql:mysql-connector-java:8.0.33") |
| 68 | + |
| 69 | + // orm db |
| 70 | + dependency("com.baomidou:mybatis-plus-boot-starter:${mybatisPlusVersion}") |
| 71 | + dependency("com.baomidou:mybatis-plus-core:${mybatisPlusVersion}") |
| 72 | + |
| 73 | + } |
| 74 | + } |
| 75 | + |
| 76 | + // 依赖配置 |
| 77 | + dependencies { |
| 78 | + // 日志 |
| 79 | + api("org.slf4j:slf4j-api") |
| 80 | + |
| 81 | + // lombok |
| 82 | + compileOnly("org.projectlombok:lombok") |
| 83 | + annotationProcessor("org.projectlombok:lombok") |
| 84 | + testAnnotationProcessor("org.projectlombok:lombok") |
| 85 | + testCompileOnly("org.projectlombok:lombok") |
| 86 | + } |
| 87 | + |
| 88 | + // 编译环境 JDK-1.8+ |
| 89 | + sourceCompatibility = JavaVersion.VERSION_1_8 |
| 90 | + targetCompatibility = JavaVersion.VERSION_1_8 |
| 91 | + |
| 92 | + tasks.named('test') { |
| 93 | + useJUnitPlatform() |
| 94 | + } |
| 95 | + |
| 96 | + tasks.withType(JavaCompile).configureEach { |
| 97 | + options.compilerArgs << "-Xlint:unchecked" << "-Xlint:-serial" |
| 98 | + options.encoding = 'UTF-8' |
| 99 | + options.warnings = false |
| 100 | + options.deprecation = true |
| 101 | + options.compilerArgs += ["-parameters"] |
| 102 | + } |
| 103 | + |
| 104 | + tasks.withType(GenerateModuleMetadata).configureEach { |
| 105 | + enabled = false |
| 106 | + } |
| 107 | + |
| 108 | + tasks.register('sourcesJar', Jar) { |
| 109 | + dependsOn classes |
| 110 | + archiveClassifier = 'sources' |
| 111 | + from sourceSets.main.allSource |
| 112 | + } |
| 113 | + |
| 114 | + javadoc { |
| 115 | + options { |
| 116 | + encoding "UTF-8" |
| 117 | + charSet 'UTF-8' |
| 118 | + author true |
| 119 | + version true |
| 120 | + failOnError false |
| 121 | + links "https://docs.oracle.com/javase/8/docs/api" |
| 122 | + } |
| 123 | + } |
| 124 | + |
| 125 | + tasks.withType(MavenPublication).configureEach { |
| 126 | + doFirst { |
| 127 | + options.skipCertificateChecks = true |
| 128 | + } |
| 129 | + } |
| 130 | + |
| 131 | + tasks.register('javadocJar', Jar) { |
| 132 | + archiveClassifier = 'javadoc' |
| 133 | + from javadoc |
| 134 | + } |
| 135 | +} |
0 commit comments