Gradle是否支持常春藤存储库的分类器? [英] Does Gradle support classifiers for Ivy repositories?

查看:89
本文介绍了Gradle是否支持常春藤存储库的分类器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试从基于分类器的Ivy存储库(在Artifactory中)检索Gradle依赖关系(以过滤包含本机代码的DLL以获取相关处理器体系结构的DLL)。我的build.gradle如下所示:

  repositories {
ivy {
name'prebuilts'
url$ {repositoryServer} / prebuilts
credentials {
username artifactoryUser
password artifactoryPassword
}
layout'pattern',{
artifact' [组织] / [模块] / [修订] / [工件]( - [分类器])。[ext]'
ivy'[organization] / [module] / [revision] / ivy- [revision]。 xml'
}
}
}

配置{
示例
}

依赖关系{
示例组:'ThirdParty',名称:'jogl_JSR-231',版本:'1.1.0.1',配置:'nativeRuntime',分类:'release_win32'
}

项目。 configurations.example.each {
println it
}

ivy.xml对于该依赖关系,如下所示:

 <?xml version =1.0encoding =UTF- 8standalone =yes?> 
< ivy-module version =2.0>
< info organization =ThirdPartymodule =jogl_JSR-231revision =1.1.0.1status =releasepublication =20130508143052/>
<配置>
< /配置>
<出版物>
< artifact name =joglBuildRecordtype =txtext =txtconf =archives/>
< / publications>
< dependencies />
< / ivy-module>

我得到以下错误:

 失败:生成失败并出现异常。 

*其中:
构建文件'C:\ tmp \gradle-scratch\dependencies-by-classifier\build.gradle'line:25

*出了什么问题:
评估根项目'依赖分类器'时出现问题。
>无法解析配置的所有依赖关系:示例。
>未找到Artifact'ThirdParty:jogl_JSR-231:1.1.0.1:release_win32 @ jar'。

*尝试:
使用--stacktrace选项运行以获取堆栈跟踪。使用--info或--debug选项运行以获取更多日志输出。

BUILD FAILED

我完全不知道我在做什么在这里做错了。它是分类器吗?如果我删除它,一切正常(尽管显然我没有得到我想要的)。

解决方案

常春藤不支持分类器。在Ivy文档中查看常春藤模式的语法: http:// ant.apache.org/ivy/history/latest-milestone/concept.html#patterns



你从哪里得到JOGL的Ivy定义?如果你自己做了,我会改变配置为:

 < conf name =nativeRuntime32... /> 
< conf name =nativeRuntime64... />
< conf name =nativeRuntimeextends =nativeRuntime32,nativeRuntime64... />

在Gradle中,您可以使用配置 nativeRuntime32 以获得您需要的工件。



如果您没有编写Ivy定义,则可以考虑要求JOGL开发人员添加更灵活的Ivy配置,以便人们可以更轻松地选择他们需要的工件。


I'm trying to retrieve Gradle dependencies from an Ivy repository (in Artifactory) based on a classifier (to filter DLLs containing native code to get just the ones for the relevant processor architecture). My build.gradle looks like this:

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
}

The ivy.xml for that dependency looks like this:

     <?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>

I get the following error:

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

I'm not at all sure what I'm doing wrong here. Is it the classifier? If I remove it everything works (although obviously I don't get what I want).

解决方案

Ivy does not support classifiers. See the syntax of Ivy patterns at the Ivy documentation: http://ant.apache.org/ivy/history/latest-milestone/concept.html#patterns

Where did you get the Ivy definition of JOGL? If you made it yourself I would change the configurations to:

<conf name="nativeRuntime32" .../>
<conf name="nativeRuntime64" .../>
<conf name="nativeRuntime" extends="nativeRuntime32,nativeRuntime64" .../>

In Gradle you can than use configuration nativeRuntime32 to get the artifacts that you need.

If you did not write the Ivy definition, you might consider asking the JOGL developers to add more flexible Ivy configurations so people can more easily select the artifacts they need.

这篇关于Gradle是否支持常春藤存储库的分类器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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