Reputation: 1500
I configured ivy to go first maven local repo then remote. But something is going wrong! (By the way, im working with snapshots)
<ivysettings>
<settings defaultResolver="chain_resolver"/>
<credentials host="localhost"
realm="Sonatype Nexus Repository Manager"
username="username" passwd="password"/>
<property name="nexus.repo" value="url here"/>
<property name="nexus-public" value="http://${nexus.repo}:8081/nexus/content/groups/public"/>
<property name="m2-pattern" value="${user.home}/.m2/repository/[organisation]/[module]/[revision]/[module]-[revision](-[classifier]).[ext]"/>
<resolvers>
<chain name="chain_resolver">
<ibiblio name="nexus" m2compatible="true" root="${nexus-public}"/>
<filesystem name="local" m2compatible="true">
<artifact pattern="${m2-pattern}"/>
<ivy pattern="${m2-pattern}"/>
</filesystem>
</chain>
</resolvers>
</ivysettings>
<target name="ivy-download" unless="offline">
<mkdir dir="${ivy.dir}"/>
<get src="${repo_public}/org/apache/ivy/ivy/${ivy.ver}/ivy-${ivy.ver}.jar" dest="${ivy.jar}" usetimestamp="true"/>
</target>
<target name="ivy-install" depends="ivy-download">
<path id="ivy.lib.path">
<fileset file="${ivy.jar}"/>
</path>
<taskdef resource="org/apache/ivy/ant/antlib.xml" uri="antlib:org.apache.ivy.ant" classpathref="ivy.lib.path"/>
<ivy:settings file="ivysettings.xml" />
</target>
<target name="lib.get">
<mkdir dir="${lib.dir}"/>
<ivy:retrieve type="jar" conf="lib" pattern="${lib.dir}/[artifact]-[revision].[ext]"/>
</target>
<target name="ivy.lib.get" depends="ivy-install" if="${skipClean}">
<antcall target="lib.get" />
</target>
<target name="ivy.clean.lib.get" depends="ivy-install" unless="${skipClean}">
<ivy:cleancache/>
<antcall target="lib.get" />
</target>
How can I check
And there is one more possible situation here which is, if there is a change in remote and local at the same time, what should I do?
Upvotes: 2
Views: 1685
Reputation: 77991
Ivy has a local cache dedicated to that purpose. Improving performance by avoiding repeated download of the same artifact. Maven, on the other hand, uses its local repository as a cache (Ivy keeps these concepts separate).
The one operational problem with caches is that over time they become dirty, especially when sharing "integration" or "snapshot" builds.
For this reason I suggest you stop pointing ivy at the Maven local cache for the following reasons:
My suggestion is simplify everything by introducing a Maven repository manager like Nexus, in order to both cache files from Maven Central and host artifacts shared between project builds.
Upvotes: 0