我正在尝试基于分类器从 Ivy 存储库(在 Artifactory 中)检索 Gradle 依赖项(以过滤包含本机代码的 DLL 以获取相关处理器架构的那些)。我的 build.gradle 看起来像这样:
repositories {
ivy {
name 'prebuilts'
url "${repositoryServer}/prebuilts"
credentials {
username artifactoryUser
password artifactoryPassword
}
layout 'pattern', {
artifact '[organisation]/[module]/[revision]/[artifact](-[classifier]).[ext]'
ivy '[organisation]/[module]/[revision]/ivy-[revision].xml'
}
}
}
configurations {
example
}
dependencies {
example group: 'ThirdParty', name: 'jogl_JSR-231', version: '1.1.0.1', configuration: 'nativeRuntime', classifier: 'release_win32'
}
project.configurations.example.each {
println it
}
该依赖项的 ivy.xml 如下所示:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<ivy-module version="2.0">
<info organisation="ThirdParty" module="jogl_JSR-231" revision="1.1.0.1" status="release" publication="20130508143052"/>
<configurations>
<conf name="nativeRuntime" description="Native artifacts for running tests." visibility="public"/>
<conf name="archives" description="Configuration for archive artifacts." visibility="public"/>
<conf name="default" extends="runtime" description="Configuration for default artifacts." visibility="public"/>
<conf name="compile" description="Classpath for compiling the main sources." visibility="private"/>
<conf name="runtime" extends="compile" description="Classpath for running the compiled main classes." visibility="private"/>
<conf name="testCompile" extends="compile" description="Classpath for compiling the test sources." visibility="private"/>
<conf name="testRuntime" extends="runtime,testCompile" description="Classpath for running the compiled test classes." visibility="private"/>
<conf name="cppCompile" description="Configuration for API artifacts (headers)." visibility="public"/>
<conf name="nativeArchives" description="Configuration for native archive artifacts." visibility="public"/>
</configurations>
<publications>
<artifact name="gluegen-rt" type="jar" ext="jar" conf="archives,runtime"/>
<artifact name="jogl" type="jar" ext="jar" conf="archives,runtime"/>
<artifact xmlns:m="http://ant.apache.org/ant/maven" name="gluegen-rt" type="jar" ext="jar" conf="archives" m:classifier="sources"/>
<artifact xmlns:m="http://ant.apache.org/ant/maven" name="jogl" type="jar" ext="jar" conf="archives" m:classifier="sources"/>
<artifact xmlns:m="http://ant.apache.org/ant/maven" name="gluegen-rt" type="dll" ext="dll" conf="nativeArchives,nativeRuntime" m:classifier="release_win32"/>
<artifact xmlns:m="http://ant.apache.org/ant/maven" name="jogl" type="dll" ext="dll" conf="nativeArchives,nativeRuntime" m:classifier="release_win32"/>
<artifact xmlns:m="http://ant.apache.org/ant/maven" name="jogl_awt" type="dll" ext="dll" conf="nativeArchives,nativeRuntime" m:classifier="release_win32"/>
<artifact xmlns:m="http://ant.apache.org/ant/maven" name="jogl_cg" type="dll" ext="dll" conf="nativeArchives,nativeRuntime" m:classifier="release_win32"/>
<artifact xmlns:m="http://ant.apache.org/ant/maven" name="gluegen-rt" type="dll" ext="dll" conf="nativeArchives,nativeRuntime" m:classifier="release_x64"/>
<artifact xmlns:m="http://ant.apache.org/ant/maven" name="jogl" type="dll" ext="dll" conf="nativeArchives,nativeRuntime" m:classifier="release_x64"/>
<artifact xmlns:m="http://ant.apache.org/ant/maven" name="jogl_awt" type="dll" ext="dll" conf="nativeArchives,nativeRuntime" m:classifier="release_x64"/>
<artifact xmlns:m="http://ant.apache.org/ant/maven" name="jogl_cg" type="dll" ext="dll" conf="nativeArchives,nativeRuntime" m:classifier="release_x64"/>
<artifact name="joglBuildRecord" type="txt" ext="txt" conf="archives"/>
</publications>
<dependencies/>
</ivy-module>
我收到以下错误:
FAILURE: Build failed with an exception.
* Where:
Build file 'C:\tmp\gradle-scratch\dependencies-by-classifier\build.gradle' line: 25
* What went wrong:
A problem occurred evaluating root project 'dependencies-by-classifier'.
> Could not resolve all dependencies for configuration ':example'.
> Artifact 'ThirdParty:jogl_JSR-231:1.1.0.1:release_win32@jar' not found.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
我完全不确定我在这里做错了什么。是分类器吗?如果我删除它一切正常(尽管显然我没有得到我想要的)。