Skip to content

Commit 6e96042

Browse files
committed
Fix double-source-jar error during releases:
``` 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 #6634, among other issues. RELNOTES=n/a PiperOrigin-RevId: 572327204
1 parent a78bea4 commit 6e96042

File tree

2 files changed

+18
-34
lines changed

2 files changed

+18
-34
lines changed

Diff for: android/pom.xml

+9-17
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
<javac.version>9+181-r4173-1</javac.version>
2424
<!-- Empty for all JDKs but 9-12 -->
2525
<maven-javadoc-plugin.additionalJOptions></maven-javadoc-plugin.additionalJOptions>
26-
<maven-source-plugin.version>3.3.0</maven-source-plugin.version>
2726
<project.build.outputTimestamp>2023-02-01T00:00:00Z</project.build.outputTimestamp>
2827
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
2928
<test.add.opens></test.add.opens>
@@ -172,12 +171,14 @@
172171
</plugin>
173172
<plugin>
174173
<artifactId>maven-source-plugin</artifactId>
175-
<version>${maven-source-plugin.version}</version>
174+
<version>3.3.0</version>
176175
<executions>
177176
<execution>
178177
<id>attach-sources</id>
179-
<phase>post-integration-test</phase>
180-
<goals><goal>jar</goal></goals>
178+
<phase>verify</phase>
179+
<goals>
180+
<goal>jar-no-fork</goal>
181+
</goals>
181182
</execution>
182183
</executions>
183184
</plugin>
@@ -335,19 +336,10 @@
335336
<id>sonatype-oss-release</id>
336337
<build>
337338
<plugins>
338-
<plugin>
339-
<groupId>org.apache.maven.plugins</groupId>
340-
<artifactId>maven-source-plugin</artifactId>
341-
<version>${maven-source-plugin.version}</version>
342-
<executions>
343-
<execution>
344-
<id>attach-sources</id>
345-
<goals>
346-
<goal>jar-no-fork</goal>
347-
</goals>
348-
</execution>
349-
</executions>
350-
</plugin>
339+
<!-- TODO(cpovirk): Consider eliminating the maven-javadoc-plugin
340+
config here, moving anything that we want into the "normal"
341+
plugin config and perhaps removing javadoc:jar from the command
342+
we run for snapshot releases. -->
351343
<plugin>
352344
<groupId>org.apache.maven.plugins</groupId>
353345
<artifactId>maven-javadoc-plugin</artifactId>

Diff for: pom.xml

+9-17
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
<javac.version>9+181-r4173-1</javac.version>
2424
<!-- Empty for all JDKs but 9-12 -->
2525
<maven-javadoc-plugin.additionalJOptions></maven-javadoc-plugin.additionalJOptions>
26-
<maven-source-plugin.version>3.3.0</maven-source-plugin.version>
2726
<project.build.outputTimestamp>2023-02-01T00:00:00Z</project.build.outputTimestamp>
2827
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
2928
<test.add.opens></test.add.opens>
@@ -173,12 +172,14 @@
173172
</plugin>
174173
<plugin>
175174
<artifactId>maven-source-plugin</artifactId>
176-
<version>${maven-source-plugin.version}</version>
175+
<version>3.3.0</version>
177176
<executions>
178177
<execution>
179178
<id>attach-sources</id>
180-
<phase>post-integration-test</phase>
181-
<goals><goal>jar</goal></goals>
179+
<phase>verify</phase>
180+
<goals>
181+
<goal>jar-no-fork</goal>
182+
</goals>
182183
</execution>
183184
</executions>
184185
</plugin>
@@ -329,19 +330,10 @@
329330
<id>sonatype-oss-release</id>
330331
<build>
331332
<plugins>
332-
<plugin>
333-
<groupId>org.apache.maven.plugins</groupId>
334-
<artifactId>maven-source-plugin</artifactId>
335-
<version>${maven-source-plugin.version}</version>
336-
<executions>
337-
<execution>
338-
<id>attach-sources</id>
339-
<goals>
340-
<goal>jar-no-fork</goal>
341-
</goals>
342-
</execution>
343-
</executions>
344-
</plugin>
333+
<!-- TODO(cpovirk): Consider eliminating the maven-javadoc-plugin
334+
config here, moving anything that we want into the "normal"
335+
plugin config and perhaps removing javadoc:jar from the command
336+
we run for snapshot releases. -->
345337
<plugin>
346338
<groupId>org.apache.maven.plugins</groupId>
347339
<artifactId>maven-javadoc-plugin</artifactId>

0 commit comments

Comments
 (0)