You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@bookkeeper.apache.org by yo...@apache.org on 2022/08/01 13:45:00 UTC

[bookkeeper] 14/17: Fix maven javadoc generate (#3317)

This is an automated email from the ASF dual-hosted git repository.

yong pushed a commit to branch branch-4.15
in repository https://gitbox.apache.org/repos/asf/bookkeeper.git

commit 40af8ee4a4dbab6a341d27b0595718ef6cf2f416
Author: ZhangJian He <sh...@gmail.com>
AuthorDate: Tue Jun 7 18:54:02 2022 +0800

    Fix maven javadoc generate (#3317)
    
    Currently, the maven javadoc generate is broken both on master and branch-4.14
    
    - fix the javadoc generate, the gradle script has already use `delombok`
    - delete unneeded `package-info` file
    - delete unused dependency `spotbugs-annotations`, it's not worth to open other pr(IMO)
    
    (cherry picked from commit 9f3a815902171467ad6ca863d186449049d78448)
---
 .github/workflows/pr-validation.yml                |  3 +-
 bookkeeper-common/pom.xml                          | 25 +++++++++++++
 bookkeeper-server/pom.xml                          |  1 +
 .../org/apache/bookkeeper/stats/package-info.java  | 23 ------------
 bookkeeper-stats/pom.xml                           |  8 +----
 .../apache/bookkeeper/stats/AlertStatsLogger.java  |  0
 pom.xml                                            | 41 ++++++++++++++++++++++
 site3/website/scripts/javadoc-gen.sh               |  2 +-
 stream/distributedlog/pom.xml                      |  3 +-
 9 files changed, 72 insertions(+), 34 deletions(-)

diff --git a/.github/workflows/pr-validation.yml b/.github/workflows/pr-validation.yml
index eb5075e0b2..632dc5c31b 100644
--- a/.github/workflows/pr-validation.yml
+++ b/.github/workflows/pr-validation.yml
@@ -57,6 +57,5 @@ jobs:
       - name: Check license files
         run: dev/check-all-licenses
 
-      # keeping on gradle, `mvn site javadoc:javadoc`, to figure out later
       - name: Generate Javadoc
-        run: ./gradlew generateApiJavadoc
+        run: mvn clean -B -nsu -am -pl bookkeeper-common,bookkeeper-server,:bookkeeper-stats-api,:bookkeeper-stats-providers,:codahale-metrics-provider,:prometheus-metrics-provider install javadoc:aggregate -DskipTests -Pdelombok
diff --git a/bookkeeper-common/pom.xml b/bookkeeper-common/pom.xml
index dd928868cc..936cbf2d31 100644
--- a/bookkeeper-common/pom.xml
+++ b/bookkeeper-common/pom.xml
@@ -112,6 +112,31 @@
         <groupId>org.apache.maven.plugins</groupId>
         <artifactId>maven-surefire-plugin</artifactId>
       </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-javadoc-plugin</artifactId>
+        <version>${maven-javadoc-plugin.version}</version>
+        <configuration>
+          <sourcepath>${src.dir}</sourcepath>
+          <!-- Avoid for missing javadoc comments to be marked as errors -->
+          <doclint>none</doclint>
+          <subpackages>org.apache.bookkeeper.common.annotation</subpackages>
+          <groups>
+            <group>
+              <title>Bookkeeper Client</title>
+              <packages>org.apache.bookkeeper.common.annotation*</packages>
+            </group>
+          </groups>
+        </configuration>
+        <executions>
+          <execution>
+            <id>attach-javadocs</id>
+            <goals>
+              <goal>jar</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
     </plugins>
   </build>
 </project>
diff --git a/bookkeeper-server/pom.xml b/bookkeeper-server/pom.xml
index 51d7066b42..454311e195 100644
--- a/bookkeeper-server/pom.xml
+++ b/bookkeeper-server/pom.xml
@@ -254,6 +254,7 @@
         <artifactId>maven-javadoc-plugin</artifactId>
         <version>${maven-javadoc-plugin.version}</version>
         <configuration>
+          <sourcepath>${src.dir}</sourcepath>
           <!-- Avoid for missing javadoc comments to be marked as errors -->
           <doclint>none</doclint>
           <subpackages>org.apache.bookkeeper.client:org.apache.bookkeeper.conf:org.apache.bookkeeper.feature</subpackages>
diff --git a/bookkeeper-server/src/main/java/org/apache/bookkeeper/stats/package-info.java b/bookkeeper-server/src/main/java/org/apache/bookkeeper/stats/package-info.java
deleted file mode 100644
index df77c581c3..0000000000
--- a/bookkeeper-server/src/main/java/org/apache/bookkeeper/stats/package-info.java
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/**
- * The bookkeeper stats related classes.
- */
-package org.apache.bookkeeper.stats;
\ No newline at end of file
diff --git a/bookkeeper-stats/pom.xml b/bookkeeper-stats/pom.xml
index 862ed6f90e..390b35a0c4 100644
--- a/bookkeeper-stats/pom.xml
+++ b/bookkeeper-stats/pom.xml
@@ -27,7 +27,6 @@
   <name>Apache BookKeeper :: Stats API</name>
   <url>http://maven.apache.org</url>
   <properties>
-    <spotbugs-annotations.version>4.6.0</spotbugs-annotations.version>
   </properties>
   <build>
     <plugins>
@@ -36,6 +35,7 @@
         <artifactId>maven-javadoc-plugin</artifactId>
         <version>${maven-javadoc-plugin.version}</version>
         <configuration>
+          <sourcepath>${src.dir}</sourcepath>
           <!-- Avoid for missing javadoc comments to be marked as errors -->
           <doclint>none</doclint>
           <subpackages>org.apache.bookkeeper.stats</subpackages>
@@ -58,11 +58,5 @@
     </plugins>
   </build>
   <dependencies>
-    <dependency>
-      <groupId>com.github.spotbugs</groupId>
-      <artifactId>spotbugs-annotations</artifactId>
-      <version>${spotbugs-annotations.version}</version>
-      <scope>provided</scope>
-    </dependency>
   </dependencies>
 </project>
diff --git a/bookkeeper-server/src/main/java/org/apache/bookkeeper/stats/AlertStatsLogger.java b/bookkeeper-stats/src/main/java/org/apache/bookkeeper/stats/AlertStatsLogger.java
similarity index 100%
rename from bookkeeper-server/src/main/java/org/apache/bookkeeper/stats/AlertStatsLogger.java
rename to bookkeeper-stats/src/main/java/org/apache/bookkeeper/stats/AlertStatsLogger.java
diff --git a/pom.xml b/pom.xml
index dd14ecf7c0..7b420b76da 100644
--- a/pom.xml
+++ b/pom.xml
@@ -113,6 +113,7 @@
     <javac.target>1.8</javac.target>
     <redirectTestOutputToFile>true</redirectTestOutputToFile>
     <testRetryCount>2</testRetryCount>
+    <src.dir>src/main/java</src.dir>
     <test.additional.args />
 
     <!-- dependencies -->
@@ -187,6 +188,7 @@
     <exec-maven-plugin.version>1.6.0</exec-maven-plugin.version>
     <license-maven-plugin.version>1.6</license-maven-plugin.version>
     <jacoco-maven-plugin.version>0.8.0</jacoco-maven-plugin.version>
+    <lombok-maven-plugin.version>1.18.20.0</lombok-maven-plugin.version>
     <maven-antrun-plugin.version>1.8</maven-antrun-plugin.version>
     <maven-assembly-plugin.version>3.1.0</maven-assembly-plugin.version>
     <maven-checkstyle-plugin.version>3.0.0</maven-checkstyle-plugin.version>
@@ -831,6 +833,7 @@
   </dependencies>
 
   <build>
+    <sourceDirectory>${src.dir}</sourceDirectory>
     <extensions>
       <extension>
         <groupId>kr.motd.maven</groupId>
@@ -1151,6 +1154,44 @@
         </plugins>
       </reporting>
     </profile>
+    <profile>
+      <id>delombok</id>
+      <properties>
+        <src.dir>${project.build.directory}/generated-sources/delombok</src.dir>
+      </properties>
+      <build>
+        <plugins>
+          <plugin>
+            <groupId>org.projectlombok</groupId>
+            <artifactId>lombok-maven-plugin</artifactId>
+            <version>${lombok-maven-plugin.version}</version>
+            <inherited>true</inherited>
+            <dependencies>
+              <dependency>
+                <groupId>org.projectlombok</groupId>
+                <artifactId>lombok</artifactId>
+                <version>${lombok.version}</version>
+              </dependency>
+            </dependencies>
+            <executions>
+              <execution>
+                <phase>generate-sources</phase>
+                <goals>
+                  <goal>delombok</goal>
+                </goals>
+                <configuration>
+                  <sourceDirectory>${project.basedir}/src/main/java</sourceDirectory>
+                  <outputDirectory>${project.build.directory}/generated-sources/delombok</outputDirectory>
+                  <formatPreferences>
+                    <pretty/>
+                  </formatPreferences>
+                </configuration>
+              </execution>
+            </executions>
+          </plugin>
+        </plugins>
+      </build>
+    </profile>
     <!-- the profiles below are only for development purpose -->
     <profile>
       <id>dev</id>
diff --git a/site3/website/scripts/javadoc-gen.sh b/site3/website/scripts/javadoc-gen.sh
index efe088e255..d516acd070 100755
--- a/site3/website/scripts/javadoc-gen.sh
+++ b/site3/website/scripts/javadoc-gen.sh
@@ -34,7 +34,7 @@ function build_javadoc() {
   if [[ "$use_gradle" == "true" ]]; then
     ./gradlew generateApiJavadoc
   else
-    mvn clean install javadoc:aggregate -DskipTests
+    mvn clean -B -nsu -am -pl bookkeeper-common,bookkeeper-server,:bookkeeper-stats-api,:bookkeeper-stats-providers,:codahale-metrics-provider,:prometheus-metrics-provider install javadoc:aggregate -DskipTests -Pdelombok
   fi
 
   mv $javadoc_gen_dir $javadoc_dest_dir
diff --git a/stream/distributedlog/pom.xml b/stream/distributedlog/pom.xml
index 151161743f..99fa4fd501 100644
--- a/stream/distributedlog/pom.xml
+++ b/stream/distributedlog/pom.xml
@@ -47,8 +47,9 @@
         <artifactId>maven-javadoc-plugin</artifactId>
         <version>${maven-javadoc-plugin.version}</version>
         <configuration>
+          <sourcepath>${src.dir}</sourcepath>
+          <notimestamp>true</notimestamp>
           <!-- Avoid for missing javadoc comments to be marked as errors -->
-          <additionalparam>-notimestamp</additionalparam>
           <doclint>none</doclint>
           <groups>
             <group>