gradle下载旧的编译依赖项
我正在使用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())
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Spring Boot管理了Selenium的版本,因此在您的情况下,您仅指定了
Selenium-Java
的版本,所有其他版本均由Spring Boot管理。要正确更新所有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:and remove the version from the selenium-java entry:
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