简体   繁体   English

Gradle Eclipse任务无法解决MavenLocal的依赖关系

[英]Gradle Eclipse task not resolving dependencies from MavenLocal

I have my gradle build script set to resolve a TeraData dependency that I have installed to my local maven repository (this dependency is not available on Maven Central). 我设置了gradle build脚本来解决我已安装到本地Maven存储库的TeraData依赖项(该依赖项在Maven Central上不可用)。 The problem is that the eclipse plugin fails to resolve these dependencies when generating the .classpath file when I execute gradle eclipse . 问题是当我执行gradle eclipse时,当生成.classpath文件时,eclipse插件无法解决这些依赖关系。

This is the generated .classpath , with the problematic classpath entries: 这是生成的.classpath ,其中包含有问题的类路径条目:

<?xml version="1.0" encoding="UTF-8"?>
<classpath>
    <classpathentry kind="output" path="bin"/>
    <classpathentry kind="src" path="src/main/java"/>
    <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
    <classpathentry sourcepath="D:/Users/Me/.gradle/this/one/is/good.jar" kind="lib" path="D:/Users/Me/.gradle/caches/modules-2/files-2.1/this/one/is/good.jar"/>
    <classpathentry kind="lib" path="D:/dev/workspaces/myworkspace/myproject/unresolved dependency - com.teradata.jdbc terajdbc4 15.10.00.09"/>
    <classpathentry kind="lib" path="D:/dev/workspaces/myworkspace/myproject/unresolved dependency - com.teradata.jdbc tdgssconfig 15.10.00.09"/>
</classpath>

This is my gradle.build script, largely copied directly from artifactory's recommended settings: 这是我的gradle.build脚本,大部分是直接从工件的推荐设置中复制的:

buildscript {
    repositories {
        maven {
            url 'https://dev.mycompany.com/artifactory/plugins-release'
            credentials {
                username = "${artifactory_user}"
                password = "${artifactory_password}"
            }
        }
        mavenLocal()
    }
    dependencies {
        classpath "org.jfrog.buildinfo:build-info-extractor-gradle:3.0.3"
    }
}

allprojects {
    apply plugin: "com.jfrog.artifactory"
    apply plugin: 'java'
    apply plugin: 'maven'
    apply plugin: 'eclipse'
}

artifactory {
    contextUrl = "${artifactory_contextUrl}"
    publish {
        repository {
            repoKey = 'libs-release-local'
            username = "${artifactory_user}"
            password = "${artifactory_password}"
            maven = true
        }
    }
    resolve {
        repository {
            repoKey = 'libs-release'
            username = "${artifactory_user}"
            password = "${artifactory_password}"
            maven = true
        }
    }
}

dependencies {
    /** Note: teradata must be manually installed to local maven repo. **/
    compile 'com.teradata.jdbc:terajdbc4:15.10.00.09'
    compile 'com.teradata.jdbc:tdgssconfig:15.10.00.09'
}

What is causing the TeraData dependencies to not be resolved? 是什么导致无法解析TeraData依赖关系? How can I fix it? 我该如何解决?

You're resolving buildscript dependencies from mavenLocal, but not your project dependencies. 您正在从mavenLocal解决buildscript依赖关系,而不是项目依赖关系。 Try adding this after the buildscript block: 尝试在buildscript块之后添加以下代码:

repositories {
    mavenLocal()
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM