make ivy not to download sources and license files

被刻印的时光 ゝ 提交于 2019-11-28 10:01:41

问题


Is there a way to configure ivy not to download sources & license files via ivy.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>


回答1:


Use ivy configurations to specify your desired mapping to the dependencies of your dependencies (Called transitive dependencies):

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>

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.

Additional note

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>

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.

Perhaps one day the ivy developers will create a new "maven" resolver that will make life easier for new users.



来源:https://stackoverflow.com/questions/4355938/make-ivy-not-to-download-sources-and-license-files

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!