0

I am unable to resolve SNAPSHOT dependencies using ivy-2.3.0 and a nexus / maven 2 repo.

I have tried a couple of things but still it fails,

this part has been fixed: see my comment in the comment section.

the latest output I am getting is that the maven:classifier is not associated with an element. For this I need to fill in the namespace mapping and not sure how how this should look for maven and ivy for the classifier part.

my nexus is using timestamps.

my porject file

<project 
name="test" 
xmlns:ivy="antlib:org.apache.ivy.ant"
>

<ivy:settings file="ivysettings.xml" />

<ivy:retrieve pattern="[organisation]/[module]/[revision]/[artifact]-[revision](-[classifier]).[ext]" />

.....

my ivysettings file:

<?xml version="1.0" encoding="UTF-8"?>
<ivysettings>

     <!-- what should I put here for maven and ivy to use classifier? -->
     <namespace name="test">
      <rule>
        <fromsystem>
          <src org="systemorg"/>
          <dest org="A"/>
        </fromsystem>
        <tosystem>
          <src org="A"/>
          <dest org="systemorg"/>
        </tosystem>
      </rule>
    </namespace>


    <credentials host="nexus"
                         realm="Sonatype Nexus Repository Manager"
                         username="xyz" passwd="xyz"/>

    <property name="libs_snapshot"
                     value="http://nexus.host.com/nexus/content/repositories/libs_snapshot"/>

    <property 
        name="version_pattern"
        value="[organisation]/[module]/[revision]/[artifact]-[revision](-[classifier]).[ext]"
    />

    <settings defaultResolver="repos" />
    <resolvers>
        <chain name="repos">


            <ibiblio name="central" m2compatible="true"/>  
            <ibiblio 
                name="libs_snapshot"
                m2compatible="true" 
                pattern="${version_pattern}"
                root="${libs_snapshot}"
            />


        </chain>
    </resolvers>

</ivysettings>

my ivy.xml file:

<ivy-module version='2.0' xmlns:m="http://ant.apache.org/ivy/maven">
    <info 
        organisation="com.xyz" 
        module="chained-resolvers"
    />

    <dependencies>
        <dependency 
            org="com.xyz" 
            name="cache_store"
            rev="1.1-SNAPSHOT"
            changing="true"
         >
         <artifact name="cache_store" 
                m:classifier="mobile" 
                type="jar" ext="jar"/>
        </dependency>
    </dependencies>

</ivy-module>
Wayne
  • 3,359
  • 3
  • 30
  • 50
  • I manage to resolve the part where ivy is complaining that. maven:classifier is not associated with an element. add xmlns:m="http://ant.apache.org/ivy/maven" to the ivy module. line so: – Wayne Sep 02 '14 at 15:02
  • Problem is not clear to me. The following is an example of how to retrieve a snapshot artifact with a Maven classifier: http://stackoverflow.com/questions/7804253/how-to-dowload-multiple-maven-dependencies-in-ivy-with-different-classifiers/7815627#7815627 – Mark O'Connor Sep 02 '14 at 19:01

1 Answers1

0

Although I got error messages saying that ivy could not resolve the dependencies, there was actually http 401 errors saying that I was unauthorized.

By running the ant task with the parameter "-debug" revealed the real cause.

HTTP response status: 401 url=
CLIENT ERROR: Unauthorized url=

I had the security credentials added but there seemed to be a problem with the entry I had:

This one did not worked and solved my problem I had:

<credentials 
    host="server"
    realm="Sonatype Nexus Repository Manager"
    username="username" passwd="password"
/>

This one worked:

<credentials 
    host="server.xyz.com"
    realm="Sonatype Nexus Repository Manager"
    username="username" passwd="password"
/>
Wayne
  • 3,359
  • 3
  • 30
  • 50