HDDS-6621. Include annotation processor module in regular project hierarchy (#3326)

diff --git a/dev-support/annotations/pom.xml b/dev-support/annotations/pom.xml
deleted file mode 100644
index 23b1280..0000000
--- a/dev-support/annotations/pom.xml
+++ /dev/null
@@ -1,114 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-  Licensed 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. See accompanying LICENSE file.
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0"
-         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
-https://maven.apache.org/xsd/maven-4.0.0.xsd">
-  <modelVersion>4.0.0</modelVersion>
-
-  <groupId>org.apache.ozone</groupId>
-  <artifactId>ozone-annotation-processing</artifactId>
-  <version>1.3.0-SNAPSHOT</version>
-  <description>Apache Ozone annotation processing tools for validating custom
-    annotations at compile time.
-  </description>
-  <name>Apache Ozone Annotation Processing</name>
-  <packaging>jar</packaging>
-
-  <properties>
-    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
-    <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
-    <spotbugs.version>3.1.12</spotbugs.version>
-    <maven-checkstyle-plugin.version>3.1.0</maven-checkstyle-plugin.version>
-    <checkstyle.version>8.29</checkstyle.version>
-  </properties>
-
-  <dependencies>
-    <dependency>
-      <groupId>com.github.spotbugs</groupId>
-      <artifactId>spotbugs-annotations</artifactId>
-      <version>${spotbugs.version}</version>
-      <scope>provided</scope>
-    </dependency>
-  </dependencies>
-
-  <build>
-    <plugins>
-      <!--
-       | As this pom is not a child of the main ozone pom.xml, if we want
-       | findbugs and checkstyle to be running for the module, the plugins
-       | have to be defined here.
-      -->
-      <plugin>
-        <groupId>com.github.spotbugs</groupId>
-        <artifactId>spotbugs-maven-plugin</artifactId>
-        <version>${spotbugs.version}</version>
-        <configuration>
-          <maxHeap>1024</maxHeap>
-          <xmlOutput>true</xmlOutput>
-          <includeTests>true</includeTests>
-        </configuration>
-      </plugin>
-      <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-checkstyle-plugin</artifactId>
-        <version>${maven-checkstyle-plugin.version}</version>
-        <dependencies>
-          <dependency>
-            <groupId>com.puppycrawl.tools</groupId>
-            <artifactId>checkstyle</artifactId>
-            <version>${checkstyle.version}</version>
-          </dependency>
-        </dependencies>
-        <configuration>
-          <configLocation>../../hadoop-hdds/dev-support/checkstyle/checkstyle.xml</configLocation>
-          <suppressionsLocation>../../hadoop-hdds/dev-support/checkstyle/suppressions.xml</suppressionsLocation>
-          <includeTestSourceDirectory>true</includeTestSourceDirectory>
-          <failOnViolation>false</failOnViolation>
-          <outputFile>${project.build.directory}/test/checkstyle-errors.xml</outputFile>
-        </configuration>
-      </plugin>
-      <!--
-       | Compiler plugin configuration have to be modified to compile the
-       | annotation processor, without having any annotation processor applied
-       | as due to the presence of
-       | META-INF/services/javac.annotation.processing.Processor the compilation
-       | would fail as the linked processor class can not be find while we are
-       | compiling it, hence the compiler argument -proc:none is specified here.
-      -->
-      <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-compiler-plugin</artifactId>
-        <version>3.9.0</version>
-        <configuration>
-          <source>1.8</source>
-          <target>1.8</target>
-        </configuration>
-        <executions>
-          <execution>
-            <id>default-compile</id>
-            <configuration>
-              <compilerArgument>-proc:none</compilerArgument>
-              <includes>
-                <include>org/apache/ozone/annotations/**</include>
-              </includes>
-            </configuration>
-          </execution>
-        </executions>
-      </plugin>
-    </plugins>
-  </build>
-
-</project>
diff --git a/dev-support/annotations/src/main/resources/META-INF/services/javax.annotation.processing.Processor b/dev-support/annotations/src/main/resources/META-INF/services/javax.annotation.processing.Processor
deleted file mode 100644
index a0c3b81..0000000
--- a/dev-support/annotations/src/main/resources/META-INF/services/javax.annotation.processing.Processor
+++ /dev/null
@@ -1,17 +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.
-
-org.apache.ozone.annotations.RequestFeatureValidatorProcessor
-org.apache.ozone.annotations.ReplicateAnnotationProcessor
\ No newline at end of file
diff --git a/hadoop-hdds/annotations/pom.xml b/hadoop-hdds/annotations/pom.xml
new file mode 100644
index 0000000..cbef3d4
--- /dev/null
+++ b/hadoop-hdds/annotations/pom.xml
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Licensed 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. See accompanying LICENSE file.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
+https://maven.apache.org/xsd/maven-4.0.0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+  <parent>
+    <groupId>org.apache.ozone</groupId>
+    <artifactId>hdds</artifactId>
+    <version>1.3.0-SNAPSHOT</version>
+  </parent>
+
+  <artifactId>hdds-annotation-processing</artifactId>
+  <version>1.3.0-SNAPSHOT</version>
+  <description>Apache Ozone annotation processing tools for validating custom
+    annotations at compile time.
+  </description>
+  <name>Apache Ozone Annotation Processing</name>
+  <packaging>jar</packaging>
+
+</project>
diff --git a/dev-support/annotations/src/main/java/org/apache/ozone/annotations/ReplicateAnnotationProcessor.java b/hadoop-hdds/annotations/src/main/java/org/apache/ozone/annotations/ReplicateAnnotationProcessor.java
similarity index 100%
rename from dev-support/annotations/src/main/java/org/apache/ozone/annotations/ReplicateAnnotationProcessor.java
rename to hadoop-hdds/annotations/src/main/java/org/apache/ozone/annotations/ReplicateAnnotationProcessor.java
diff --git a/dev-support/annotations/src/main/java/org/apache/ozone/annotations/RequestFeatureValidatorProcessor.java b/hadoop-hdds/annotations/src/main/java/org/apache/ozone/annotations/RequestFeatureValidatorProcessor.java
similarity index 100%
rename from dev-support/annotations/src/main/java/org/apache/ozone/annotations/RequestFeatureValidatorProcessor.java
rename to hadoop-hdds/annotations/src/main/java/org/apache/ozone/annotations/RequestFeatureValidatorProcessor.java
diff --git a/dev-support/annotations/src/main/java/org/apache/ozone/annotations/package-info.java b/hadoop-hdds/annotations/src/main/java/org/apache/ozone/annotations/package-info.java
similarity index 100%
rename from dev-support/annotations/src/main/java/org/apache/ozone/annotations/package-info.java
rename to hadoop-hdds/annotations/src/main/java/org/apache/ozone/annotations/package-info.java
diff --git a/hadoop-hdds/common/pom.xml b/hadoop-hdds/common/pom.xml
index 0c1273d..3528b7f 100644
--- a/hadoop-hdds/common/pom.xml
+++ b/hadoop-hdds/common/pom.xml
@@ -76,6 +76,10 @@
     </dependency>
     <dependency>
       <groupId>org.apache.ozone</groupId>
+      <artifactId>hdds-annotation-processing</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.ozone</groupId>
       <artifactId>hdds-config</artifactId>
     </dependency>
     <dependency>
diff --git a/hadoop-hdds/common/src/main/resources/META-INF/services/javax.annotation.processing.Processor b/hadoop-hdds/common/src/main/resources/META-INF/services/javax.annotation.processing.Processor
index f29efda..8d65dbc 100644
--- a/hadoop-hdds/common/src/main/resources/META-INF/services/javax.annotation.processing.Processor
+++ b/hadoop-hdds/common/src/main/resources/META-INF/services/javax.annotation.processing.Processor
@@ -14,3 +14,5 @@
 # limitations under the License.
 
 org.apache.hadoop.hdds.conf.ConfigFileGenerator
+org.apache.ozone.annotations.RequestFeatureValidatorProcessor
+org.apache.ozone.annotations.ReplicateAnnotationProcessor
diff --git a/hadoop-hdds/pom.xml b/hadoop-hdds/pom.xml
index d981032..d95768f 100644
--- a/hadoop-hdds/pom.xml
+++ b/hadoop-hdds/pom.xml
@@ -30,6 +30,7 @@
   <packaging>pom</packaging>
 
   <modules>
+    <module>annotations</module>
     <module>hadoop-dependency-client</module>
     <module>hadoop-dependency-test</module>
     <module>hadoop-dependency-server</module>
@@ -157,6 +158,12 @@
 
       <dependency>
         <groupId>org.apache.ozone</groupId>
+        <artifactId>hdds-annotation-processing</artifactId>
+        <version>${hdds.version}</version>
+      </dependency>
+
+      <dependency>
+        <groupId>org.apache.ozone</groupId>
         <artifactId>hdds-test-utils</artifactId>
         <version>${hdds.version}</version>
         <scope>test</scope>
diff --git a/hadoop-ozone/dev-support/checks/rat.sh b/hadoop-ozone/dev-support/checks/rat.sh
index bd99df9..c87f7d0 100755
--- a/hadoop-ozone/dev-support/checks/rat.sh
+++ b/hadoop-ozone/dev-support/checks/rat.sh
@@ -21,10 +21,10 @@
 
 REPORT_FILE="$REPORT_DIR/summary.txt"
 
-dirs="dev-support/annotations hadoop-hdds hadoop-ozone"
+dirs="hadoop-hdds hadoop-ozone"
 
 for d in $dirs; do
-  pushd "$d"
+  pushd "$d" || exit 1
   mvn -B --no-transfer-progress -fn org.apache.rat:apache-rat-plugin:0.13:check
   popd
 done
diff --git a/hadoop-ozone/dist/src/main/license/jar-report.txt b/hadoop-ozone/dist/src/main/license/jar-report.txt
index ae984fb..fd2617d 100644
--- a/hadoop-ozone/dist/src/main/license/jar-report.txt
+++ b/hadoop-ozone/dist/src/main/license/jar-report.txt
@@ -61,6 +61,7 @@
 share/ozone/lib/hadoop-hdfs.jar
 share/ozone/lib/hadoop-shaded-guava.jar
 share/ozone/lib/hadoop-shaded-protobuf_3_7.jar
+share/ozone/lib/hdds-annotation-processing.jar
 share/ozone/lib/hdds-client.jar
 share/ozone/lib/hdds-common.jar
 share/ozone/lib/hdds-config.jar
@@ -206,7 +207,6 @@
 share/ozone/lib/opentracing-util.jar
 share/ozone/lib/orc-core.jar
 share/ozone/lib/osgi-resource-locator.jar
-share/ozone/lib/ozone-annotation-processing.jar
 share/ozone/lib/ozone-client.jar
 share/ozone/lib/ozone-common.jar
 share/ozone/lib/ozone-csi.jar
diff --git a/pom.xml b/pom.xml
index 72d9b48..35d3277 100644
--- a/pom.xml
+++ b/pom.xml
@@ -24,7 +24,6 @@
   <packaging>pom</packaging>
 
   <modules>
-    <module>dev-support/annotations</module>
     <module>hadoop-hdds</module>
     <module>hadoop-ozone</module>
   </modules>
@@ -168,10 +167,6 @@
     <hadoop-thirdparty.version>1.1.1</hadoop-thirdparty.version>
 
     <findbugs.version>3.0.0</findbugs.version>
-    <!--
-      | Keep this in sync with the version used in
-      | /dev-support/annotatons/pom.xml
-      -->
     <spotbugs.version>3.1.12</spotbugs.version>
     <dnsjava.version>2.1.7</dnsjava.version>
 
@@ -241,16 +236,8 @@
     <exec-maven-plugin.version>1.3.1</exec-maven-plugin.version>
     <make-maven-plugin.version>1.0-beta-1</make-maven-plugin.version>
     <native-maven-plugin.version>1.0-alpha-8</native-maven-plugin.version>
-    <!--
-     | Keep this in sync with the version used in
-     | /dev-support/annotatons/pom.xml
-     -->
     <maven-checkstyle-plugin.version>3.1.2</maven-checkstyle-plugin.version>
     <maven-site-plugin.version>3.9.1</maven-site-plugin.version>
-    <!--
-     | Keep this in sync with the version used in
-     | /dev-support/annotatons/pom.xml
-     -->
     <checkstyle.version>9.3</checkstyle.version>
     <surefire.fork.timeout>1200</surefire.fork.timeout>
     <aws-java-sdk.version>1.12.261</aws-java-sdk.version>
@@ -1639,13 +1626,6 @@
       </dependency>
     </dependencies>
   </dependencyManagement>
-  <dependencies>
-    <dependency>
-      <groupId>org.apache.ozone</groupId>
-      <artifactId>ozone-annotation-processing</artifactId>
-      <version>${ozone.version}</version>
-    </dependency>
-  </dependencies>
 
   <build>
     <extensions>