为什么`sbt publishLocal`生成的ivy.xml没有配置`default`?

时间:2015-02-26 02:09:59

标签: dependencies sbt ivy

当我在某个sbt项目上运行sbt publishLocal时,发现生成的ivy.xml是这样的:

<?xml version="1.0" encoding="UTF-8"?>
<ivy-module version="2.0" xmlns:e="http://ant.apache.org/ivy/extra">
    <info organisation="com.thoughtworks" module="pact-jvm-provider-spring-mvc_2.11" revision="0.1" status="release" publication="20150225152253">
        <description>
        pact-jvm-provider-spring-mvc
        </description>
    </info>
    <configurations>
        <conf name="compile" visibility="public" description=""/>
        <conf name="runtime" visibility="public" description="" extends="compile"/>
        <conf name="test" visibility="public" description="" extends="runtime"/>
        <conf name="provided" visibility="public" description=""/>
        <conf name="optional" visibility="public" description=""/>

        <conf name="sources" visibility="public" description=""/>
        <conf name="docs" visibility="public" description=""/>
        <conf name="pom" visibility="public" description=""/>

    </configurations>
    <publications>
        <artifact name="pact-jvm-provider-spring-mvc_2.11" type="pom" ext="pom" conf="pom"/>
        <artifact name="pact-jvm-provider-spring-mvc_2.11" type="jar" ext="jar" conf="compile"/>
        <artifact name="pact-jvm-provider-spring-mvc_2.11" type="src" ext="jar" conf="sources" e:classifier="sources"/>
        <artifact name="pact-jvm-provider-spring-mvc_2.11" type="doc" ext="jar" conf="docs" e:classifier="javadoc"/>
    </publications>

    <dependencies>
        <dependency org="org.scala-lang" name="scala-library" rev="2.11.0" conf="compile->default(compile)"/>
        <dependency org="au.com.dius" name="pact-jvm-model_2.11" rev="2.1.11" conf="compile->default(compile)"/>
        <dependency org="au.com.dius" name="pact-jvm-consumer-junit_2.11" rev="2.1.10" conf="compile->default(compile)"/>
        <dependency org="org.springframework" name="spring-test" rev="4.1.3.RELEASE" conf="compile->default(compile)"/>
        <dependency org="org.springframework" name="spring-webmvc" rev="4.1.3.RELEASE" conf="compile->default(compile)"/>
        <dependency org="org.springframework" name="spring-context" rev="4.1.3.RELEASE" conf="compile->default(compile)"/>
        <dependency org="org.springframework" name="spring-core" rev="4.1.3.RELEASE" conf="compile->default(compile)"/>
        <dependency org="junit" name="junit" rev="4.12" conf="compile->default(compile)"/>
        <dependency org="javax.servlet" name="javax.servlet-api" rev="3.0.1" conf="compile->default(compile)"/>
        <dependency org="org.mockito" name="mockito-core" rev="1.9.5" conf="compile->default(compile)"/>
        <dependency org="org.specs2" name="specs2_2.11" rev="2.4.2" conf="test->default(compile)"/>
    </dependencies>
</ivy-module>

您可以看到所有依赖项都在使用配置compiletest,而不是default,并且那里没有default配置。

因此,当我想从另一个项目中使用它时,我必须明确指定compile配置:

compile group: "com.thoughtworks", name: "pact-jvm-provider-spring-mvc_2.11", version: "0.1", configuration: 'compile'

而不是简单的:

compile "com.reagroup:pact-jvm-provider-spring-mvc_2.11:0.1"

我检查了一些其他库,他们都声明了default并将其用作默认值。

所以我的问题是为什么sbt publishLocal会在没有default配置的情况下生成ivy.xml?

0 个答案:

没有答案