title: how to publish 3rdparty artifacts with ivy and nexus
body: <p>I'm busily getting my feet wet with ivy.  I have an existing nexus repository running on my local PC, and an existing ant build script.<br>
  Both work fine.  </p>
  
  <p>Part of the build scripts have some files to retrieve our 3rdparty jar files (log4j, xmlbeans, junit, pdf, etc..) from a network share - which is klunky at best.</p>
  
  <p>I want to use ivy's dependency mechanisms to retrieve these files from a nexus repository and use that in the build.  Each 3rdparty lib has a name and an arbitrary set of files (jar, dll, license.dat, xml, etc).</p>
  
  <p>Since we have a large number of these 3rdparty libs and each lib has multiple files - manual uploading to nexus is not an option -- i need something i can use to take a set of files, give them a lib name, a version number and upload the result to nexus.  then I need to be able to retrieve this from ivy.</p>
  
  <p>I managed to get the upload part to work, but the retreival process does not work.  Using our xmlbeans lib as a starting point I created the following ivy.xml file</p>
  
  <pre><code>&lt;ivy-module version="1.0"&gt;  
  &lt;info organisation="thirdparty_tools" module="xmlbeans" status="integration"&gt;  
  &lt;publications&gt;  
    &lt;artifact name="jsr173_api" type="jar" ext="jar"/&gt;  
    &lt;artifact name="saxon-dom" type="jar" ext="jar"/&gt;  
    &lt;artifact name="saxon-xpath" type="jar" ext="jar"/&gt;  
    &lt;artifact name="saxon" type="jar" ext="jar"/&gt;  
    &lt;artifact name="xbean" type="jar" ext="jar"/&gt;  
    &lt;artifact name="xbean_xpath" type="jar" ext="jar"/&gt;  
    &lt;artifact name="xmlpublic" type="jar" ext="jar"/&gt;  
  &lt;/publications&gt;  
  &lt;/ivy-module&gt;  
  </code></pre>
  
  <p>and then some ant script to publish it to nexus:</p>
  
  <pre><code> &lt;ivy:resolve/&gt;  
      &lt;ivy:publish &lt;ivy:publish resolver="thirdparty" forcedeliver="true" update="true" revision="${version}" overwrite="true"&gt;  
        &lt;artifacts pattern="[artifact].[ext]"/&gt;  
      &lt;ivy:publish/&gt;  
  </code></pre>
  
  <p>And this all works fine.  It publishes all the jar files to nexus in the expected directory.</p>
  
  <p>The trouble comes when I try to use it in my build.
  I created the following ivy.xml file for my build:</p>
  
  <pre><code>&lt;ivy-module version="1.0"&gt;  
      &lt;info organisation="myCompany" module="GLB_Data"/&gt;  
      &lt;dependencies&gt;  
          &lt;dependency org="thirdparty_tools" name="xmlbeans" rev="2.2.0"/&gt;  
      &lt;/dependencies&gt;  
  &lt;/ivy-module&gt; 
  </code></pre>
  
  <p>Then when I run my build - it fails to find anything:</p>
  
  <pre><code>::::::::::::::::::::::::::::::::::::::::::::::  
  ::          UNRESOLVED DEPENDENCIES         ::  
  ::::::::::::::::::::::::::::::::::::::::::::::  
  :: thirdparty_tools#jsr173_api;2.2.0: not found  
  :: thirdparty_tools#saxon-dom;2.2.0: not found  
  :: thirdparty_tools#saxon-xpath;2.2.0: not found  
  :: thirdparty_tools#saxon;2.2.0: not found  
  :: thirdparty_tools#xbean;2.2.0: not found  
  :: thirdparty_tools#xbean_xpath;2.2.0: not found  
  :: thirdparty_tools#xmlpublic;2.2.0: not found  
  :::::::::::::::::::::::::::::::::::::::::::::: 
  </code></pre>
  
  <p>The problem seems to be with this pattern:  </p>
  
  <pre><code>WARN: ==== public: tried  
  WARN:   http //localhost:8081/nexus/content/groups/public/thirdparty_tools/jsr173_api/2.2.0/jsr173_api-2.2.0.pom  
  WARN:   -- artifact thirdparty_tools#jsr173_api;2.2.0!jsr173_api.jar:  
  WARN:   http //localhost:8081/nexus/content/groups/public/thirdparty_tools/jsr173_api/2.2.0/jsr173_api-2.2.0.jar  
  
  ivy seems to be looking for the jsr173_api artifact under its own name, rather than under the xmlbeans folder where it was published to:  
  [ivy:publish]   published jsr173_api to http //localhost:8081/nexus/content/repositories/thirdparty/thirdparty_tools/xmlbeans/2.2.0/jsr173_api-2.2.0.jar  
  </code></pre>
  
  <p>(urls obfuscated to prevent accidents).</p>
  
  <p>so somehow I need to publish differently, or retrieve differently.  Ideas and suggestions are much appreciated.</p>