2
votes

I'm coming from a Maven background. The project I am working on is not Java based. However, it is a requirement to use standalone Ivy for the dependency management. The repository manager is Nexus.

The project produces several zip artifacts and needs to deploy them to Nexus via standalone Ivy. I would like an analogue of Maven classifiers, but for Ivy.

This is my ivysettings.xml:

<ivysettings>
    <settings defaultResolver="nexus"/>
        <credentials host="localhost"
                     realm="Sonatype Nexus Repository Manager"
                     username="user"
                     passwd="pass"/>

    <property name="nexus-public"
              value="http://localhost:8081/nexus/content/groups/public"/>
    <property name="nexus-releases"
              value="http://localhost:8081/nexus/content/repositories/releases"/>
    <property name="nexus-snapshots"
              value="http://localhost:8081/nexus/content/repositories/snapshots"/>

    <resolvers>
        <ibiblio name="nexus"
                 m2compatible="true"
                 root="${nexus-public}"/>
        <ibiblio name="nexus-releases"
                 m2compatible="true"
                 root="${nexus-releases}"/>
        <ibiblio name="nexus-snapshots"
                 m2compatible="true"
                 root="${nexus-snapshots}"
                 checkmodified="true"
                 changingPattern="*-SNAPSHOT"/>
    </resolvers>
</ivysettings>

I have the following ivy.xml:

<ivy-module version="2.0">
    <info organisation="kung.fu" module="ninja" revision="1.2.3"/>

    <publications>
        <artifact name="ninja" type="zip" ext="zip"/>
        <artifact name="ninja" type="win32" ext="zip"/>
        <artifact name="ninja" type="linux-x32" ext="zip"/>
        <artifact name="ninja" type="linux-x64" ext="zip"/>
    </publications>
</ivy-module>

I am trying to deploy to Nexus as follows:

java -jar /path/to/ivy.jar
     -settings /path/to/.ivy/ivysettings.xml
     -ivy ivy.xml
     -publish nexus-releases
     -publishpattern "target/[artifact]-[revision](-[classifier]).[ext]"
     -revision 1.2.3
     -status released
     -overwrite

What am I doing wrong?

1

1 Answers

3
votes

I think you're missing an special extra attribute for the classifier field.

Additionally you'll need to generate and upload the Maven POM file. Unfortunately command-line tool doesn't support this...

See:

Update

The stand-alone jar is designed to support publishing to a repository, but there is an implicit understanding that it's an ivy repository....

This explains why the ivy file is pushed, it's the module metadata file required by ivy modules. Maven, on the other hand, uses a POM file for it's module metadata and this needs to created and also published to the Maven repository.

If you were doing all this from within ANT, you'd have makepom task to automatically generate the POM fileand the ivy publish task has a "publishivy" attribute that can be used to suppress the upload of the ivy.xml file.