From f89863a299ce718ec98baadeadac159b7de47b9c Mon Sep 17 00:00:00 2001 From: oxsean Date: Tue, 7 Nov 2023 08:09:09 +0000 Subject: [PATCH] fix(pom): Merge metadata module into autoconfigure module --- .artifacts | 1 - .editorconfig | 3 + dubbo-distribution/dubbo-bom/pom.xml | 5 - .../{metadata => autoconfigure}/README.md | 6 +- .../autoconfigure/pom.xml | 105 ++++++++-- .../DubboConfigurationProperties.java | 4 +- ...ubboMetadataGenerateAutoConfiguration.java | 0 ...itional-spring-configuration-metadata.json | 0 .../metadata/pom.xml | 185 ------------------ .../dubbo-spring-boot-compatible/pom.xml | 1 - dubbo-test/dubbo-dependencies-all/pom.xml | 5 - 11 files changed, 97 insertions(+), 218 deletions(-) rename dubbo-spring-boot/dubbo-spring-boot-compatible/{metadata => autoconfigure}/README.md (79%) rename dubbo-spring-boot/dubbo-spring-boot-compatible/{metadata => autoconfigure}/src/main/java/org/apache/dubbo/spring/boot/autoconfigure/DubboMetadataGenerateAutoConfiguration.java (100%) rename dubbo-spring-boot/dubbo-spring-boot-compatible/{metadata => autoconfigure}/src/main/resources/META-INF/additional-spring-configuration-metadata.json (100%) delete mode 100644 dubbo-spring-boot/dubbo-spring-boot-compatible/metadata/pom.xml diff --git a/.artifacts b/.artifacts index db1bbb11533f..5a8fb62cfc09 100644 --- a/.artifacts +++ b/.artifacts @@ -107,7 +107,6 @@ dubbo-spring-boot-actuator dubbo-spring-boot-actuator-compatible dubbo-spring-boot-autoconfigure dubbo-spring-boot-autoconfigure-compatible -dubbo-spring-boot-configuration-metadata-compatible dubbo-spring-boot-compatible dubbo-observability-spring-boot-starters dubbo-observability-spring-boot-autoconfigure diff --git a/.editorconfig b/.editorconfig index eefafba37cc5..68a55e785793 100644 --- a/.editorconfig +++ b/.editorconfig @@ -29,3 +29,6 @@ insert_final_newline = true [*.{java,xml}] indent_style = space indent_size = 4 + +[pom.xml] +indent_size = 2 diff --git a/dubbo-distribution/dubbo-bom/pom.xml b/dubbo-distribution/dubbo-bom/pom.xml index f22cfcab9c61..50c14ef2fcc1 100644 --- a/dubbo-distribution/dubbo-bom/pom.xml +++ b/dubbo-distribution/dubbo-bom/pom.xml @@ -643,11 +643,6 @@ dubbo-spring-boot-autoconfigure-compatible ${project.version} - - org.apache.dubbo - dubbo-spring-boot-configuration-metadata-compatible - ${project.version} - org.apache.dubbo dubbo-spring-boot-starter diff --git a/dubbo-spring-boot/dubbo-spring-boot-compatible/metadata/README.md b/dubbo-spring-boot/dubbo-spring-boot-compatible/autoconfigure/README.md similarity index 79% rename from dubbo-spring-boot/dubbo-spring-boot-compatible/metadata/README.md rename to dubbo-spring-boot/dubbo-spring-boot-compatible/autoconfigure/README.md index d2119d0d8c1c..99008e743737 100644 --- a/dubbo-spring-boot/dubbo-spring-boot-compatible/metadata/README.md +++ b/dubbo-spring-boot/dubbo-spring-boot-compatible/autoconfigure/README.md @@ -1,4 +1,4 @@ -# About dubbo-spring-boot-configuration-metadata-compatible module +# About spring-configuration-metadata ## Why @@ -10,9 +10,7 @@ This leads to missing comments and a lack of nested configuration options. There 1. Copy classes under `org/apache/dubbo/config` from `dubbo-common` to the `generated-sources` directory. 2. Replace `@Nest` with `@NestedConfigurationProperty`. -3. Copy the class `DubboConfigurationProperties.java` from `autoconfigure` to the `generated-sources` directory. -4. Use an annotation-only option to compile and generate `spring-configuration-metadata.json`. -5. During `autoconfigure` module compilation, will read `spring-configuration-metadata.json` from this module. +3. Use an annotation-only option to compile and generate `spring-configuration-metadata.json`. ## How to add a new configuration option diff --git a/dubbo-spring-boot/dubbo-spring-boot-compatible/autoconfigure/pom.xml b/dubbo-spring-boot/dubbo-spring-boot-compatible/autoconfigure/pom.xml index 4a5705905ccd..d9e06fa06c8f 100644 --- a/dubbo-spring-boot/dubbo-spring-boot-compatible/autoconfigure/pom.xml +++ b/dubbo-spring-boot/dubbo-spring-boot-compatible/autoconfigure/pom.xml @@ -27,6 +27,10 @@ dubbo-spring-boot-autoconfigure-compatible Apache Dubbo Spring Boot Compatible for Spring Boot 1.x Auto-Configure + + ${project.build.directory}/generated-sources/java + + @@ -68,10 +72,9 @@ - org.apache.dubbo - dubbo-spring-boot-configuration-metadata-compatible - ${project.version} - provided + org.springframework.boot + spring-boot-configuration-processor + true @@ -83,17 +86,87 @@ - - - src/main/resources - - - META-INF - ../metadata/target/classes/META-INF - - spring-configuration-metadata.json - - - + + + org.apache.maven.plugins + maven-antrun-plugin + + + copy-sources + + run + + generate-sources + + + + + + + + + + + + + + + + + + clean-sources + + run + + process-resources + + + + + + + + + + org.codehaus.mojo + build-helper-maven-plugin + + + add-sources + + add-source + + generate-sources + + + ${sources_directory} + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + + + **/DubboMetadataGenerateAutoConfiguration.java + + + + + gen-metadata + + compile + + process-resources + + only + true + + + + + diff --git a/dubbo-spring-boot/dubbo-spring-boot-compatible/autoconfigure/src/main/java/org/apache/dubbo/spring/boot/autoconfigure/DubboConfigurationProperties.java b/dubbo-spring-boot/dubbo-spring-boot-compatible/autoconfigure/src/main/java/org/apache/dubbo/spring/boot/autoconfigure/DubboConfigurationProperties.java index 959cee4a774e..5493dcd995d6 100644 --- a/dubbo-spring-boot/dubbo-spring-boot-compatible/autoconfigure/src/main/java/org/apache/dubbo/spring/boot/autoconfigure/DubboConfigurationProperties.java +++ b/dubbo-spring-boot/dubbo-spring-boot-compatible/autoconfigure/src/main/java/org/apache/dubbo/spring/boot/autoconfigure/DubboConfigurationProperties.java @@ -37,13 +37,15 @@ import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.boot.context.properties.NestedConfigurationProperty; +import static org.apache.dubbo.spring.boot.util.DubboUtils.DUBBO_PREFIX; + /** * Dubbo {@link ConfigurationProperties Config Properties} only used to generate JSON metadata (non-public class) * * @see ConfigKeys * @since 2.7.1 */ -@ConfigurationProperties("dubbo") +@ConfigurationProperties(DUBBO_PREFIX) public class DubboConfigurationProperties { /** diff --git a/dubbo-spring-boot/dubbo-spring-boot-compatible/metadata/src/main/java/org/apache/dubbo/spring/boot/autoconfigure/DubboMetadataGenerateAutoConfiguration.java b/dubbo-spring-boot/dubbo-spring-boot-compatible/autoconfigure/src/main/java/org/apache/dubbo/spring/boot/autoconfigure/DubboMetadataGenerateAutoConfiguration.java similarity index 100% rename from dubbo-spring-boot/dubbo-spring-boot-compatible/metadata/src/main/java/org/apache/dubbo/spring/boot/autoconfigure/DubboMetadataGenerateAutoConfiguration.java rename to dubbo-spring-boot/dubbo-spring-boot-compatible/autoconfigure/src/main/java/org/apache/dubbo/spring/boot/autoconfigure/DubboMetadataGenerateAutoConfiguration.java diff --git a/dubbo-spring-boot/dubbo-spring-boot-compatible/metadata/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/dubbo-spring-boot/dubbo-spring-boot-compatible/autoconfigure/src/main/resources/META-INF/additional-spring-configuration-metadata.json similarity index 100% rename from dubbo-spring-boot/dubbo-spring-boot-compatible/metadata/src/main/resources/META-INF/additional-spring-configuration-metadata.json rename to dubbo-spring-boot/dubbo-spring-boot-compatible/autoconfigure/src/main/resources/META-INF/additional-spring-configuration-metadata.json diff --git a/dubbo-spring-boot/dubbo-spring-boot-compatible/metadata/pom.xml b/dubbo-spring-boot/dubbo-spring-boot-compatible/metadata/pom.xml deleted file mode 100644 index d27b64c9a05b..000000000000 --- a/dubbo-spring-boot/dubbo-spring-boot-compatible/metadata/pom.xml +++ /dev/null @@ -1,185 +0,0 @@ - - - - 4.0.0 - - org.apache.dubbo - dubbo-spring-boot-compatible - ${revision} - ../pom.xml - - - dubbo-spring-boot-configuration-metadata-compatible - - - true - ${project.build.directory}/generated-sources/java - - - - - org.slf4j - slf4j-api - true - - - log4j - log4j - true - - - org.apache.logging.log4j - log4j-api - true - - - org.apache.logging.log4j - log4j-core - true - - - org.springframework.boot - spring-boot-autoconfigure - true - - - org.apache.dubbo - dubbo-common - ${project.version} - true - - - - org.springframework.boot - spring-boot-configuration-processor - true - - - - - - - org.apache.maven.plugins - maven-antrun-plugin - - - get-version-infos - none - - - copy-sources - - run - - process-sources - - - - - - - - - - - - - - - - - - - - - - - clean-sources - - run - - compile - - - - - - - - - - org.codehaus.mojo - build-helper-maven-plugin - - - add-source - - add-source - - generate-sources - - - ${sources_directory} - - - - - - - org.apache.maven.plugins - maven-compiler-plugin - - only - - - - maven-surefire-plugin - - true - - - - maven-javadoc-plugin - - true - - - - maven-jar-plugin - - - default-jar - none - - - - - maven-install-plugin - - true - - - - maven-source-plugin - - true - - - - - diff --git a/dubbo-spring-boot/dubbo-spring-boot-compatible/pom.xml b/dubbo-spring-boot/dubbo-spring-boot-compatible/pom.xml index 1285023d5be6..c91da792ba7c 100644 --- a/dubbo-spring-boot/dubbo-spring-boot-compatible/pom.xml +++ b/dubbo-spring-boot/dubbo-spring-boot-compatible/pom.xml @@ -31,7 +31,6 @@ autoconfigure actuator - metadata diff --git a/dubbo-test/dubbo-dependencies-all/pom.xml b/dubbo-test/dubbo-dependencies-all/pom.xml index 306f3e1e032e..a782e9e39d49 100644 --- a/dubbo-test/dubbo-dependencies-all/pom.xml +++ b/dubbo-test/dubbo-dependencies-all/pom.xml @@ -516,11 +516,6 @@ dubbo-spring-boot-autoconfigure-compatible ${project.version} - - org.apache.dubbo - dubbo-spring-boot-configuration-metadata-compatible - ${project.version} - org.apache.dubbo dubbo-spring-boot-starter