gpt4 book ai didi

java - 在父 build.gradle 中找不到 ID 为 spring-boot 的插件

转载 作者:搜寻专家 更新时间:2023-10-31 19:37:40 24 4
gpt4 key购买 nike

我有以下项目结构:

java /
构建.gradle
设置.gradle
项目A/
构建.gradle
项目B/
构建.gradle

当我输入以下代码时,例如projectA的build.gradle,

buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:1.2.6.RELEASE")
}
}

apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'spring-boot'
...

一切正常。

但是如果我把上面的代码放在Java的build.gradle中:

subprojects {
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:1.2.6.RELEASE")
}
}

apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'spring-boot'
...
}

运行gradle clean build时,一直报如下错误:

Plugin with id 'spring-boot' not found.

有人遇到过这个问题吗?为什么?

最佳答案

我想出了一个解决方案,但不知道为什么。将在周末花一些时间阅读文档...

将多项目build.gradle改成如下:

buildscript {
repositories {
mavenCentral()
}

dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:1.2.6.RELEASE")
}
}

subprojects {
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'spring-boot'
...
}

即将构建脚本移出子项目

关于java - 在父 build.gradle 中找不到 ID 为 spring-boot 的插件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33561168/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com