// 编译脚本 buildscript { ext { // https://start.spring.io/actuator/info springBootVersion = "3.3.0" mybatisPlusVersion = "3.5.9" } // 仓库配置 repositories { mavenLocal() maven { url 'https://maven.aliyun.com/repository/central' } maven { url 'https://maven.aliyun.com/repository/spring' } maven { url 'https://maven.aliyun.com/repository/google' } maven { url 'https://repo.spring.io/release' } maven { url 'https://repo.spring.io/milestone' } maven { url 'https://repo.spring.io/snapshot' } mavenCentral() } dependencies { classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}") } } description = "爱组搭低代码组件化开发平台" // 项目配置 allprojects { group "com.aizuda" version "1.0.2" } // 子模块配置 subprojects { apply plugin: 'java-library' apply plugin: 'maven-publish' apply plugin: 'signing' apply plugin: "io.spring.dependency-management" tasks.withType(JavaCompile) { options.encoding = 'UTF-8' options.warnings = false } // 仓库配置 repositories { mavenLocal() maven { url 'https://maven.aliyun.com/repository/central' } maven { url 'https://maven.aliyun.com/repository/spring' } maven { url 'https://maven.aliyun.com/repository/google' } maven { url 'https://repo.spring.io/release' } maven { url 'https://repo.spring.io/milestone' } maven { url 'https://repo.spring.io/snapshot' } mavenCentral() } configurations { all*.exclude group: "ch.qos.logback" all*.exclude module: "spring-boot-starter-logging" // 使用Undertow 替代Tomcat all*.exclude group: "org.apache.tomcat" all*.exclude group: "org.apache.tomcat.embed" all*.exclude module: "spring-boot-starter-tomcat" } // 依赖管理 dependencyManagement { imports { mavenBom "org.springframework.boot:spring-boot-dependencies:${springBootVersion}" } dependencies { // 文档 dependency("org.springdoc:springdoc-openapi-starter-common:2.5.0") dependency("jakarta.servlet:jakarta.servlet-api:6.1.0") // 工具类 dependency("org.jodd:jodd-bean:5.1.6") dependency("commons-io:commons-io:2.16.1") dependency("commons-collections:commons-collections:3.2.2") dependency("org.apache.commons:commons-lang3:3.14.0") dependency("com.lmax:disruptor:3.4.4") // 爱组搭 dependency("com.aizuda:aizuda-toolkit:1.0.0") // 单点登录 dependency("com.baomidou:kisso:3.9.3") // orm db dependency("com.baomidou:mybatis-plus-spring-boot3-starter:${mybatisPlusVersion}") dependency("com.baomidou:mybatis-plus-jsqlparser:${mybatisPlusVersion}") dependency("com.baomidou:mybatis-plus-generator:${mybatisPlusVersion}") dependency("com.baomidou:mybatis-plus-extension:${mybatisPlusVersion}") dependency("org.postgresql:postgresql:42.7.3") } } // 依赖配置 dependencies { compileOnly("org.projectlombok:lombok") annotationProcessor("org.projectlombok:lombok") testAnnotationProcessor("org.projectlombok:lombok") testCompileOnly("org.projectlombok:lombok") // 为了减少依赖 jar 体量,非公共依赖不要申明为 api 必须遵守在负责人同意允许后在对应项目中添加 compileOnly("org.springframework.boot:spring-boot-starter-log4j2") compileOnly("jakarta.servlet:jakarta.servlet-api") // 编译测试 testImplementation("org.springframework.boot:spring-boot-starter-test") } sourceCompatibility = JavaVersion.VERSION_17 targetCompatibility = JavaVersion.VERSION_17 tasks.withType(JavaCompile) { options.encoding = 'UTF-8' options.warnings = false options.deprecation = true options.compilerArgs += ["-parameters"] } tasks.withType(GenerateModuleMetadata) { enabled = false } task sourcesJar(type: Jar, dependsOn: classes) { archiveClassifier = '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/17/docs/api" } } 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://s01.oss.sonatype.org/service/local/staging/deploy/maven2/" // def snapshotsRepoUrl = "https://s01.oss.sonatype.org/content/repositories/snapshots/" // url = version.endsWith('SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl // // credentials { // username userName // password passWord // } // } maven { name = "Gitea" url = uri("http://git.aizuda.com/api/packages/aizuda/maven") allowInsecureProtocol = true credentials(HttpHeaderCredentials) { name = "Authorization" value = "token 7d725429ef7ac5c9fa9a6779f70032d6e42d7f34" } authentication { header(HttpHeaderAuthentication) } } } publications { mavenJava(MavenPublication) { from components.java // artifact sourcesJar artifact javadocJar pom { name = 'aizuda-framework' packaging 'jar' description = 'aizuda framework.' url = 'https://gitee.com/aizuda/aizuda-framework' 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://gitee.com/aizuda/aizuda-framework' } licenses { license { name = 'The Apache License, Version 2.0' url = 'https://www.apache.org/licenses/LICENSE-2.0.txt' } } developers { developer { id = 'aizuda' name = '青苗' 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 } } }