Spring Security 如何更新我的build.gradle文件以更新当前的Spring版本?

juud5qan  于 2023-10-20  发布在  Spring
关注(0)|答案(1)|浏览(177)

以下是我当前的build.gradle文件:

plugins {
    id 'org.springframework.boot' version '2.3.4.RELEASE'
    id 'io.spring.dependency-management' version '1.0.10.RELEASE'
    id "io.freefair.lombok" version "5.0.1"
    id 'java'
    id 'war'
    id "org.sonarqube" version "3.3"
    id 'jacoco'
}

group = 'XXX.XXXX.XXX'
version = '1.1.0'
sourceCompatibility = '1.8'

repositories {
    maven {
        url 'https://XXXXXXXX.XXXX.XXX/XXXXXXXX/repo'
    }
    mavenCentral()
}

war {
    enabled = true
}

dependencies {
    runtimeOnly 'com.oracle.ojdbc:ojdbc8'

    implementation 'org.springframework.boot:spring-boot'
    implementation 'org.springframework.boot:spring-boot-starter-web'
    implementation 'org.springframework.boot:spring-boot-starter-validation'
    
    implementation 'org.apache.logging.log4j:log4j-api:2.17.1'
    implementation 'org.apache.logging.log4j:log4j-to-slf4j:2.17.1'
    
    implementation 'org.mybatis.spring.boot:mybatis-spring-boot-starter:2.1.3'
    
    implementation "io.springfox:springfox-swagger2:2.9.2"
    implementation 'io.springfox:springfox-swagger-ui:2.9.2'

    implementation fileTree(dir: 'src/main/libs', include: '*.jar')
    
    providedRuntime 'org.springframework.boot:spring-boot-starter-tomcat'
    
    testImplementation('org.springframework.boot:spring-boot-starter-test') {
        exclude group: 'org.junit.vintage', module: 'junit-vintage-engine'
    }
    testImplementation 'org.springframework.security:spring-security-test'
    
        testImplementation 'org.junit.jupiter:junit-jupiter-api:5.7.0'
    testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.7.0'
    testRuntimeOnly 'org.junit.platform:junit-platform-launcher:1.7.0'
    testImplementation 'org.junit.platform:junit-platform-console-standalone:1.9.2'
}

test {
    useJUnitPlatform()
       ignoreFailures = true
          finalizedBy jacocoTestReport
}

  jacocoTestReport {
        dependsOn test // tests are required to run before generating the report
        
     reports {
    xml.enabled true
    html.enabled true
    xml.destination = file(getBuildDir().toString() + File.separator.toString() + "jacoco" + File.separator.toString() + "coverage.xml")
    csv.enabled false
    html.destination = file(getBuildDir().toString() + File.separator.toString() + "jacoco" + File.separator.toString() + "html")
  }
    }

我试着改变版本号和修改插件编号或依赖项,但我不确定在哪里或什么改变。我正在尝试通过使用Eclipse或手动更改build.gradle编号来更新spring版本。如何更新build.gradle文件以使用新的Spring版本- spring-security-core-5.3.4.RELEASE?

w51jfk4q

w51jfk4q1#

您应该更改org.springframework.boot,因为您使用spring Boot ,在您的情况下,您有2.3.4R,我建议您分2步迁移。
第一个:将版本更改为2.7.8,它可以很好地与您使用的jdk 8配合使用,这里您将在openapi中进行一些更改(建议sprinfox(swagger 2)与opendoc-api migration-guide,因为 Springfox在7.0版本中被弃用删除。0的openapi生成器。该项目似乎不再维护(最后一次提交是2020年10月14日)。它与Sping Boot 2.5一起工作。)依赖注入也会出现一些问题,你应该修复它),这就是我所想的。
第二步:从2.7.8 to 3.1.x这里是更有趣的,你应该有jdk 17也你将有migrion到最新的java版本,你可以找到更多的文章,关于如何做到这一点,关于spring-boot Migration Guide

相关问题