让常春藤不要下载源代码和许可证文件 [英] make ivy not to download sources and license files
问题描述
有没有一种方法可以配置常春藤不下载源代码和内容?通过ivy.xml获得许可文件?
Is there a way to configure ivy not to download sources & license files via ivy.xml ?
我目前正在尝试使用默认的ivy仓库+ spring仓库.我的ivysettings.xml在下面:
I'm currently trying to use default ivy repos + spring repository. my ivysettings.xml is bellow:
<?xml version="1.0" encoding="ISO-8859-1"?>
<settings defaultResolver="springSource" />
<include url="${ivy.default.settings.dir}/ivysettings-public.xml" />
<include url="${ivy.default.settings.dir}/ivysettings-shared.xml" />
<include url="${ivy.default.settings.dir}/ivysettings-local.xml" />
<include url="${ivy.default.settings.dir}/ivysettings-main-chain.xml" />
<include url="${ivy.default.settings.dir}/ivysettings-default-chain.xml" />
<resolvers>
<chain name="springSource">
<url name="com.springsource.repository.bundles.release">
<ivy
pattern="http://repository.springsource.com/ivy/bundles/release/[organisation]/[module]/[revision]/[artifact]-[revision].[ext]" />
<artifact
pattern="http://repository.springsource.com/ivy/bundles/release/[organisation]/[module]/[revision]/[artifact]-[revision].[ext]" />
</url>
<url name="com.springsource.repository.bundles.external">
<ivy
pattern="http://repository.springsource.com/ivy/bundles/external/[organisation]/[module]/[revision]/[artifact]-[revision].[ext]" />
<artifact
pattern="http://repository.springsource.com/ivy/bundles/external/[organisation]/[module]/[revision]/[artifact]-[revision].[ext]" />
</url>
<ibiblio name="public" m2compatible="true" />
<ibiblio name="shared" m2compatible="true" />
<ibiblio name="local" m2compatible="true" />
<ibiblio name="main-chain" m2compatible="true" />
<ibiblio name="default-chain" m2compatible="true" />
</chain>
</resolvers>
推荐答案
使用ivy配置指定所需的映射到依赖关系的依赖关系(称为传递依赖关系):
Use ivy configurations to specify your desired mapping to the dependencies of your dependencies (Called transitive dependencies):
不知道您使用的是哪个Spring版本,此示例将下载spring 3.0版本:
Don't know what version of spring you're using, this example downloads spring version 3.0:
<ivy-module version="2.0">
<info organisation="com.myspotontheweb" module="demo"/>
<configurations>
<conf name="compile" description="Compile classpath"/>
</configurations>
<dependencies>
<dependency org="org.springframework" name="org.springframework.core" rev="3.0.0.RELEASE" conf="compile->default"/>
</dependencies>
</ivy-module>
在引用Maven模块配置时,请参考Maven 范围. Maven中的默认范围是 compile ,但是您可以引用任何其他公共范围.
When referencing a Maven module configurations refer to Maven scopes. The default scope in Maven would be compile, but you can reference any other public scope.
我正在使用一个简单得多的设置文件:
I'm using a much simpler settings file:
<ivysettings>
<settings defaultResolver="chain"/>
<resolvers>
<chain name="chain">
<ibiblio name="central" m2compatible="true"/>
<ibiblio name="spring-release" root="http://repository.springsource.com/maven/bundles/release" m2compatible="true"/>
<ibiblio name="spring-external" root="http://repository.springsource.com/maven/bundles/external" m2compatible="true"/>
</chain>
</resolvers>
</ivysettings>
我认为 ibiblio 解析器是与远程Maven存储库集成的最简单方法.我认为这个令人困惑的名称是历史悠久的,可以追溯到第一个Maven存储库站点的原始名称.您还需要另外指定 m2compatible 属性,因为原始的Maven 1存储库格式现在几乎是未知的.
In my opinion the ibiblio resolver is the easiest way to integrate with a remote Maven repository. I think the confusing name is historical, dating back to the original name of the first Maven repository site. You'll need to additionally specify the m2compatible attribute, since the original Maven 1 repository format is now almost unknown.
也许有一天,常春藤开发人员将创建一个新的"Maven"解析器,使新用户的生活更加轻松.
Perhaps one day the ivy developers will create a new "maven" resolver that will make life easier for new users.
这篇关于让常春藤不要下载源代码和许可证文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!