title: How to fail a Maven build if a certain artifact already exists
body: <p>How can I fail the build if a certain artifact <em>does</em> exist in the repository? The Maven Wagon Plugin has an "exists" goal, but not the opposite.</p>
  
  <p>The reason for my question is as follows. </p>
  
  <p>My Maven project goes through an automated build pipeline, which ends in a release stage. This stage performs an automated release through a <code>mvn deploy -P release</code>, after setting the release version with a <code>mvn versions:set -DremoveSnapshot</code>. The stage is triggered manually (since not every push should result in a release).</p>
  
  <p>The <code>mvn deploy</code> will fail if the artifact to be uploaded is already in the repository. But this failure would come very late, during the last stage of the pipeline, while existence in the repository could be checked much earlier.</p>
  
  <p>In order to get fail-fast behavior I would like to check if the artifact that would be released has <em>not</em> already been uploaded to Nexus. I want to do this in the first stage of the pipeline, which only performs a <code>mvn package -P releasable</code>. Preferably the "releasable" profile would make Maven do this check automatically during the "validate" phase of the default lifecycle.</p>