Search code examples
antrepositorypublishivysonatype

Ivy does not publish signature (.asc) files


I've a directory ready to be published with these files:

myapp-1.0-bin.jar
myapp-1.0-bin.jar.asc
myapp-1.0-javadoc.jar
myapp-1.0-javadoc.jar.asc
myapp-1.0-pom.pom
myapp-1.0-pom.pom.asc
myapp-1.0-sources.jar
myapp-1.0-sources.jar.asc

The corresponding ivy.xml publications section is:

<publications>
    <artifact name="myapp" type="pom" ext="pom" conf="default" />
    <artifact name="myapp" type="bin" ext="jar" conf="default" />
    <artifact name="myapp" type="sources" ext="jar" conf="sources" m:classifier="sources" />
    <artifact name="myapp" type="javadoc" ext="jar" conf="javadoc" m:classifier="javadoc" />
    <!-- The following lines have to be removed to publish correctly WITHOUT .asc files -->
    <artifact name="myapp" type="pom.asc" ext="pom.asc" conf="default"/>
    <artifact name="myapp" type="bin.asc" ext="jar.asc" conf="default"/>
    <artifact name="myapp" type="sources.asc" ext="jar.asc" conf="default" m:classifier="sources" />
    <artifact name="myapp" type="javadoc.asc" ext="jar.asc" conf="default" m:classifier="javadoc"/>
</publications>

The ant publish task is:

<target name="ivyPublish-local-m2">
        <ivy:resolve />
        <ivy:publish resolver="local-m2-publish" pubrevision="${ivy.revision}" overwrite="true" publishivy="false">
            <artifacts pattern="${dist.dir}/[artifact]-[revision]-[type].[ext]" />
        </ivy:publish>
    </target>

This task should publish to a local directory, just for test. The problem is the following error message:

impossible to publish artifacts for com.myorg#myapp;1.0: java.io.IOException: missing artifact com.myorg#myapp;1.0!myapp.pom.asc

If i remove the lines after the comment in ivy.xml the publish goes ahead but the content of the destination folder is:

myapp-1.0.pom
myapp-1.0.pom.md5
myapp-1.0.pom.sha1
myapp-1.0.jar
myapp-1.0.jar.md5
myapp-1.0.jar.sha1
myapp-1.0-javadoc.jar
myapp-1.0-javadoc.jar.md5
myapp-1.0-javadoc.jar.sha1
myapp-1.0-sources.jar
myapp-1.0-sources.jar.md5
myapp-1.0-sources.jar.sha1

Seems that the -bin and -pom types are dropped from the names (not so bad), but none of the corresponding .asc files are published. I also tried to change the artifact pattern to:

<artifacts pattern="${dist.dir}/[artifact]-[revision]-[type].[ext](.asc)" />

but with no success. The questions are:

  • How can I publish the .asc files?
  • Can I publish the files without changing the names as happens with -pom and -bin?

Solution

  • I standardized my artifacts as suggested by CAustin (no "-bin" and "-pom"). Now they are:

    myapp-1.0.jar
    myapp-1.0.jar.asc
    myapp-1.0-javadoc.jar
    myapp-1.0-javadoc.jar.asc
    myapp-1.0.pom
    myapp-1.0.pom.asc
    myapp-1.0-sources.jar
    myapp-1.0-sources.jar.asc
    

    With the following ivy.xml publications section:

    <publications>
            <artifact type="pom" ext="pom" conf="default" /> 
            <artifact type="jar" ext="jar" conf="default" />
            <artifact type="sources" ext="jar" conf="sources" m:classifier="sources" />
            <artifact type="javadoc" ext="jar" conf="javadoc" m:classifier="javadoc" />
    
            <artifact type="pom.asc" ext="pom.asc" conf="default" />
            <artifact type="jar.asc" ext="jar.asc" conf="default" />
            <artifact type="jar.asc" ext="jar.asc" conf="sources" m:classifier="sources" />
            <artifact type="jar.asc" ext="jar.asc" conf="javadoc" m:classifier="javadoc" />
        </publications>
    

    and with build.xml call:

    <ivy:publish resolver="local-m2-publish" pubrevision="${ivy.revision}" overwrite="true" publishivy="false">
                <artifacts pattern="${dist.dir}/[artifact]-[revision](-[classifier]).[ext]" />
            </ivy:publish>
    

    Everything works!