This is an automated email from the ASF dual-hosted git repository.
adoroszlai pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ozone.git
The following commit(s) were added to refs/heads/master by this push:
new e0f08b2471c HDDS-13179. rename-generated-config fails on re-compile
without clean (#8569)
e0f08b2471c is described below
commit e0f08b2471ca32f30177326fde039e571807e89d
Author: Chung En Lee <[email protected]>
AuthorDate: Fri Jun 6 15:48:35 2025 +0800
HDDS-13179. rename-generated-config fails on re-compile without clean
(#8569)
---
hadoop-hdds/client/pom.xml | 10 -----
hadoop-hdds/common/pom.xml | 14 ------
hadoop-hdds/config/pom.xml | 3 ++
.../hadoop/hdds/conf/ConfigFileGenerator.java | 14 ++++--
hadoop-hdds/container-service/pom.xml | 10 -----
hadoop-hdds/framework/pom.xml | 14 ------
hadoop-hdds/server-scm/pom.xml | 10 -----
hadoop-ozone/common/pom.xml | 10 -----
hadoop-ozone/csi/pom.xml | 10 -----
hadoop-ozone/ozone-manager/pom.xml | 10 -----
hadoop-ozone/recon/pom.xml | 10 -----
pom.xml | 50 ++--------------------
12 files changed, 17 insertions(+), 148 deletions(-)
diff --git a/hadoop-hdds/client/pom.xml b/hadoop-hdds/client/pom.xml
index bbcf366bf6b..917d90f88e8 100644
--- a/hadoop-hdds/client/pom.xml
+++ b/hadoop-hdds/client/pom.xml
@@ -110,16 +110,6 @@
<build>
<plugins>
- <plugin>
- <groupId>com.coderplus.maven.plugins</groupId>
- <artifactId>copy-rename-maven-plugin</artifactId>
- <executions>
- <execution>
- <id>rename-generated-config</id>
- <phase>process-classes</phase>
- </execution>
- </executions>
- </plugin>
<plugin>
<groupId>com.github.spotbugs</groupId>
<artifactId>spotbugs-maven-plugin</artifactId>
diff --git a/hadoop-hdds/common/pom.xml b/hadoop-hdds/common/pom.xml
index 45f10c67431..50094356f7b 100644
--- a/hadoop-hdds/common/pom.xml
+++ b/hadoop-hdds/common/pom.xml
@@ -262,20 +262,6 @@
</execution>
</executions>
</plugin>
- <plugin>
- <groupId>com.coderplus.maven.plugins</groupId>
- <artifactId>copy-rename-maven-plugin</artifactId>
- <executions>
- <execution>
- <id>rename-generated-config</id>
- <phase>process-classes</phase>
- </execution>
- <execution>
- <id>rename-generated-test-config</id>
- <phase>process-test-classes</phase>
- </execution>
- </executions>
- </plugin>
<plugin>
<groupId>com.github.spotbugs</groupId>
<artifactId>spotbugs-maven-plugin</artifactId>
diff --git a/hadoop-hdds/config/pom.xml b/hadoop-hdds/config/pom.xml
index 47ccda8baf8..45e32b47db2 100644
--- a/hadoop-hdds/config/pom.xml
+++ b/hadoop-hdds/config/pom.xml
@@ -70,6 +70,9 @@
<annotationProcessors>
<annotationProcessor>org.apache.hadoop.hdds.conf.ConfigFileGenerator</annotationProcessor>
</annotationProcessors>
+ <compilerArgs>
+ <arg>-AartifactId=</arg>
+ </compilerArgs>
</configuration>
</execution>
</executions>
diff --git
a/hadoop-hdds/config/src/main/java/org/apache/hadoop/hdds/conf/ConfigFileGenerator.java
b/hadoop-hdds/config/src/main/java/org/apache/hadoop/hdds/conf/ConfigFileGenerator.java
index 372d75753b6..be07fddb310 100644
---
a/hadoop-hdds/config/src/main/java/org/apache/hadoop/hdds/conf/ConfigFileGenerator.java
+++
b/hadoop-hdds/config/src/main/java/org/apache/hadoop/hdds/conf/ConfigFileGenerator.java
@@ -49,7 +49,8 @@
@SupportedSourceVersion(SourceVersion.RELEASE_8)
public class ConfigFileGenerator extends AbstractProcessor {
- public static final String OUTPUT_FILE_NAME = "ozone-default-generated.xml";
+ private static final String OUTPUT_FILE_NAME = "ozone-default-generated.xml";
+ private static final String OUTPUT_FILE_POSTFIX = "-default.xml";
private static final SimpleTypeVisitor8<Element, Void> GET_PARENT_ELEMENT =
new SimpleTypeVisitor8<Element, Void>() {
@@ -73,9 +74,16 @@ public boolean process(Set<? extends TypeElement>
annotations,
//load existing generated config (if exists)
boolean resourceExists = true;
ConfigFileAppender appender = new ConfigFileAppender();
+ String currentArtifactId = processingEnv.getOptions().get("artifactId");
+ String outputFileName;
+ if (currentArtifactId == null || currentArtifactId.isEmpty()) {
+ outputFileName = OUTPUT_FILE_NAME;
+ } else {
+ outputFileName = currentArtifactId + OUTPUT_FILE_POSTFIX;
+ }
try (InputStream input = filer
.getResource(StandardLocation.CLASS_OUTPUT, "",
- OUTPUT_FILE_NAME).openInputStream()) {
+ outputFileName).openInputStream()) {
appender.load(input);
} catch (FileNotFoundException | NoSuchFileException ex) {
appender.init();
@@ -110,7 +118,7 @@ public boolean process(Set<? extends TypeElement>
annotations,
if (!resourceExists) {
FileObject resource = filer
.createResource(StandardLocation.CLASS_OUTPUT, "",
- OUTPUT_FILE_NAME);
+ outputFileName);
try (Writer writer = new OutputStreamWriter(
resource.openOutputStream(), StandardCharsets.UTF_8)) {
diff --git a/hadoop-hdds/container-service/pom.xml
b/hadoop-hdds/container-service/pom.xml
index fde6e8c7898..2c5314068fd 100644
--- a/hadoop-hdds/container-service/pom.xml
+++ b/hadoop-hdds/container-service/pom.xml
@@ -263,16 +263,6 @@
<build>
<plugins>
- <plugin>
- <groupId>com.coderplus.maven.plugins</groupId>
- <artifactId>copy-rename-maven-plugin</artifactId>
- <executions>
- <execution>
- <id>rename-generated-config</id>
- <phase>process-classes</phase>
- </execution>
- </executions>
- </plugin>
<plugin>
<groupId>com.github.spotbugs</groupId>
<artifactId>spotbugs-maven-plugin</artifactId>
diff --git a/hadoop-hdds/framework/pom.xml b/hadoop-hdds/framework/pom.xml
index 782d8b6fce8..2f4d3a58b38 100644
--- a/hadoop-hdds/framework/pom.xml
+++ b/hadoop-hdds/framework/pom.xml
@@ -332,20 +332,6 @@
<build>
<plugins>
- <plugin>
- <groupId>com.coderplus.maven.plugins</groupId>
- <artifactId>copy-rename-maven-plugin</artifactId>
- <executions>
- <execution>
- <id>rename-generated-config</id>
- <phase>process-classes</phase>
- </execution>
- <execution>
- <id>rename-generated-test-config</id>
- <phase>process-test-classes</phase>
- </execution>
- </executions>
- </plugin>
<plugin>
<groupId>com.github.spotbugs</groupId>
<artifactId>spotbugs-maven-plugin</artifactId>
diff --git a/hadoop-hdds/server-scm/pom.xml b/hadoop-hdds/server-scm/pom.xml
index 7f9db0c04d0..4761fcd722a 100644
--- a/hadoop-hdds/server-scm/pom.xml
+++ b/hadoop-hdds/server-scm/pom.xml
@@ -241,16 +241,6 @@
</testResource>
</testResources>
<plugins>
- <plugin>
- <groupId>com.coderplus.maven.plugins</groupId>
- <artifactId>copy-rename-maven-plugin</artifactId>
- <executions>
- <execution>
- <id>rename-generated-config</id>
- <phase>process-classes</phase>
- </execution>
- </executions>
- </plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
diff --git a/hadoop-ozone/common/pom.xml b/hadoop-ozone/common/pom.xml
index 0f91ba21d9a..cb082b9d6c4 100644
--- a/hadoop-ozone/common/pom.xml
+++ b/hadoop-ozone/common/pom.xml
@@ -187,16 +187,6 @@
</resource>
</resources>
<plugins>
- <plugin>
- <groupId>com.coderplus.maven.plugins</groupId>
- <artifactId>copy-rename-maven-plugin</artifactId>
- <executions>
- <execution>
- <id>rename-generated-config</id>
- <phase>process-classes</phase>
- </execution>
- </executions>
- </plugin>
<plugin>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-maven-plugins</artifactId>
diff --git a/hadoop-ozone/csi/pom.xml b/hadoop-ozone/csi/pom.xml
index eb8c3b6fa9a..6dac6cb42db 100644
--- a/hadoop-ozone/csi/pom.xml
+++ b/hadoop-ozone/csi/pom.xml
@@ -194,16 +194,6 @@
<build>
<plugins>
- <plugin>
- <groupId>com.coderplus.maven.plugins</groupId>
- <artifactId>copy-rename-maven-plugin</artifactId>
- <executions>
- <execution>
- <id>rename-generated-config</id>
- <phase>process-classes</phase>
- </execution>
- </executions>
- </plugin>
<plugin>
<groupId>com.salesforce.servicelibs</groupId>
<artifactId>proto-backwards-compatibility</artifactId>
diff --git a/hadoop-ozone/ozone-manager/pom.xml
b/hadoop-ozone/ozone-manager/pom.xml
index d2dcdb9d657..cfe37bba1b8 100644
--- a/hadoop-ozone/ozone-manager/pom.xml
+++ b/hadoop-ozone/ozone-manager/pom.xml
@@ -383,16 +383,6 @@
</testResource>
</testResources>
<plugins>
- <plugin>
- <groupId>com.coderplus.maven.plugins</groupId>
- <artifactId>copy-rename-maven-plugin</artifactId>
- <executions>
- <execution>
- <id>rename-generated-config</id>
- <phase>process-classes</phase>
- </execution>
- </executions>
- </plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
diff --git a/hadoop-ozone/recon/pom.xml b/hadoop-ozone/recon/pom.xml
index df5d4527f2d..42be97ed198 100644
--- a/hadoop-ozone/recon/pom.xml
+++ b/hadoop-ozone/recon/pom.xml
@@ -326,16 +326,6 @@
</resource>
</resources>
<plugins>
- <plugin>
- <groupId>com.coderplus.maven.plugins</groupId>
- <artifactId>copy-rename-maven-plugin</artifactId>
- <executions>
- <execution>
- <id>rename-generated-config</id>
- <phase>process-classes</phase>
- </execution>
- </executions>
- </plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
diff --git a/pom.xml b/pom.xml
index 837522f95b0..0341797c945 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1804,6 +1804,9 @@
<version>${maven-compiler-plugin.version}</version>
<configuration>
<useIncrementalCompilation>false</useIncrementalCompilation>
+ <compilerArgs>
+ <arg>-AartifactId=${project.artifactId}</arg>
+ </compilerArgs>
</configuration>
</plugin>
<plugin>
@@ -2170,53 +2173,6 @@
<includeTests>true</includeTests>
</configuration>
</plugin>
- <plugin>
- <groupId>com.coderplus.maven.plugins</groupId>
- <artifactId>copy-rename-maven-plugin</artifactId>
- <version>${copy-rename-maven-plugin.version}</version>
- <executions>
- <!--
- If a new module is introduced with generated config:
- - override ban-annotations execution of maven-enforcer-plugin
- - configure maven-compiler-plugin with the ConfigFileGenerator
annotationProcessor
- - bind one or both of these rename executions
- - add the module's name in OzoneConfiguration#activate
- See hadoop-hdds/common/pom.xml for example.
- -->
- <execution>
- <id>rename-generated-config</id>
- <goals>
- <goal>rename</goal>
- </goals>
- <!-- bind to process-classes in modules where needed -->
- <phase>none</phase>
- <configuration>
- <fileSets>
- <fileSet>
-
<sourceFile>${project.build.outputDirectory}/ozone-default-generated.xml</sourceFile>
-
<destinationFile>${project.build.outputDirectory}/${project.artifactId}-default.xml</destinationFile>
- </fileSet>
- </fileSets>
- </configuration>
- </execution>
- <execution>
- <id>rename-generated-test-config</id>
- <goals>
- <goal>rename</goal>
- </goals>
- <!-- bind to process-test-classes in modules where needed -->
- <phase>none</phase>
- <configuration>
- <fileSets>
- <fileSet>
-
<sourceFile>${project.build.testOutputDirectory}/ozone-default-generated.xml</sourceFile>
-
<destinationFile>${project.build.testOutputDirectory}/${project.artifactId}-default.xml</destinationFile>
- </fileSet>
- </fileSets>
- </configuration>
- </execution>
- </executions>
- </plugin>
</plugins>
</pluginManagement>
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]