When I run sbt publishLocal
on a sbt project, and found the generated ivy.xml
is like this:
<?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>
You can see all the dependencies are using configuration compile
or test
, rather than default
, and there is no default
configuration there.
So when I want to use it from another project, I have to specify the compile
configuration explicitly like this:
compile group: "com.thoughtworks", name: "pact-jvm-provider-spring-mvc_2.11", version: "0.1", configuration: 'compile'
Instead of the simple one:
compile "com.reagroup:pact-jvm-provider-spring-mvc_2.11:0.1"
I check some other libraries and they all declared default
and use that as default.
So my question is why sbt publishLocal
will generate a ivy.xml without default
configuration?
来源:https://stackoverflow.com/questions/28733294/why-the-ivy-xml-generated-by-sbt-publishlocal-has-no-configuration-default