title: Deploy SNAPSHOT artifact and sources to Nexus from Maven command line
body: <p>I am trying to deploy one EXE file and it's zipped source file to Sonatype Nexus using maven command line. Files must be deployed as SNAPSHOTs.</p>
  
  <p>So, I have 2 files:</p>
  
  <pre><code>-testXYZ.exe and source file
  -testXYZ.zip
  </code></pre>
  
  <p>Using maven 2.2.1 and command described here:</p>
  
  <pre><code>mvn deploy:deploy-file -Durl=file:///home/me/m2-repo \
                         -DrepositoryId=some.repo.id \
                         -Dfile=./path/to/artifact-name-1.0.jar \
                         -DpomFile=./path/to/pom.xml \
                         -Dsources=./path/to/artifact-name-1.0-sources.jar \
                         -Djavadoc=./path/to/artifact-name-1.0-javadoc.jar
  </code></pre>
  
  <p>I can deploy EXE, but cannot deploy source, because maven 2.2.1 is using deploy-plugin v2.5 and this command is not supported until v2.7.
  It is not allowed to me to use newer versions of maven, so I try different approach. </p>
  
  <p>Using these two subsequent commands I can deploy these two artifacts, but, source cannot be downloaded from nexus. </p>
  
  <pre><code>call mvn deploy:deploy-file -DgroupId=com.xyz -DartifactId=testXYZ -Dversion=1.1.116-SNAPSHOT -Dpackaging=zip -Dfile=testXYZ.zip -Dclassifier=sources -Durl=http://build:8081/nexus/content/repositories/snapshots -DrepositoryId=nexus
  call mvn deploy:deploy-file -DgroupId=com.xyz -DartifactId=testXYZ -Dversion=1.1.116-SNAPSHOT -Dpackaging=exe -Dfile=testXYZ.exe -Durl=http://build:8081/nexus/content/repositories/snapshots -DrepositoryId=nexus
  </code></pre>
  
  <p>After deploy, i search for testXYZ and click on artifact source download link.
  Nexus says: </p>
  
  <blockquote>
    <p>"Item not found on path
    "com.xyz:testXYZ:1.1.116-SNAPSHOT:c=sources:e=jar"!"</p>
  </blockquote>
  
  <p>Problem is the way maven upload these artifacts:</p>
  
  <pre><code>Line form log file while source is uploading:
  Uploaded: http://build:8081/nexus/content/repositories/snapshots/com/xyz/testXYZ/1.1.116-SNAPSHOT/testXYZ-1.1.116-20120106.111705-1-sources.zip
  Line form log file while Main artifact is uploading:
  Uploaded: http://build:8081/nexus/content/repositories/snapshots/com/xyz/testXYZ/1.1.116-SNAPSHOT/testXYZ-1.1.116-20120106.111709-2.exe
  </code></pre>
  
  <p>Notice 111705-1 and 111705-2. Last number must be the same if we wish Nexus can generate correct links.</p>
  
  <p>This approach is described here:</p>
  
  <p><a href="https://stackoverflow.com/questions/7487130/deploying-an-artifact-its-sources-and-javadoc-using-mavens-deploydeploy-file">Deploying an artifact, its sources and javadoc using maven&#39;s deploy:deploy-file plugin</a></p>
  
  <p>and here:</p>
  
  <p><a href="http://maven.apache.org/plugins/maven-install-plugin/examples/installing-secondary-artifacts.html" rel="nofollow noreferrer">http://maven.apache.org/plugins/maven-install-plugin/examples/installing-secondary-artifacts.html</a></p>
  
  <p>and it working for <strong>fixed versions(for example 1.1.116)</strong>, but not for SNAPSHOTs.</p>
  
  <p>Exe and Zip files can be deployed to Nexus (like jar files), if fixed version is used.</p>
  
  <p><strong>So, question is:</strong>
  Is there a way to deploy artifact and source SNAPSHOTs from command line to Sonatype Nexus and to be sure that these files can be downloaded by clicking on sources and artifacts links?</p>
  
  <p>Note:
  If I disable timestamps suffix, this can work, but I do not want to do this. </p>
  
  <pre><code>-DuniqueVersion=false
  </code></pre>
  
  <p>Thanks,</p>
  
  <p>Marjan</p>