title: Deployment deploys twice or not at all
body: <p>I managed to build a Maven project in a way that makes the release deploy artifacts either double or not at all.</p>
  
  <p>Since the project uses an abstract parent pom of our company it's a bit hard to post the relevant code, but I'll try.</p>
  
  <p>First things first. The parent pom has the following definition:</p>
  
  <pre><code>  &lt;plugin&gt;
      &lt;artifactId&gt;maven-deploy-plugin&lt;/artifactId&gt;
      &lt;version&gt;2.8.2&lt;/version&gt;
      &lt;configuration&gt;
        &lt;deployAtEnd&gt;true&lt;/deployAtEnd&gt;
      &lt;/configuration&gt;
    &lt;/plugin&gt;
  </code></pre>
  
  <p>With nothing defined in the actual project, the release will fail after these lines:</p>
  
  <pre><code>[INFO] [INFO] Uploaded to our_repo: http://acme.org/nexus/content/repositories/org.acme.project/1.0.0/org.acme.project-1.0.0-sources.jar (14 kB at 3.8 kB/s)
  [INFO] [INFO] Uploading to our_repo: http://acme.org/nexus/content/repositories/org.acme.project/1.0.0/org.acme.project-1.0.0-sources.jar
  </code></pre>
  
  <p>Our repo doesn't like having two release JARs with the same version, so everything fails. The weird part here is that the deployment is NOT at the end. In fact the project build fails halfway through.</p>
  
  <p>However if I copy the above plug-in in the project, the build will print <code>Deploying repo:org.acme.repo:1.0.0 at end</code> at the same position and then not deploy anothing at the end.</p>
  
  <p>But I'm not even sure that's part of the problem. Still I think both builds should work exactly the same no matter where the plug-in definition is.</p>
  
  <p>I found <a href="https://stackoverflow.com/questions/4251488/maven-release-plugin-fails-source-artifacts-getting-deployed-twice">this question</a>, which made me check the <code>maven-source-plugin</code> in the effective pom. However there are no duplicates there:</p>
  
  <pre><code>    &lt;plugin&gt;
        &lt;artifactId&gt;maven-source-plugin&lt;/artifactId&gt;
        &lt;version&gt;3.0.1&lt;/version&gt;
        &lt;executions&gt;
          &lt;execution&gt;
            &lt;id&gt;attach-sources&lt;/id&gt;
            &lt;goals&gt;
              &lt;goal&gt;jar-no-fork&lt;/goal&gt;
            &lt;/goals&gt;
            &lt;configuration&gt;...&lt;/configuration&gt;
          &lt;/execution&gt;
        &lt;/executions&gt;
      &lt;/plugin&gt;
  </code></pre>
  
  <p>Nothing is defined in the <code>maven-assembly-plugin</code> either, so no JAR is added for deployment (suggested in <a href="https://stackoverflow.com/questions/28407831/maven-maven-deploy-plugin-always-upload-twice">this question</a>).</p>
  
  <p>It might have to do with us using Java 10 or Maven 3.5.2, though I'm honestly stumped on what to test and where to progress.</p>
  
  <p>How do I fix this mess? (If you'd like more information about the build, just ask. The <em>pom.xml</em> is way to big to share them here.)</p>