English 中文(简体)
Hudson plug-in not publishing all artifacts to Artifactory
原标题:

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:Usersmyusername.ivy2
[ivy:publish] :: publishing :: esf#ftpSvc
[ivy:publish]   published ftpSvc to C:Usersmyusername.ivy2/local/esf/ftpSvc/SNAPSHOT/ftpSvc-SNAPSHOT.jar
[ivy:publish]   published ftpSvc-lib to C:Usersmyusername.ivy2/local/esf/ftpSvc/SNAPSHOT/ftpSvc-lib-SNAPSHOT.jar
[ivy:publish]   published ivy to C:Usersmyusername.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.

问题回答

Hey, I haven t used that plugin, but I would try removing the dash from the name ftpSvc-lib and/or removing type="lib" from its artifact element, just to see what happens.

I got the same problem, filled a bug on the JFrog Jira, the bug has been marked resolved today, but as you can see in my comments on the Jira, I m still confused about this resolution.

https://issues.jfrog.org/jira/browse/IAP-26?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel

If anyone has an idea, any input would be great...





相关问题
Spring Properties File

Hi have this j2ee web application developed using spring framework. I have a problem with rendering mnessages in nihongo characters from the properties file. I tried converting the file to ascii using ...

Logging a global ID in multiple components

I have a system which contains multiple applications connected together using JMS and Spring Integration. Messages get sent along a chain of applications. [App A] -> [App B] -> [App C] We set a ...

Java Library Size

If I m given two Java Libraries in Jar format, 1 having no bells and whistles, and the other having lots of them that will mostly go unused.... my question is: How will the larger, mostly unused ...

How to get the Array Class for a given Class in Java?

I have a Class variable that holds a certain type and I need to get a variable that holds the corresponding array class. The best I could come up with is this: Class arrayOfFooClass = java.lang....

SQLite , Derby vs file system

I m working on a Java desktop application that reads and writes from/to different files. I think a better solution would be to replace the file system by a SQLite database. How hard is it to migrate ...

热门标签