Gradle 下载旧的编译依赖项

RafalLoves工作

我正在使用spring-boot和gradle。我想使用最新的 selenium 版本,但是包括驱动程序在内的一半编译依赖项是 3.14 版本。我尝试使缓存无效,./gradlew clean build, ./gradlew build --refresh-dependencies,但它没有帮助。我的旧项目具有相同的依赖项(但没有 spring-boot),我这个问题不存在。

import org.gradle.api.tasks.testing.logging.TestExceptionFormat

plugins {
    id 'org.springframework.boot' version '2.6.7'
    id 'io.spring.dependency-management' version '1.0.11.RELEASE'
    id 'java'
}

group = 'xxx.xxxxxx'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '17'

configurations {
    compileOnly {
        extendsFrom annotationProcessor
    }
}

repositories {
    mavenCentral()
}

dependencies {
    implementation 'org.springframework.boot:spring-boot-starter'
    compileOnly 'org.projectlombok:lombok'
    annotationProcessor 'org.projectlombok:lombok'
    testImplementation 'org.springframework.boot:spring-boot-starter-test'

    // https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-java
    implementation 'org.seleniumhq.selenium:selenium-java:4.1.4'
    // https://mvnrepository.com/artifact/org.testng/testng
    testImplementation 'org.testng:testng:7.5'
    // https://mvnrepository.com/artifact/io.rest-assured/rest-assured
    testImplementation 'io.rest-assured:rest-assured:4.5.1'
    // https://mvnrepository.com/artifact/io.github.bonigarcia/webdrivermanager
    implementation 'io.github.bonigarcia:webdrivermanager:5.1.1'
    // https://mvnrepository.com/artifact/com.github.javafaker/javafaker
    implementation 'com.github.javafaker:javafaker:1.0.2'
    // https://mvnrepository.com/artifact/org.assertj/assertj-core
    testImplementation 'org.assertj:assertj-core:3.22.0'

}

test {
    useTestNG()

    testLogging {
        exceptionFormat(TestExceptionFormat.FULL)
    }

    systemProperties(System.getProperties())
}

旧依赖

邓尼

Spring Boot 管理 Selenium 的版本,因此在您的情况下,您只指定了 的版本selenium-java,所有其他版本都由 Spring Boot 管理。要正确更新所有 Selenium 依赖项,您必须覆盖 Selenium 版本的属性:

ext['selenium.version'] = '4.1.4'

并从 selenium-java 条目中删除版本:

implementation 'org.seleniumhq.selenium:selenium-java'

您可以在文档中找到 Spring Boot 管理的库的所有可用属性:https ://docs.spring.io/spring-boot/docs/2.6.7/reference/htmlsingle/#appendix.dependency-versions.properties

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章