1
votes

I'm working within a large build system that uses Ant/Ivy. I try to use a predefined ant task that uses ivy:publish ant task and get this error:

impossible to publish artifacts for com.company.project1.proj1#MySupportJar;working@server1: java.io.FileNotFoundException: /path_to/ivy-repository/com.company.project1.proj1/MySupportJar/5.1.3.part/MySupportJar-5.1.3.jar (No such file or directory)

The directory in the error message exists up to the version number part (5.1.3.part).

I am new to Ivy but think I get the basics of how it works. I can not find much on the exact meaning of this error so if someone could help or point me to an explanation I think I could resolve the issue from there.

Ant target

<target name="publish-shared" depends="ivyInit, resolve"
        description="Publish to the shared repository">
    <ivy:publish pubrevision="5.1.3"
                 resolver="shared"
                 pubdate="${timestamp}"
                 forcedeliver="true"
                 update="true"
                 conf="distro, docs">
        <artifacts pattern="dist/[artifact].[ext]"/>
    </ivy:publish>
</target>

Ivy file snippet

<publications>
    <artifact name="MySupportJar" type="jar" conf="distro" />
    <artifact name="MySupportJar-source" type="source" ext="jar" conf="docs" />
</publications>

Thanks.

2
Can you provide (at least a sample) of your build.xml? Does that directory exist?David W.
I added the ant target to the question. Also, the directory exists up to the point of "5.1.3.part". I don;t know where that is coming from. Thanks.Yadrif
Have you included a "publications" section in your ivy.xml file? See: stackoverflow.com/questions/8304562/…Mark O'Connor
I added the <publications> section from the ivy.xmlYadrif

2 Answers

3
votes

Thanks for all the suggestions. Turns out to be a simple solution that I was not looking for.

The problem was permissions at /path_to/ivy-repository/com.company.project1. I did not have write permission. The .part file is a temporary file written by Ivy. Ivy could not write the temporary file so when it got to reading the file it failed to find it.

I'm answering this so that it might help someone later.

Thanks.

0
votes

I'm fairly new to Ant with Ivy too. What I've done is combine a local Maven repository (Artifactory), with Jenkins as a continuous integration server. When we build a jar, I also produce the Maven pom.xml with it. Then, I use the mvn deploy:file command to deploy the desired build to our Maven repository.

The developer manually deploys the jar to our Maven repository via the Promoted Build plugin to Jenkins. The developer selects the build to deploy to Maven, and then pretty much presses a button, and that build will be deployed.

I actually produce two pomswith each build. One ispom.xmland the other ispom-snapshot.xml`. We deploy the snapshot with each build, so other developers can use the latest jar instead of the officially deployed one. I've put the whole thing in github if you're interested.

The only decent Ant/Ivy documentation I've seen is Manning's Ant in Action by Steve Loughram. If it wasn't for that, I probably would have never even tried Ant with Ivy. The online Ant/Ivy documentation at Apache is just plain awful.

I've looked over what you have. I suspect it might be an issue with your ivy-settings.xml file. Somewhere, it's getting the part string as the valid location for publishing the file. Otherwise, I have no idea.

As I said, we use a Maven repository for our site repository, and then use Maven to actually deploy the jars to the repository. I simply found that much easier to do it that way than to figure out how to do this in pure Ivy. Besides, it also means that our Maven projects can also use the jars from our Ant/Ivy projects.