buildscript { ext { springBootVersion = '2.6.3' springCloudVersion = "2021.0.1" springCloudAlibabaVersion = "2021.0.1.0" projectArtifactId = 'qtzl' projectGroupId = "com.qtzl" projectVersion = "1.0" isCommon = true imageVersion = System.getProperty("image.version", "v1"); } repositories { // 使用国内阿里云仓库,下载速度快 maven { url 'https://maven.aliyun.com/repository/gradle-plugin'} mavenCentral() } dependencies { classpath('com.bmuschko:gradle-docker-plugin:6.7.0') classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}") } } plugins { id 'java' id 'war' } apply plugin: 'org.springframework.boot' apply plugin: 'io.spring.dependency-management' apply plugin: 'com.bmuschko.docker-remote-api' apply plugin: 'com.bmuschko.docker-spring-boot-application' group 'smp' version '1.0-SNAPSHOT' repositories { maven { allowInsecureProtocol = true url "http://maven.aliyun.com/nexus/content/groups/public/" } mavenCentral() maven { allowInsecureProtocol = true url 'https://maven.aliyun.com/repository/public' } maven { credentials { username '626619cd2c14288da07d9e37' password '4Tfr(nr=4zMT' } allowInsecureProtocol = true url 'https://packages.aliyun.com/maven/repository/2221276-release-00he5T/' } maven { credentials { username '626619cd2c14288da07d9e37' password '4Tfr(nr=4zMT' } allowInsecureProtocol = true url 'https://packages.aliyun.com/maven/repository/2221276-snapshot-nkXv85/' } } dependencies { implementation group: 'com.alibaba', name: 'druid-spring-boot-starter', version: '1.2.6' implementation group: 'org.reflections', name: 'reflections', version: '0.9.11' implementation group: 'com.txffp.study', name: 'smp-protocol', version: '1.0.2' implementation group: 'com.txffp.study', name: 'api-core', version: '1.0.0' implementation 'org.springframework.boot:spring-boot-starter-data-jpa' implementation 'org.springframework.boot:spring-boot-starter-web' implementation group: 'org.springframework.boot', name: 'spring-boot-starter-validation' annotationProcessor "org.springframework.boot:spring-boot-configuration-processor" implementation group: 'cn.hutool',name:'hutool-all',version: '5.7.12' implementation 'cn.com.taiji.common:gly-common:5.1' implementation group: 'com.alibaba', name: 'fastjson', version: '2.0.4' implementation group: 'org.apache.commons', name: 'commons-lang3', version: '3.12.0' implementation group: 'org.springframework.boot', name: 'spring-boot-starter-data-redis' implementation 'org.springframework.cloud:spring-cloud-starter-openfeign' implementation 'org.mybatis.spring.boot:mybatis-spring-boot-starter:2.1.3' implementation 'tk.mybatis:mapper-spring-boot-starter:2.1.5' implementation 'com.alibaba:druid:1.1.9' implementation 'com.alibaba:druid-spring-boot-starter:1.1.9' implementation 'org.springframework.cloud:spring-cloud-starter-loadbalancer' implementation 'com.jcraft:jsch:0.1.55' implementation group: 'mysql', name: 'mysql-connector-java' implementation 'org.apache.httpcomponents:httpcore:4.4.6' implementation 'org.apache.httpcomponents:httpclient:4.5' implementation 'com.qtzl.record:logs:2.0.0-SNAPSHOT' implementation 'com.qtzl.record:dict:1.3.0-SNAPSHOT' implementation 'org.springframework.boot:spring-boot-starter-websocket' implementation 'com.squareup.okhttp3:okhttp:3.5.0' } dependencyManagement { imports { mavenBom "org.springframework.cloud:spring-cloud-dependencies:${springCloudVersion}" mavenBom "com.alibaba.cloud:spring-cloud-alibaba-dependencies:${springCloudAlibabaVersion}" } } task jarProtocol(type: Jar) { archiveBaseName = "${projectGroupId}" archiveAppendix = "${projectArtifactId}" archiveVersion = "${projectVersion}" // archiveClassifier = 'common' archiveExtension = 'jar' from("build/classes/java/main/com/qtzl/sample/request/") into('com/qtzl/sample/request/') } apply plugin: "maven-publish" publishing { publications { myPublication(MavenPublication) { groupId = "${projectGroupId}" artifactId = "${projectArtifactId}" version = "${projectVersion}" if (isCommon) { artifact jarProtocol } else { // 如果是war包填写components.web(需要javawar插件),如果是jar包填写components.java from components.java } } } repositories { maven { def snapshotsRepoUrl = null if ("${projectVersion}".contains("SNAPSHOT")) { snapshotsRepoUrl = "https://packages.aliyun.com/maven/repository/2221276-snapshot-nkXv85/" } else { snapshotsRepoUrl = "https://packages.aliyun.com/maven/repository/2221276-release-00he5T/" } url "$snapshotsRepoUrl" credentials { username = '626619cd2c14288da07d9e37' password = '4Tfr(nr=4zMT' } } } }