Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
203 views
in Technique[技术] by (71.8m points)

springsource - make ivy not to download sources and license files

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>

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...