Skip to content

Commit 6ba191c

Browse files
cpovirkCompile-Testing Team
authored andcommitted
Move configuration out of sonatype-oss-release to enable it by default (except for maven-gpg-plugin), and update related configuration as necessary.
...as contemplated in cl/788538710 and elsewhere. (Background: We carried much or all of the `sonatype-oss-release` configuration over from the old `oss-parent` in changes like cl/492304151.) This (I hope) accomplished two classes of goals: - By enabling\[*\] `central-publishing-maven-plugin` by default, we enable it even for _snapshot_ deployment. Advantages: - It lets the plugin automatically disable `maven-deploy-plugin`. (Compare cl/805973207 for Truth.) And _that_ allows us to remove the configuration of https://central.sonatype.com/repository/maven-snapshots, which isn't needed by `central-publishing-maven-plugin` but which has been required by `maven-deploy-plugin`, which has no default. (Compare cl/805870501 for Truth.) - It causes us to begin deploying snapshots through the new Central system. - To make that work, we need to [set `server-id` to `central`, not `sonatype-central-staging`](google/auto#1965 (comment)), since `central-publishing-maven-plugin` uses a different ID than we had `maven-deploy-plugin` set up to use. (Compare cl/807814773 for Truth.) Since `central` is also what is used for non-snapshot releases, we could view this is a baby step toward performing non-snapshot releases on GitHub CI someday. - It ensures that non-release builds _also_ run some plugins and/or use the versions of those plugins that we have requested. (For _some_ projects, we've already been running these plugins, or we've at least kept versions consistent because we use `dependencyManagement` or other explicit versions.) Advantages and fallout: - We now get coverage for Javadoc during CI. (We've wanted this before. We went so far as to implement it for Truth in cl/509829752, and I've wanted it multiple times for Compile-Testing: cl/494805776, cl/802247571.) This change led to errors for Compile-Testing (again!) under JDK 8, so I fixed those by making the `--add-exports` configuration conditional. - We need to make a change to some of our CI configurations: Our snapshot-publishing builds request Javadoc and sources explicitly at the command line (with `mvn source:jar javadoc:jar deploy`). With this CL's changes, Maven would try to build Javadoc and sources twice—once for the command-line request and once for the new configuration we have. The fix for that is to stop making the explicit request. (Compare cl/807772725 for Truth, somewhat cl/572327204 for Guava, and maybe sorta kinda cl/536746714 for jimfs.) - We address the following warning, which google/guava#7961 had proposed to address another way but for which I'd merely added a TODO in cl/804600714: ``` [WARNING] Some problems were encountered while building the effective model for com.google.guava:guava-tests:jar:999.0.0-HEAD-jre-SNAPSHOT [WARNING] 'build.plugins.plugin.version' for org.sonatype.central:central-publishing-maven-plugin is missing. @ line 103, column 15 [WARNING] [WARNING] It is highly recommended to fix these problems because they threaten the stability of your build. [WARNING] [WARNING] For this reason, future Maven versions might no longer support building such malformed projects. ``` \[*\] "Enabling" may or may not be the right word. The `central-publishing-maven-plugin` plugin still doesn't _run_ unless someone actually runs `mvn deploy`. The only difference in output that that plugin change causes for a typical build is this, which I assume is related to its usage of [`<extensions>true</extensions>`](https://maven.apache.org/guides/mini/guide-using-extensions.html): ``` [INFO] Inspecting build with total of 6 modules [INFO] Installing Central Publishing features ``` I left `maven-gpg-plugin` alone because we don't want to request that users enter their signing keys during snapshot deployment, let alone during normal builds. Another option would be to move it out of the profile but to disable it by default, with the profile becoming responsible for undoing the disablement. (Or we could stop using a profile entirely in favor of passing a flag to set a property to do the same.) That would theoretically be nice because it helps with the "same version number" goal discussed above. But given that I never recall having run `maven-gpg-plugin` outside a release setting, I doubt that that matters in practice. (If we're lucky, this CL's changes to Auto specifically might be enough to deal with google/auto#1965.) Plus: I removed some redundant declarations of `<groupId>org.apache.maven.plugins</groupId>`, which is the default for plugins. (We had been including it inconsistently.) Compare cl/793718324. Finally: In Guava, I removed a "Guava Documentation Site" entry. This was added back in cl/29254221, but I can't immediately figure out why, and I see no other references to its `guava-site` in either the main or `gh-pages` branch of our repo, nor anywhere internal to Google. I'm hoping that it's at least become unnecessary in the past decade-plus. (The changes in this CL at least have no effect on the _jars_ that we produce as output.) Bonus Maven curiosity: I noticed that we have been getting a Javadoc warning: ``` [WARNING] Javadoc 1.4+ doesn't support the -1.1 switch anymore. Ignore this option. ``` This appears to be [a known issue](https://lists.apache.org/thread/k15x84xvj0tv9gngy2426cpm83d85l61). RELNOTES=n/a PiperOrigin-RevId: 805841232
1 parent 68b3286 commit 6ba191c

File tree

1 file changed

+40
-43
lines changed

1 file changed

+40
-43
lines changed

pom.xml

Lines changed: 40 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -51,13 +51,6 @@
5151
<tag>HEAD</tag>
5252
</scm>
5353

54-
<distributionManagement>
55-
<snapshotRepository>
56-
<id>sonatype-nexus-snapshots</id>
57-
<url>https://central.sonatype.com/repository/maven-snapshots/</url>
58-
</snapshotRepository>
59-
</distributionManagement>
60-
6154
<dependencies>
6255
<dependency>
6356
<groupId>junit</groupId>
@@ -147,28 +140,41 @@
147140
<plugin>
148141
<artifactId>maven-javadoc-plugin</artifactId>
149142
<version>3.11.3</version>
150-
<configuration>
151-
<additionalJOptions>
152-
<additionalJOption>--add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED</additionalJOption>
153-
<additionalJOption>--add-exports=jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED</additionalJOption>
154-
<additionalJOption>--add-exports=jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED</additionalJOption>
155-
<additionalJOption>--add-exports=jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED</additionalJOption>
156-
<additionalJOption>--add-exports=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED</additionalJOption>
157-
<additionalJOption>--add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED</additionalJOption>
158-
</additionalJOptions>
159-
</configuration>
143+
<executions>
144+
<execution>
145+
<id>attach-docs</id>
146+
<goals><goal>jar</goal></goals>
147+
</execution>
148+
</executions>
160149
</plugin>
161150
<plugin>
162151
<artifactId>maven-site-plugin</artifactId>
163152
<version>3.21.0</version>
164153
</plugin>
154+
<plugin>
155+
<artifactId>maven-source-plugin</artifactId>
156+
<version>3.3.1</version>
157+
<executions>
158+
<execution>
159+
<id>attach-sources</id>
160+
<!-- TODO(cpovirk): Use jar-no-fork, as we do in our other projects? -->
161+
<goals><goal>jar</goal></goals>
162+
</execution>
163+
</executions>
164+
</plugin>
165165
<plugin>
166166
<artifactId>maven-surefire-plugin</artifactId>
167167
<version>3.5.4</version>
168168
<configuration>
169169
<argLine>${test.jvm.flags}</argLine>
170170
</configuration>
171171
</plugin>
172+
<plugin>
173+
<groupId>org.sonatype.central</groupId>
174+
<artifactId>central-publishing-maven-plugin</artifactId>
175+
<version>0.8.0</version>
176+
<extensions>true</extensions>
177+
</plugin>
172178
</plugins>
173179
</build>
174180

@@ -229,32 +235,6 @@
229235
</execution>
230236
</executions>
231237
</plugin>
232-
<plugin>
233-
<artifactId>maven-source-plugin</artifactId>
234-
<version>3.3.1</version>
235-
<executions>
236-
<execution>
237-
<id>attach-sources</id>
238-
<goals><goal>jar</goal></goals>
239-
</execution>
240-
</executions>
241-
</plugin>
242-
<plugin>
243-
<artifactId>maven-javadoc-plugin</artifactId>
244-
<version>3.11.3</version>
245-
<executions>
246-
<execution>
247-
<id>attach-docs</id>
248-
<goals><goal>jar</goal></goals>
249-
</execution>
250-
</executions>
251-
</plugin>
252-
<plugin>
253-
<groupId>org.sonatype.central</groupId>
254-
<artifactId>central-publishing-maven-plugin</artifactId>
255-
<version>0.8.0</version>
256-
<extensions>true</extensions>
257-
</plugin>
258238
</plugins>
259239
</build>
260240
</profile>
@@ -273,6 +253,23 @@
273253
--add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED
274254
</test.jvm.flags>
275255
</properties>
256+
<build>
257+
<plugins>
258+
<plugin>
259+
<artifactId>maven-javadoc-plugin</artifactId>
260+
<configuration>
261+
<additionalJOptions>
262+
<additionalJOption>--add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED</additionalJOption>
263+
<additionalJOption>--add-exports=jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED</additionalJOption>
264+
<additionalJOption>--add-exports=jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED</additionalJOption>
265+
<additionalJOption>--add-exports=jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED</additionalJOption>
266+
<additionalJOption>--add-exports=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED</additionalJOption>
267+
<additionalJOption>--add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED</additionalJOption>
268+
</additionalJOptions>
269+
</configuration>
270+
</plugin>
271+
</plugins>
272+
</build>
276273
</profile>
277274
</profiles>
278275
</project>

0 commit comments

Comments
 (0)