title: Publish artifact in nexus using Ivy-Ant: Unauthorized by Credentials?
body: <p>this is my code
  <strong>ivy.xml file</strong></p>
  
  <pre><code>    &lt;?xml version="1.0" encoding="UTF-8"?&gt;
      &lt;ivy-module version="2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-   instance"  xsi:noNamespaceSchemaLocation="http://ant.apache.org/ivy/schemas/ivy.xsd"&gt;
          &lt;info organisation="nameOrganisation" module="nameModule" revision="1.0"   status="release" publication="20150723102057"&gt;
          &lt;/info&gt;
      &lt;publications&gt;
          &lt;artifact name="artifactName" type="jar" ext="jar"/&gt;
      &lt;/publications&gt;
          &lt;dependencies&gt;
              &lt;dependency org="org.springframework" name="spring-web-servlet" rev="3.0.5.RELEASE" transitive="false"/&gt;
  ...
  </code></pre>
  
  <p><strong>build.xml file</strong></p>
  
  <pre><code>&lt;target name="publish" description="Upload to Nexus"&gt;
          &lt;ivy:settings id="ivy.settings" file="${ivy.settings}"&gt;
          &lt;credentials host="host" realm="Sonatype Nexus Repository Manager" username="${repo.username}" passwd="${repo.password}"/&gt;
          &lt;/ivy:settings&gt;
          &lt;ivy:retrieve /&gt;
           &lt;ivy:makepom ivyfile="${ivy.file}" pomfile="ivy.pom"/&gt;
          &lt;ivy:publish resolver="publish" overwrite="true" publishivy="false" srcivypattern="${ivy.file}" settingsRef="ivy.settings" forcedeliver="true" organisation="organisation" module="nameModule" pubrevision="1.0" revision="1.0"&gt;
              &lt;artifacts pattern="${lib.app.dir}/[artifact](-[classifier]).[ext]"/&gt;
          &lt;/ivy:publish&gt;
  
      &lt;/target&gt;
  </code></pre>
  
  <p><strong>ivysettings-public.xml</strong></p>
  
  <pre><code>&lt;ivysettings&gt;
    &lt;settings defaultResolver="nexus"/&gt;
   &lt;!-- &lt;credentials host="host" realm="Sonatype Nexus Repository Manager" username="user" passwd="pwd"/&gt;--&gt;
    &lt;resolvers&gt;
     &lt;chain name="nexus"&gt;
      &lt;ibiblio name="name1" m2compatible="true" root="http://host:8080/nexus/content/repositories/name1/"/&gt;
      &lt;ibiblio name="central" m2compatible="true" root="http://host:8080/nexus/content/repositories/name2/"/&gt;
  
    &lt;/chain&gt;
    &lt;/resolvers&gt;
  &lt;/ivysettings&gt;
  </code></pre>
  
  <p><strong>when I run the build.xml I always get the same, does it ignore my credentials? or is it another problem?</strong></p>
  
  <pre><code> buildPublish.xml:39: impossible to publish artifacts for     organisation#nameModule;1.0: java.io.IOException: Access to URL     [http://host:8080/nexus/content/repositories/name1/organisation/nameModule/1.0/n    ameModule-1.0.jar] was refused by the server: Unauthorized
  </code></pre>
  
  <p>I need some ideas!!!
  thanks</p>