我将gradle构建脚本设置为解析我已安装到本地maven存储库的TeraData依赖项(此依赖项在Maven Central上不可用)。问题是当我执行.classpath
时生成gradle eclipse
文件时,eclipse插件无法解决这些依赖关系。
这是生成的.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>
这是我的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'
}
导致TeraData依赖关系无法解决的原因是什么?我该如何解决?
答案 0 :(得分:1)
您正在从mavenLocal解析buildscript依赖项,而不是您的项目依赖项。尝试在 buildscript块之后添加:
repositories {
mavenLocal()
}