title: How to publish proguard JAR as Maven Artifact using Gradle Publish Plugin
body: <p>I am trying to publish an obfuscated JAR created by the Gradle 6.0.1 ProGuard Plugin to a Maven repository. I've learned much about Gradle configurations, variants and artifacts over the last days, but I seem to be unable to make this work. I believe the relevant documentation is the one <a href="https://docs.gradle.org/current/userguide/publishing_customization.html" rel="nofollow noreferrer">here</a>.</p>
  
  <p>I have created a <a href="https://github.com/muthenberg/gradle-jar-overwrite-test" rel="nofollow noreferrer">minimal example showing my intended setup on Github</a>.</p>
  
  <p>If I run <code>./gradlew publish</code> on this project I get the following error.</p>
  
  <pre><code>Execution failed for task ':publishMyLibraryPublicationToMyRepoRepository'.
  &gt; Failed to publish publication 'myLibrary' to repository 'myRepo'
     &gt; Invalid publication 'myLibrary': multiple artifacts with the identical extension and classifier ('jar', 'null').
  </code></pre>
  
  <p>I also tried the deprecated <code>maven</code> plugin. Unfortunately this plugin ignored the custom ProGuard jar.</p>
  
  <p>Can someone give me any advice on how to replace the original JAR from the JAR task with the obfuscated Jar from the proguard task?</p>
  
  <p><strong>EDIT:</strong>
  I was able to derive a solution from <a href="https://stackoverflow.com/questions/52875698/how-to-proguard-with-spring-boot-gradle-plugin">this thread</a>. The minimal example on Github contains the patched version. Feel free to have a look. I will put the working build.gradle into an answer below.</p>