微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

在 gradle 中将 Spring boot 从 1.5.2.RELEASE 升级到 2.3.5.RELEASE

如何解决在 gradle 中将 Spring boot 从 1.5.2.RELEASE 升级到 2.3.5.RELEASE

我正在 gradle 中更新 spring boot 版本。我之前发布了相关问题 here。以下是我的 build.gradle

 buildscript {
            ext {
                springBootVersion = '2.3.5.RELEASE'
            }
            repositories {
                maven { url "https://artifactory.domain.com/mavenrepo" }
                maven { url "https://artifactory.domain.com/maven.atlassian.com-cache" }
            }
            dependencies {
                classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
                classpath "gradle.plugin.com.github.sherter.google-java-format:google-java-format-gradle-plugin:0.6"
            }
        }
        
        apply plugin: "com.github.sherter.google-java-format"
        apply plugin: 'java'
        apply plugin: 'eclipse'
        apply plugin: 'idea'
        apply plugin: 'org.springframework.boot'
        
        apply plugin: 'findbugs'
        apply plugin: 'maven-publish'
        
        group = 'com.domain.xyz.myapp'
        version = '1.0.1-SNAPSHOT'
        
        repositories {
            maven { url "https://artifactory.domain.com/mavenrepo" }
        }
        project.tasks.findAll { it.name.startsWith("publish") } .each { it.dependsOn assemble }
        
        springBoot {
            classifier = 'boot'
        }
        
        publishing {
            publications {
                maven(MavenPublication) {
                    artifact ("$buildDir/libs/$project.name-$version-boot.jar") {
                        classifier = 'boot'
                    }
                }
            }
            
            repositories {
                maven {
                    url "http://artifactory.xyz.com:8080/project-snapshots"
                     credentials {
                        username = "publish-username"
                        password = "publish-password"
                    }
                }
            }
        }
        
        
        tasks.withType(FindBugs) {
            reports {
                xml.enabled false
                html.enabled true
            }
        }
        
        configurations {
            all*.exclude group: 'javax.servlet',module: 'servlet-api'
        }
        
        dependencies {
            compileOnly('org.projectlombok:lombok:1.16.14')
            compile('org.springframework.boot:spring-boot-starter-actuator')
            compile('org.springframework.boot:spring-boot-starter-cache')
            compile('org.springframework.boot:spring-boot-starter-data-jpa')
            compile('org.springframework.boot:spring-boot-starter-data-ldap')
            compile('org.springframework.boot:spring-boot-starter-web')
            compile('org.springframework.boot:spring-boot-starter-batch')
            compile('org.springframework.boot:spring-boot-starter-jdbc')
            compile('org.springframework:spring-web')
            compile('com.google.guava:guava:r05')
          runtime('MysqL:mysql-connector-java:8.0.16')
            runtime('org.hsqldb:hsqldb:2.3.3')
            runtime('org.springframework.boot:spring-boot-devtools')
            testCompile('org.springframework.boot:spring-boot-starter-test')
            testCompile('com.jayway.jsonpath:json-path')
            compile('com.jcraft:jsch:0.1.53')
            compile('net.sourceforge.jtds:jtds:1.3.1')
            compile('jcifs:jcifs:1.3.17')
            compile('org.apache.camel:camel-core:2.15.0')
            compile('com.github.ulisesbocchio:jasypt-spring-boot-starter:1.9')
            compile('io.micrometer:micrometer-registry-prometheus:1.0.3')
            compile('io.micrometer:micrometer-spring-legacy:1.0.3')
        }

最初我得到了

未能应用插件 [id 'org.springframework.boot'] Spring Boot 插件需要 Gradle 5(仅 5.6.x)或 Gradle 6(6.3 或更高版本)。这 当前版本是 Gradle 4.7

我通过使用 ./gradlew 而不是 gradle 解决了这个问题,并在 gradle-wrapper 的分发属性中使用了 5.6.2 版本。

但现在我遇到了问题

 Could not set unkNown property 'classifier' for object of type org.springframework.boot.gradle.dsl.SpringBootExtension.

我在某处读到我们需要使用 archiveClassifier 而不是分类器,然后它也说了同样的事情。

我缺少什么?

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐


Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其他元素将获得点击?
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。)
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbcDriver发生异常。为什么?
这是用Java进行XML解析的最佳库。
Java的PriorityQueue的内置迭代器不会以任何特定顺序遍历数据结构。为什么?
如何在Java中聆听按键时移动图像。
Java“Program to an interface”。这是什么意思?