From 6e960428459e6ad3770477f6e1d834032b85286f Mon Sep 17 00:00:00 2001 From: cpovirk Date: Tue, 10 Oct 2023 12:05:16 -0700 Subject: [PATCH] Fix double-source-jar error during releases: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ``` Building and deploying the android flavor (this may take a while)... [ERROR] We have duplicated artifacts attached. [ERROR] Failed to execute goal org.apache.maven.plugins:maven-source-plugin:3.3.0:jar (attach-sources) on project guava: Presumably you have configured maven-source-plugn to execute twice times in your build. You have to configure a classifier for at least on of them. -> [Help 1] ``` I had fixed the same issue with _snapshot_ deployment in cl/559489724 (by no longer passing `source:jar` to `mvn`), but apparently that fix doesn't apply to _release_ deployment. I'm guessing that the relevant part of our release command is `-Psonatype-oss-release`, which (among other things) [activates a `maven-source-plugin` configuration change](https://github.com/google/guava/blob/a78bea41aedba50469641968ee3d98b24836e491/pom.xml#L329-L334): Presumably that introduces a second `maven-source-plugn` execution in much the same way as passing `source:jar` does. I previously fixed a similar problem in jimfs (cl/536746714) by removing the "normal" `maven-source-plugin` configuration, leaving only the `sonatype-oss-release` configuration in the parent. I don't remember whether I investigated removing jimfs' `sonatype-oss-release` configuration instead. Probably I should have at least investigated, since that's what we're going with here. As best I can tell, this doesn't interfere with _snapshot_ source jars, which are produced even without `source:jar`. (Notice that the configuration that may be the source of the problem was copied from the old `oss-parent` pom. This is at least the second time that that pom's configuration has caused us trouble, the other I recall being cl/492304151—well, and probably the aforementioned jimfs source-jar issue, too.) This prepares for the release that contains the fix for https://github.com/google/guava/issues/6634, among other issues. RELNOTES=n/a PiperOrigin-RevId: 572327204 --- android/pom.xml | 26 +++++++++----------------- pom.xml | 26 +++++++++----------------- 2 files changed, 18 insertions(+), 34 deletions(-) diff --git a/android/pom.xml b/android/pom.xml index d38ddb2c8633..fb6ac0eb8137 100644 --- a/android/pom.xml +++ b/android/pom.xml @@ -23,7 +23,6 @@ 9+181-r4173-1 - 3.3.0 2023-02-01T00:00:00Z UTF-8 @@ -172,12 +171,14 @@ maven-source-plugin - ${maven-source-plugin.version} + 3.3.0 attach-sources - post-integration-test - jar + verify + + jar-no-fork + @@ -335,19 +336,10 @@ sonatype-oss-release - - org.apache.maven.plugins - maven-source-plugin - ${maven-source-plugin.version} - - - attach-sources - - jar-no-fork - - - - + org.apache.maven.plugins maven-javadoc-plugin diff --git a/pom.xml b/pom.xml index 8d0d6a61a62e..95c9043f8ef5 100644 --- a/pom.xml +++ b/pom.xml @@ -23,7 +23,6 @@ 9+181-r4173-1 - 3.3.0 2023-02-01T00:00:00Z UTF-8 @@ -173,12 +172,14 @@ maven-source-plugin - ${maven-source-plugin.version} + 3.3.0 attach-sources - post-integration-test - jar + verify + + jar-no-fork + @@ -329,19 +330,10 @@ sonatype-oss-release - - org.apache.maven.plugins - maven-source-plugin - ${maven-source-plugin.version} - - - attach-sources - - jar-no-fork - - - - + org.apache.maven.plugins maven-javadoc-plugin