我想下载json-lib-2.3-jdk15.jar。我发现常春藤没有分类标签,所以我使用maven one,下面是ivy.xml
<ivy-module version="2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://ant.apache.org/ivy/schemas/ivy.xsd"
xmlns:m="http://ant.apache.org/ivy/maven">
<info organisation="xxxx" module="xxx" status="integration"/>
<dependencies>
<dependency org="net.sf.json-lib" name="json-lib" rev="2.3">
<artifact name="json-lib" type="jar" m:classifier="jdk15"/>
</dependency>
</dependencies>
</ivy-module>
和ivysetting.xml
<ivysettings>
<settings defaultResolver="default" />
<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"/>
<caches artifactPattern="[organisation]/[module]/([branch]/)[type]s/([platform]/)[artifact]-[revision](.[ext])" />
<resolvers>
<filesystem name="local">
<ivy
pattern="${ivy.local.default.root}/[organisation]/[module]/([branch]/)[revision]/ivy.xml" />
<artifact
pattern="${ivy.local.default.root}/[organisation]/[module]/([branch]/)[revision]/[type]s/([platform]/)[artifact](.[ext])" />
</filesystem>
<ibiblio name="public" m2compatible="true" usepoms="true" pattern="[organisation]/[module]/[revision]/[artifact]-[revision](-[classifier]).[ext]" />
<chain name="default" returnFirst="true">
<resolver ref="local" />
<resolver ref="public"/>
</chain>
</resolvers>
</ivysettings>
但我还是无法下载它。好像m:分类器不起作用。对此有何建议?感谢。
我终于找到了根本原因。我不应该使用
xmlns:m="http://ant.apache.org/ivy/maven
我应该使用
xmlns:m="http://ant.apache.org/ivy/extra
另一件事,在我的情况下,我在“artifact”标签中添加“conf”分发,这将使jar下载失败。所以不要在“工件”中添加“conf”。
答案 0 :(得分:1)
适合我......你使用的是什么版本的常春藤?
以下示例包含一些建议的增强功能
Apache Ant(TM) version 1.8.2
Apache Ivy 2.3.0-rc2
<ivy-module version="2.0" xmlns:m="http://ant.apache.org/ivy/maven">
<info organisation="xxxx" module="xxx"/>
<configurations>
<conf name="jdk15" description="JDK 1.5 dependencies"/>
</configurations>
<dependencies>
<dependency org="net.sf.json-lib" name="json-lib" rev="2.3" conf="jdk15->master">
<artifact name="json-lib" type="jar" m:classifier="jdk15"/>
</dependency>
</dependencies>
</ivy-module>
注意:
<ivysettings>
<settings defaultResolver="central" />
<resolvers>
<ibiblio name="central" m2compatible="true"/>
</resolvers>
</ivysettings>
注意: