[英]Gradle refresh snapshot dependencies does not work
Stackoverflow 包含有關此問題的一些問題,但不幸的是,對我沒有任何作用。 例如,我讀了這個
我的 build.gradle 看起來像這樣:
plugins {
id 'org.springframework.boot' version '2.3.3.RELEASE'
id 'io.spring.dependency-management' version '1.0.10.RELEASE'
id 'java'
id 'java-library'
id 'maven-publish'
id 'net.linguica.maven-settings' version '0.5'
}
tasks.withType(Test) {
testLogging {
exceptionFormat "full"
events "started", "skipped", "passed", "failed"
showStandardStreams true
}
}
sourceCompatibility = '11'
targetCompatibility = '11'
mavenSettings {
userSettingsFileName project.getProperty('settingsXml')
}
configurations.all {
resolutionStrategy {
cacheDynamicVersionsFor 0, 'seconds'
cacheChangingModulesFor 0, 'seconds'
}
}
// This configuration is necessary for publishing spring boot jar
configurations {
[apiElements, runtimeElements].each {
it.outgoing.artifacts.removeIf { it.buildDependencies.getDependencies(null).contains(jar) }
it.outgoing.artifact(bootJar)
}
}
group 'com.something.company'
version '1.0.0-SNAPSHOT'
repositories {
maven {
name 'nexus.aliter.com'
url 'https://nexus.aliter.com/repository/cloud-maven/'
}
}
publishing {
publications {
mavenJava(MavenPublication) {
from components.java
}
}
repositories {
maven {
name 'nexus.aliter.com'
if(project.version.endsWith('-SNAPSHOT')) {
url 'https://nexus.repo.com/repository/maven-snapshots/'
} else {
url 'https://nexus.repo.com/repository/maven-releases/'
}
}
}
}
springBoot {
buildInfo()
}
test {
useJUnitPlatform()
}
dependencies {
implementation group: 'com.aliter.csp', name: 'security-lib', version: '1.0.0-SNAPSHOT'
implementation group: 'com.aliter.csp', name: 'adapter-lib', version: '1.0.0-SNAPSHOT'
}
我試過這個:
configurations.all {
resolutionStrategy {
cacheDynamicVersionsFor 0, 'seconds'
cacheChangingModulesFor 0, 'seconds'
}
}
我嘗試了關鍵字更改: true ,我嘗試了 gradle clean build --refresh-dependencies並且對我沒有任何作用。 gradle 顯示找不到快照依賴項。
我們通過Jenkins來構建項目,所以在自動化的問題上,不能每次都delete.gradle/cache。 我 100% 確定在 nexus 存儲庫中可以使用快照依賴項。
Gradle 版本:6.6.1
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.