gradle下载旧的编译依赖项

发布于 2025-01-25 08:25:25 字数 1987 浏览 2 评论 0 原文

我正在使用Spring-Boot和Gradle。我想使用最新的硒版本,但是包括驱动程序在内的一半的编译依赖性是3.14版本。我尝试了使缓存无效的 ./ gradlew Clean Build ./ gradlew build -refresh-depentencies ,但这无济于事。我的较旧项目具有相同的依赖关系(但没有弹簧靴),我这个问题不存在。

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())
}

I am using spring-boot and gradle. I want to use latest selenium version, however half of compile dependencies, including drivers, are somehow 3.14 version. I tried invalidating caches, ./gradlew clean build, ./gradlew build --refresh-dependencies, but it doesn't help. My older project has the same dependencies (but no spring-boot) and I this issue is not present.

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())
}

old dependencies

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

携余温的黄昏 2025-02-01 08:25:25

Spring Boot管理了Selenium的版本,因此在您的情况下,您仅指定了 Selenium-Java 的版本,所有其他版本均由Spring Boot管理。要正确更新所有Selenium依赖关系,您必须覆盖硒版的属性:

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

并从Selenium-Java条目中删除版本:

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

您可以在文档中找到由Spring Boot管理的库的所有可用属性:

Spring Boot manages the versions for Selenium, so in your case you only specified the version for selenium-java, all other versions were managed by Spring Boot. To properly update all Selenium dependencies, you have to override the property for the Selenium version:

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

and remove the version from the selenium-java entry:

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

You can find all available properties for libraries managed by Spring Boot in the documentation: https://docs.spring.io/spring-boot/docs/2.6.7/reference/htmlsingle/#appendix.dependency-versions.properties

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文