Gradle无法解决IntelliJ中的Sonatype Nexus依赖关系 [英] Gradle unable to resolve Sonatype Nexus dependency in IntelliJ

查看:253
本文介绍了Gradle无法解决IntelliJ中的Sonatype Nexus依赖关系的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在新的IntelliJ项目中使用Gradle.我们有一个内部的Sonatype Nexus存储库,我已经在build.gradle中声明了它.我还将依赖性添加到了构建脚本中.

I am using Gradle in a new IntelliJ project. We have an internal Sonatype Nexus repository and I have declared that in build.gradle. I also added the dependency to the build script.

group 'com.companyName'
version '1.0-SNAPSHOT'

apply plugin: 'java'

sourceCompatibility = 1.8

repositories {
    mavenCentral()
    maven{
        url 'http://host:port/nexus/content/repositories/releases'
    }
}

dependencies {
    testCompile group: 'junit', name: 'junit', version: '4.11'
    compile group: 'com.companyName', name:'abc', version: '2.2.7'
}

您可以说这是一个全新的项目. IntelliJ将构建项目,但不会解决外部依赖关系.当我在IntelliJ中的Gradle项目视图中查看时,在依赖项下有一条红色的波浪线,其显示为Unable to resolve dependency.我知道依赖项存在,并且可以在Maven项目中使用它.

As you can tell this is a brand new project. IntelliJ will build the project but wont resolve the external dependency. When I look in the Gradle projects view in IntelliJ there is a red squiggly line under the dependency and it says Unable to resolve dependency. I know the dependency exists and I can use it in Maven projects.

我一直没有解决任何问题,也尝试过intelliJ项目中的所有不同设置.有什么想法吗?

I've search around without any solution, tried all different settings in the intelliJ project also. Any ideas?

推荐答案

来自原始帖子的讨论评论:

From discussion comments on the original post:

似乎某些缓存已损坏. 删除项目中的.gradle文件夹和~/.gradle/caches,然后尝试再次解决依赖关系.

There seem some caches be corrupt. Delete the .gradle folder in your project and ~/.gradle/caches, then try to resolve the dependencies again.

这篇关于Gradle无法解决IntelliJ中的Sonatype Nexus依赖关系的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆