I'm pretty new to IVY. I'm trying to do the following:
I wanted to add http://mvnrepository.com to the repository list. I'm not sure if I have to define the correct pattern based on how it is defined under mvnrepository.
Also I want a specific library to be downloaded 开发者_JAVA技巧from there instead of from another repository.
This is my ivysettings file:
<ivysettings>
<properties file="build.properties" />
<settings defaultResolver="local-chain"/>
<resolvers>
<ibiblio name="ibiblio-maven2" m2compatible="true"/>
<ibiblio name="java-net-maven2" root="http://download.java.net/maven/2/" m2compatible="true" />
<ibiblio name="maven" root="http://mvnrepository.com/artifact/" m2compatible="true" />
<filesystem name="project-built" checksums="">
<ivy pattern="${repository.dir}/[module]-ivy.xml" />
<artifact pattern="${repository.dir}/[artifact].[ext]" />
</filesystem>
<chain name="local-chain">
<resolver ref="maven"/>
<resolver ref="ibiblio-maven2"/>
<resolver ref="java-net-maven2"/>
<resolver ref="project-built"/>
</chain>
</resolvers>
And this is my ivy file:
<ivy-module version="1.0">
<info organisation="project" module="com.project.test.framework" />
<dependencies>
<dependency org="commons-collections" name="commons-collections" rev="3.2"/>
<dependency org="commons-configuration" name="commons-configuration" rev="1.6"/>
<dependency org="commons-lang" name="commons-lang" rev="2.6"/>
<dependency org="commons-logging" name="commons-logging" rev="1.1"/>
<dependency org="junit" name="junit" rev="4.8"/>
<dependency org="org.seleniumhq.selenium" name="selenium" rev="2.0rc2"/>
<dependency org="net.sf.json-lib" name="json-lib" rev="2.4" conf="default->compile"/>
<dependency org="com.sun.jersey" name="jersey-core" rev="1.8" conf="default->compile"/>
<dependency org="com.sun.jersey" name="jersey-client" rev="1.8" conf="default->compile"/>
</dependencies>
Basically I want JSON to be downloaded from MAVEN mvnrepository. I thought that when I put maven into the first place it will get it from there and that's that. But it doesn't seem to be using mvnrep at all.
I do think it's configured the wrong way.. But I'm not sure how to do it right.
I did read a lot of posts about it, and I still don't feel that I know the solution.
Thanks for any kind of help!!
To force specific resolver for a module use something like this in your ivysettings.xml:
<ivysettings>
<properties file="build.properties" />
<settings defaultResolver="local-chain"/>
<resolvers>
<ibiblio name="ibiblio-maven2" m2compatible="true"/>
<ibiblio name="java-net-maven2" root="http://download.java.net/maven/2/" m2compatible="true" />
<ibiblio name="maven" root="http://mvnrepository.com/artifact/" m2compatible="true" />
<filesystem name="project-built" checksums="">
<ivy pattern="${repository.dir}/[module]-ivy.xml" />
<artifact pattern="${repository.dir}/[artifact].[ext]" />
</filesystem>
<chain name="local-chain">
<resolver ref="maven"/>
<resolver ref="ibiblio-maven2"/>
<resolver ref="java-net-maven2"/>
<resolver ref="project-built"/>
</chain>
</resolvers>
<modules>
<module organisation="json" resolver="maven"/>
</modules>
</ivysettings>
See the documentation for details.
Perhaps you are missing the returnFirst="true"
attribute from your chain.
精彩评论