我创建了一个多模块的弹簧引导,每个模块都使用spring。
我的build.gradle
buildscript {
repositories {
mavenCentral()
}
}
plugins {
id 'org.springframework.boot' version '2.4.1'
id 'io.spring.dependency-management' version '1.0.10.RELEASE'
id 'java'
}
allprojects {
group = 'com.torenda'
sourceCompatibility = '11'
}
subprojects {
apply plugin: 'org.springframework.boot'
apply plugin: 'io.spring.dependency-management'
apply plugin: 'java'
repositories {
mavenCentral()
}
}
bootJar {
enabled = false
}语音的settings.gradle
rootProject.name = 'nvoice'
include ':invoice'
include ':payment'发票模块的build.gradle
description = 'invoice'
dependencies {
implementation 'org.springframework.boot:spring-boot-starter-data-r2dbc'
implementation 'org.springframework.boot:spring-boot-starter-webflux'
compileOnly 'org.projectlombok:lombok'
developmentOnly 'org.springframework.boot:spring-boot-devtools'
runtimeOnly 'io.r2dbc:r2dbc-postgresql'
runtimeOnly 'org.postgresql:postgresql'
annotationProcessor 'org.projectlombok:lombok'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
testImplementation 'io.projectreactor:reactor-test'
}
bootJar {
enabled = true
}当我尝试构建应用程序时,我得到了
失败:生成失败,出现异常。
问题所在:任务':bootRunMainClassName'.的执行失败
无法解决配置的所有依赖关系“:decachedConfiguration1”。无法解析外部依赖项org.springframework.boot:spring-boot-dependencies:2.4.1,因为没有定义存储库。要求:项目:
如您所见,存储库是在主gradle文件中定义的,我也在子项目部分中添加了它
发布于 2021-01-17 21:30:46
如果您在所有项目下移动存储库并删除buildscript,它就能工作:
plugins {
id 'org.springframework.boot' version '2.4.1'
id 'io.spring.dependency-management' version '1.0.10.RELEASE'
id 'java'
}
allprojects {
group = 'com.torenda'
sourceCompatibility = '11'
repositories {
mavenCentral()
}
}
subprojects {
apply plugin: 'org.springframework.boot'
apply plugin: 'io.spring.dependency-management'
apply plugin: 'java'
}
bootJar {
enabled = false
}https://stackoverflow.com/questions/65461931
复制相似问题