I've got a small Java project setup to build continuously through a Hudson server. I'd like to publish the build artifacts to an Artifactory server as a post-build step so, naturally, I'm using the Hudson-Artifactory plug-in to facilitate this. The local publish appears to work just fine - it publishes the two artifacts (both .jar files) and the resolved ivy.xml file as expected. When I request a build on the Hudson server, however, only one of my two artifacts gets published.
The build creates the following artifacts:
ftpSvc.jar
ftpSvc-lib.jar
My ivy.xml file looks like this:
<?xml version="1.0" encoding="ISO-8859-1"?>
<ivy-module version="2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://ant.apache.org/ivy/schemas/ivy.xsd">
<info organisation="esf"
status="integration"
module="ftpSvc"
revision="SNAPSHOT" />
<publications>
<artifact name="ftpSvc" ext="jar"/>
<artifact name="ftpSvc-lib" ext="jar" type="lib" />
</publications>
<!--list the dependencies of this project-->
<dependencies>
<dependency org="commons-net" name="commons-net" rev="1.3.0" />
</dependencies>
</ivy-module>
The two artifacts are clearly called out in the <publications>
section. The build target in my build.xml file looks like this:
<target name="publish_local" description="publish artifacts locally">
<echo>organisation: ${ivy.organisation}</echo>
<echo>module: ${ivy.module}</echo>
<echo>status: ${ivy.status}</echo>
<echo>revision: ${ivy.revision}</echo>
<echo>local dir: ${ivy.default.ivy.user.dir}</echo>
<ivy:publish
resolver="local"
update="true"
verwrite="true"
srcivypattern="${bundle.jar.dir}/ivy.xml"
artifactspattern="${bundle.jar.dir}/[artifact].[ext]" />
</target>
The artifactspattern
grabs all defined artifacts from the build directory - nothing fancy going on here. Lastly, the resolver chain in my ivysettings.xml file looks like this (server names changed to protect the innocent):
<resolvers>
<chain name="main">
<ibiblio name="main" m2compatible="true" root="http://my.server.employer.com:8080/artifactory/repo" />
<filesystem name="local">
<ivy pattern="${ivy.default.ivy.user.dir}/local/[organisation]/[module]/[revision]/ivy-[revision].xml" />
<artifact pattern="${ivy.default.ivy.user.dir}/local/[organisation]/[module]/[revision]/[artifact]-[revision].[ext]" />
</filesystem>
</chain>
</resolvers>
It's all rather routine stuff and, as mentioned above, the local publish works fine. Here's a peek at the console output when I build through Eclipse:
publish_local:
[echo] organisation: esf
[echo] module: ftpSvc
[echo] status: integration
[echo] revision: SNAPSHOT
[echo] local dir: C:\Users\myusername\.ivy2
[ivy:publish] :: publishing :: esf#ftpSvc
[ivy:publish] published ftpSvc to C:\Users\myusername\.ivy2/local/esf/ftpSvc/SNAPSHOT/ftpSvc-SNAPSHOT.jar
[ivy:publish] published ftpSvc-lib to C:\Users\myusername\.ivy2/local/esf/ftpSvc/SNAPSHOT/ftpSvc-lib-SNAPSHOT.jar
[ivy:publish] published ivy to C:\Users\myusername\.ivy2/local/esf/ftpSvc/SNAPSHOT/ivy-SNAPSHOT.xml
Both .jar files and the resolved ivy.xml file get published as expected. On my Hudson server, I've got the Artifactory Configuration settings configured thusly (again, some details have been changed to obscure my true superhero identity):
Artifactory server: http://my.server.employer.com:8080/artifactory
Target repository: target-repository
Ivy pattern: [organisation]/[module]/[revision]ivy-[revision].xml
Artifact pattern: "[organisation]/[module]/[revision]/[artifact]-[revision].[ext]"
As you can see, the Ivy and Artifact patterns are exactly the same as the patterns in my local resolver from my ivysettings.xml file. Thus, when the build is run on the Hudson server, I'd expect the exact same artifacts to be published to my Artifactory server.
Let's take a look at the console output from the latest build on my Hudson server:
publish_local:
[echo] organisation: esf
[echo] module: ftpSvc
[echo] status: integration
[echo] revision: SNAPSHOT
[echo] local dir: /usr/share/tomcat6/.ivy2
[ivy:publish] :: publishing :: esf#ftpSvc
Collecting Module information for module: ftpSvc
Module location: /usr/share/tomcat6/.hudson/jobs/ftpSvc-ivy/workspace/trunk/out/jars/ftpSvc.jar
[ivy:publish] published ftpSvc to /usr/share/tomcat6/.ivy2/local/esf/ftpSvc/SNAPSHOT/ftpSvc-SNAPSHOT.jar
Collecting Module information for module: ftpSvc
Module location: /usr/share/tomcat6/.hudson/jobs/ftpSvc-ivy/workspace/trunk/out/jars/ftpSvc-lib.jar
[ivy:publish] published ftpSvc-lib to /usr/share/tomcat6/.ivy2/local/esf/ftpSvc/SNAPSHOT/ftpSvc-lib-SNAPSHOT.jar
Collecting Module information for module: ftpSvc
Module location: /tmp/ivy2450884590736960955.xml
[ivy:publish] published ivy to /usr/share/tomcat6/.ivy2/local/esf/ftpSvc/SNAPSHOT/ivy-SNAPSHOT.xml
Build finished triggered
Deploying artifact: http://my.server.employer.com:8080/artifactory/target-repository/esf/ftpSvc/SNAPSHOT/ftpSvc-SNAPSHOT.jar
Deploying artifact: http://my.server.employer.com:8080/artifactory/target-repository/esf/ftpSvc/SNAPSHOT/ftpSvc-SNAPSHOT.xml
Deploying build info to: http://my.server.employer.com.com:8080/artifactory/api/build
Dubya' Tee Eff!? Once again, the local publish appears to work just fine, publishing both jars and the ivy.xml file to the local/esf/ftpSvc/SNAPSHOT/ directory on the Hudson server. The Artifactory plug-in, on the other hand, gets everything totally wrong. Not only does it fail to publish one of the two jars, it renames the ivy.xml file incorrectly.
Are there any Hudson/Ivy/Artifactory experts out there that can shed some light on what's going on here? I've got multiple projects that are exhibiting the exact same behavior. Any and all assistance in resolving this problem would be greatly appreciated.