问题描述
Stackoverflow 包含一些关于这个问题的问题,但不幸的是,没有任何东西对我有用。例如,我读this
我的 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'
}
}
并且我尝试了关键字更改:true,我尝试了gradle clean build --refresh-dependencies,但没有任何效果对我有用。 gradle 显示我找不到快照依赖项。
我们是通过Jenkins来构建项目的,所以在自动化方面,不要每次都删除.gradle/cache。我 100% 确定快照依赖项在 nexus 存储库中可用。
Gradle 版本:6.6.1