首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >找不到org.springframework.boot:spring-boot-dependencies:2.6.1

找不到org.springframework.boot:spring-boot-dependencies:2.6.1
EN

Stack Overflow用户
提问于 2022-01-07 16:10:30
回答 2查看 3.5K关注 0票数 0

我遵循这里最新的spring.framework.boot插件的说明。

我的build.gradle

代码语言:javascript
运行
复制
plugins {
  id 'java-library'
  id 'eclipse'
  id 'io.spring.dependency-management' version '1.0.11.RELEASE'
  id 'org.springframework.boot' version '2.6.2'
  id 'org.springframework.boot.experimental.thin-launcher' version '1.0.23.RELEASE'
}

但是gradle任务有一个错误

代码语言:javascript
运行
复制
> Could not resolve all dependencies for configuration ':detachedConfiguration1'.
   > Could not find org.springframework.boot:spring-boot-dependencies:2.6.2.

我忽略了添加错误描述的最后一行,这对回答错误非常重要。

代码语言:javascript
运行
复制
 Searched in the following locations:
   - https://repo.spring.io/snapshot/org/springframework/boot/spring-boot-dependencies/2.6.2/spring-boot-dependencies-2.6.2.pom
   - https://repo.spring.io/milestone/org/springframework/boot/spring-boot-dependencies/2.6.2/spring-boot-dependencies-2.6.2.pom
EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2022-01-07 17:25:44

感谢上面的@granadaCoder,在将Gradle重新安装到最新版本的7.3.3之后,实际的问题是第二个存储库设置已经进入了我的build.gradle

代码语言:javascript
运行
复制
repositories {
  maven { url "https://repo.spring.io/snapshot" }
  maven { url "https://repo.spring.io/milestone" }
}

这正是错误说找不到依赖项的地方。我把这个换成了

代码语言:javascript
运行
复制
repositories {
  mavenCentral()
}

事情就开始起作用了。

票数 1
EN

Stack Overflow用户

发布于 2022-01-07 16:36:09

下面是一个完整的文件作为示例:(这是根build.gradle) (如果您编写了一个monolith,您将只有一个根build.gradle,如果您编写了多个"gradle模块“,您将有一个根和子项目build.gradle文件)(如果您不知道我在说什么--参见下面的docs.gradle.org链接)

(您可以删除依赖项,但我更喜欢完全工作)

代码语言:javascript
运行
复制
plugins {
    id 'org.springframework.boot' version '2.6.2'
    id 'io.spring.dependency-management' version '1.0.11.RELEASE'
    id 'java'
}

group = 'com.example'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '11'

repositories {
    mavenCentral()
}

dependencies {
    implementation 'org.springframework.boot:spring-boot-starter-actuator'
    implementation 'org.springframework.boot:spring-boot-starter-batch'
    implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
    implementation 'org.springframework.boot:spring-boot-starter-data-ldap'
    implementation 'org.springframework.boot:spring-boot-starter-integration'
    implementation 'org.springframework.boot:spring-boot-starter-oauth2-client'
    implementation 'org.springframework.boot:spring-boot-starter-oauth2-resource-server'
    implementation 'org.springframework.boot:spring-boot-starter-security'
    implementation 'org.springframework.boot:spring-boot-starter-web'
    implementation 'org.springframework.boot:spring-boot-starter-web-services'
    implementation 'org.springframework.boot:spring-boot-starter-webflux'
    developmentOnly 'org.springframework.boot:spring-boot-devtools'
    implementation 'com.h2database:h2'
    implementation 'mysql:mysql-connector-java'


    testImplementation 'org.springframework.boot:spring-boot-starter-test'
    testImplementation 'io.projectreactor:reactor-test'
    testImplementation 'org.springframework.batch:spring-batch-test'
    testImplementation 'org.springframework.integration:spring-integration-test'
    testImplementation 'org.springframework.security:spring-security-test'
}

test {
    useJUnitPlatform()
}


allprojects {

    /* custom task to show dependencies.  run "gradle printAllDependencies" from commandline.  see https://stackoverflow.com/questions/44266687/how-to-print-out-all-dependencies-in-a-gradle-multi-project-build/54436979#54436979 */
    task printAllDependencies(type: DependencyReportTask) {}

}

或者,您也可以尝试“分级冲洗”。

代码语言:javascript
运行
复制
Gradle FLUSH Cache
(Optional, but preferred).  Close all instances of IntelliJ or any other Java IDE.

./gradlew --stop        
      OR
gradle --stop

(now delete the folders)

rm -rf $HOME/.gradle/caches/

rm -rf $HOME/.gradle/build-cache-tmp/

(now resume normal gradlew commands like:)

./gradlew clean build

或者,您也可以执行intelliJ“刷新”操作。

代码语言:javascript
运行
复制
(tested with IntelliJ version 2020.1 or later)
    Close IntelliJ.
    Delete the ".idea" folder off of the root folder.
    Re OPEN the project.
    Wait for Gradle imports and indices rebuild to complete
    Try the IDE build again.

And the big hammer: "Invalidate IntelliJ caches".  see https://www.jetbrains.com/help/rider/Cleaning_System_Cache.html and/or https://www.jetbrains.com/help/idea/invalidate-caches.html

如果您正在使用Eclipse或NetBeans或其他,则必须找到“等效”。这个想法是IDE变得“混乱”。

奖金

多级模块:

project.html

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/70624098

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档