Skip to content

Commit

Permalink
Simplify our maven-javadoc-plugin configuration, and move both it a…
Browse files Browse the repository at this point in the history
…nd `maven-source-plugin` to the default phase (which is `package`).

I doubt that this ends up being a complete no-op in all scenarios (if only because of the phase change), but I didn't _set out_ intending to change any behavior, and my various tests all passed:

- `mvn clean javadoc:jar deploy -DskipTests=true -Dmaven.deploy.skip=true` (also also a similar test _without_ `javadoc:jar`, as discussed below)
- `mvn clean deploy -Psonatype-oss-release -DskipTests -Drelease -Dmaven.deploy.skip=true` (now that it's passing after cl/572327204)
- `mvn clean install -DskipTests`

As part of this CL, I'm removing `javadoc:jar` from the command line we use for snapshots. I do this out of fear that it will someday result in "duplicated artifacts" (like cl/571437790), use the wrong configuration, or just run twice—as apparently it does in my test of the main changes from this CL:

```
[INFO] --- javadoc:3.5.0:jar (default-cli) @ guava ---
[INFO] No previous run data found, generating javadoc.
[INFO] Building jar: /usr/local/google/home/cpovirk/tmp.lS88PuqjZ4/git/guava/target/guava-HEAD-jre-SNAPSHOT-javadoc.jar
...
[INFO] --- javadoc:3.5.0:jar (attach-docs) @ guava ---
[INFO] Configuration changed, re-generating javadoc.
[INFO] Building jar: /usr/local/google/home/cpovirk/tmp.lS88PuqjZ4/git/guava/target/guava-HEAD-jre-SNAPSHOT-javadoc.jar
```

The new snapshot command appears to run Javadoc exactly once, as desired:

```
[INFO] --- javadoc:3.5.0:jar (attach-docs) @ guava ---
[INFO] No previous run data found, generating javadoc.
```

(While in the neighborhood, I considered also investigating a [switch from `jar` to `jar-no-fork`](https://maven.apache.org/plugins/maven-javadoc-plugin/examples/javadoc-nofork.html), similar to what we did for `maven-source-plugin`, but I didn't bother. FWIW, I didn't notice any duplicate steps, so the switch might not buy us anything for Guava in particular.)

Also, I removed some mentions of `org.apache.maven.plugins`, which are redundant because that is the default.

RELNOTES=n/a
PiperOrigin-RevId: 572593797
  • Loading branch information
cpovirk authored and Google Java Core Libraries committed Oct 11, 2023
1 parent e38ed26 commit 6736cad
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 89 deletions.
10 changes: 0 additions & 10 deletions android/guava/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -200,16 +200,6 @@
</links>
<overview>../../overview.html</overview>
</configuration>
<executions>
<execution>
<id>attach-docs</id>
</execution>
<execution>
<id>generate-javadoc-site-report</id>
<phase>site</phase>
<goals><goal>javadoc</goal></goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-resources-plugin</artifactId>
Expand Down
36 changes: 2 additions & 34 deletions android/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
<checker.version>3.37.0</checker.version>
<errorprone.version>2.21.1</errorprone.version>
<j2objc.version>2.8</j2objc.version>
<maven-javadoc-plugin.version>3.5.0</maven-javadoc-plugin.version>
<javac.version>9+181-r4173-1</javac.version>
<!-- Empty for all JDKs but 9-12 -->
<maven-javadoc-plugin.additionalJOptions></maven-javadoc-plugin.additionalJOptions>
Expand Down Expand Up @@ -97,7 +96,6 @@
</testResources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<executions>
<execution>
Expand All @@ -118,13 +116,6 @@
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-javadoc-plugin</artifactId>
<version>${maven-javadoc-plugin.version}</version>
<configuration>
<source>${java.specification.version}</source>
</configuration>
</plugin>
</plugins>
<pluginManagement>
<plugins>
Expand Down Expand Up @@ -175,7 +166,6 @@
<executions>
<execution>
<id>attach-sources</id>
<phase>verify</phase>
<goals>
<goal>jar-no-fork</goal>
</goals>
Expand Down Expand Up @@ -214,7 +204,7 @@
</plugin>
<plugin>
<artifactId>maven-javadoc-plugin</artifactId>
<version>${maven-javadoc-plugin.version}</version>
<version>3.5.0</version>
<configuration>
<quiet>true</quiet>
<notimestamp>true</notimestamp>
Expand All @@ -226,13 +216,12 @@
<additionalOption>-Xdoclint:-html</additionalOption>
</additionalOptions>
<linksource>true</linksource>
<source>8</source>
<source>${java.specification.version}</source>
<additionalJOption>${maven-javadoc-plugin.additionalJOptions}</additionalJOption>
</configuration>
<executions>
<execution>
<id>attach-docs</id>
<phase>post-integration-test</phase>
<goals><goal>jar</goal></goals>
</execution>
</executions>
Expand Down Expand Up @@ -269,7 +258,6 @@
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<version>3.0.0-M3</version>
</plugin>
Expand Down Expand Up @@ -336,25 +324,7 @@
<id>sonatype-oss-release</id>
<build>
<plugins>
<!-- TODO(cpovirk): Consider eliminating the maven-javadoc-plugin
config here, moving anything that we want into the "normal"
plugin config and perhaps removing javadoc:jar from the command
we run for snapshot releases. -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>${maven-javadoc-plugin.version}</version>
<executions>
<execution>
<id>attach-javadocs</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>3.0.1</version>
<executions>
Expand Down Expand Up @@ -417,7 +387,6 @@
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<!-- Under JDK8, we continue to use errorprone's javac9 (even
Expand Down Expand Up @@ -460,7 +429,6 @@
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<compilerArgs combine.children="append">
Expand Down
10 changes: 0 additions & 10 deletions guava/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -200,16 +200,6 @@
</links>
<overview>../overview.html</overview>
</configuration>
<executions>
<execution>
<id>attach-docs</id>
</execution>
<execution>
<id>generate-javadoc-site-report</id>
<phase>site</phase>
<goals><goal>javadoc</goal></goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-resources-plugin</artifactId>
Expand Down
36 changes: 2 additions & 34 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
<checker.version>3.37.0</checker.version>
<errorprone.version>2.21.1</errorprone.version>
<j2objc.version>2.8</j2objc.version>
<maven-javadoc-plugin.version>3.5.0</maven-javadoc-plugin.version>
<javac.version>9+181-r4173-1</javac.version>
<!-- Empty for all JDKs but 9-12 -->
<maven-javadoc-plugin.additionalJOptions></maven-javadoc-plugin.additionalJOptions>
Expand Down Expand Up @@ -98,7 +97,6 @@
</testResources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<executions>
<execution>
Expand All @@ -119,13 +117,6 @@
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-javadoc-plugin</artifactId>
<version>${maven-javadoc-plugin.version}</version>
<configuration>
<source>${java.specification.version}</source>
</configuration>
</plugin>
</plugins>
<pluginManagement>
<plugins>
Expand Down Expand Up @@ -176,7 +167,6 @@
<executions>
<execution>
<id>attach-sources</id>
<phase>verify</phase>
<goals>
<goal>jar-no-fork</goal>
</goals>
Expand Down Expand Up @@ -208,7 +198,7 @@
</plugin>
<plugin>
<artifactId>maven-javadoc-plugin</artifactId>
<version>${maven-javadoc-plugin.version}</version>
<version>3.5.0</version>
<configuration>
<quiet>true</quiet>
<notimestamp>true</notimestamp>
Expand All @@ -220,13 +210,12 @@
<additionalOption>-Xdoclint:-html</additionalOption>
</additionalOptions>
<linksource>true</linksource>
<source>8</source>
<source>${java.specification.version}</source>
<additionalJOption>${maven-javadoc-plugin.additionalJOptions}</additionalJOption>
</configuration>
<executions>
<execution>
<id>attach-docs</id>
<phase>post-integration-test</phase>
<goals><goal>jar</goal></goals>
</execution>
</executions>
Expand Down Expand Up @@ -263,7 +252,6 @@
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<version>3.0.0-M3</version>
</plugin>
Expand Down Expand Up @@ -330,25 +318,7 @@
<id>sonatype-oss-release</id>
<build>
<plugins>
<!-- TODO(cpovirk): Consider eliminating the maven-javadoc-plugin
config here, moving anything that we want into the "normal"
plugin config and perhaps removing javadoc:jar from the command
we run for snapshot releases. -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>${maven-javadoc-plugin.version}</version>
<executions>
<execution>
<id>attach-javadocs</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>3.0.1</version>
<executions>
Expand Down Expand Up @@ -411,7 +381,6 @@
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<!-- Under JDK8, we continue to use errorprone's javac9 (even
Expand Down Expand Up @@ -454,7 +423,6 @@
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<compilerArgs combine.children="append">
Expand Down
2 changes: 1 addition & 1 deletion util/deploy_snapshot.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
set -e -u

function mvn_deploy() {
mvn clean javadoc:jar deploy -DskipTests=true "$@"
mvn clean deploy -DskipTests=true "$@"
}

echo "Publishing Maven snapshot..."
Expand Down

0 comments on commit 6736cad

Please sign in to comment.