我一直在为Springboot使用gradle,它曾经很好,但是突然之间,gradle的构建就停止了。我不断地收到错误,说无法找到依赖项。
下面是分级代码:
plugins {
id 'org.springframework.boot' version '2.4.1'
id 'io.spring.dependency-management' version '1.0.10.RELEASE'
id 'java'
}
version = '0.0.1'
sourceCompatibility = '1.8'
repositories {
maven {
url 'https://repo1.maven.org/'
}
}
springBoot {
buildInfo()
}
ext {
set('springCloudServicesVersion', "2.4.1")
set('springCloudVersion', "2020.0.3")
}
dependencies {
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
implementation 'org.springframework.boot:spring-boot-starter-jdbc'
implementation 'org.springframework.boot:spring-boot-starter-thymeleaf'
implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'io.pivotal.spring.cloud:spring-cloud-services-starter-config-client'
compileOnly 'org.projectlombok:lombok'
runtimeOnly 'com.h2database:h2'
runtimeOnly 'com.microsoft.sqlserver:mssql-jdbc'
annotationProcessor 'org.projectlombok:lombok'
testImplementation('org.springframework.boot:spring-boot-starter-test') {
exclude group: 'org.junit.vintage', module: 'junit-vintage-engine'
}
implementation 'org.springframework.boot:spring-boot-starter-integration'
testImplementation('org.springframework.boot:spring-boot-starter-test')
testImplementation 'org.springframework.integration:spring-integration-test'
implementation 'org.springframework.integration:spring-integration-mail:5.5.1'
implementation group: 'javax.mail', name: 'mail', version: '1.5.0-b01'
implementation group: 'org.apache.velocity.tools', name: 'velocity-tools-generic', version: '3.0'
implementation 'org.jsoup:jsoup:1.14.1'
implementation 'com.microsoft.sqlserver:mssql-jdbc:7.4.1.jre8'
}
dependencyManagement {
imports {
mavenBom "io.pivotal.spring.cloud:spring-cloud-services-dependencies:${springCloudServicesVersion}"
mavenBom "org.springframework.cloud:spring-cloud-dependencies:${springCloudVersion}"
}
}
test {
useJUnitPlatform()
}我所犯的错误:
无法解决org.springframework.boot:spring-boot-dependencies:2.4.1.无法解决io.pivotal.spring.cloud:spring-cloud-services-dependencies:2.4.1.无法解决org.springframework.cloud:spring-cloud-dependencies:2020.0.3.
有什么想法吗?
发布于 2021-08-03 16:16:28
您的maven存储库是错误的。
变化
repositories {
maven {
url 'https://repo1.maven.org/'
}
}至
repositories {
mavenCentral()
}请参阅here关于如何在build.gradle文件中声明maven存储库的很好的说明。
https://stackoverflow.com/questions/68639367
复制相似问题