我正在尝试构建一个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'我怎样才能建造这个呢?
发布于 2019-12-17 09:54:57
我也有同样的问题。我看没有答案,虽然我迟到了,但这可能对其他人有帮助。
从可用位置复制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.我从/Users/pradeepbehera/settings.gradle复制/Users/pradeepbehera/settings.gradle文件并粘贴到/Users/pradeepbehera/Downloads/ud867-master/1.04-Demo-GroovyClosuresAndObjects。
然后一切都很顺利。
发布于 2020-04-21 22:19:58
我也遇到了同样的问题:
'Users/Shared/myProject/theDirectory/settings.gradle.:项目目录‘User/Shared/myProject/theDirectory/src/test不是由设置文件定义的构建的一部分
问题是,我从一个终端窗口运行gradle,该窗口在目录结构中的基础太低。
修复:只需更改终端窗口cd ..中的目录
因此,对我来说,我只是将目录级别备份到:"myProject“文件夹和boom...simple gradle工作。
发布于 2020-04-06 11:22:44
我最近也遇到了同样的问题,这也使我想到了这个问题。
在我的例子中,我试图从错误的路径‘./project/someFolder’构建jar,并将我的路径更正为‘./project’。
https://stackoverflow.com/questions/56293162
复制相似问题