gpt4 book ai didi

gradle - build.gradle 不是设置文件定义的构建的一部分

转载 作者:行者123 更新时间:2023-12-02 00:52:44 25 4
gpt4 key购买 nike

我正在尝试构建 Gradle 文件并收到错误 Build file '.../build.gradle' is not part of the build defined by settings file '.../settings.gradle'. If this is an unrelated build, it must have it's own settings file.
这是我的 build.gradle:

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

apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'idea'
apply plugin: 'org.springframework.boot'
apply plugin: 'io.spring.dependency-management'

bootJar {
baseName = 'gs-securing-web'
version = '0.1.0'
}

repositories {
mavenCentral()
}

sourceCompatibility = 1.8
targetCompatibility = 1.8

dependencies {
compile("org.springframework.boot:spring-boot-starter-thymeleaf")
compile("org.springframework.boot:spring-boot-starter-web")
// tag::security[]
compile("org.springframework.boot:spring-boot-starter-security")
// end::security[]
testCompile("junit:junit")
testCompile("org.springframework.boot:spring-boot-starter-test")
testCompile("org.springframework.security:spring-security-test")
}

这是我的 settings.gradle:
/*
* This settings file was generated by the Gradle 'init' task.
*
* The settings file is used to specify which projects to include in your build.
* In a single project build this file can be empty or even removed.
*
* Detailed information about configuring a multi-project build in Gradle can be found
* in the user guide at https://docs.gradle.org/4.0/userguide/multi_project_builds.html
*/

/*
// To declare projects as part of a multi-project build use the 'include' method
include 'shared'
include 'api'
include 'services:webservice'
*/

rootProject.name = 'gs-securing-web'

我如何得到这个建立?

最佳答案

我有同样的问题。我看到没有答案,虽然我迟到了,但这可能对其他人有帮助。

从可用位置复制 settings.gradle 文件并将其粘贴到所需位置。

在我的情况下,错误是 -

* What went wrong:
Project directory '/Users/pradeepbehera/Downloads/ud867-master/1.04-Demo-GroovyClosuresAndObjects' is not part of the build defined by settings file '/Users/pradeepbehera/settings.gradle'. If this is an unrelated build, it must have its own settings file.

我复制了 settings.gradle文件来自 /Users/pradeepbehera/settings.gradle并粘贴在 /Users/pradeepbehera/Downloads/ud867-master/1.04-Demo-GroovyClosuresAndObjects .

然后它工作得很好。

关于gradle - build.gradle 不是设置文件定义的构建的一部分,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56293162/

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