From 8c62620dedc054930ff63d618c687e5b7c41b6e5 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 - 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 | 187 ------------------ .../dubbo-spring-boot-compatible/pom.xml | 1 - dubbo-test/dubbo-dependencies-all/pom.xml | 5 - 10 files changed, 94 insertions(+), 220 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/dubbo-distribution/dubbo-bom/pom.xml b/dubbo-distribution/dubbo-bom/pom.xml index fcb99025dc2c..f0e941af742c 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 98c6f80fc3ae..1d9f92a5a90e 100644 --- a/dubbo-spring-boot/dubbo-spring-boot-compatible/autoconfigure/pom.xml +++ b/dubbo-spring-boot/dubbo-spring-boot-compatible/autoconfigure/pom.xml @@ -29,6 +29,10 @@ dubbo-spring-boot-autoconfigure-compatible Apache Dubbo Spring Boot Compatible for Spring Boot 1.x Auto-Configure + + ${project.build.directory}/generated-sources/java + + @@ -70,10 +74,9 @@ - org.apache.dubbo - dubbo-spring-boot-configuration-metadata-compatible - ${project.version} - provided + org.springframework.boot + spring-boot-configuration-processor + true @@ -85,17 +88,87 @@ - - - src/main/resources - - - META-INF - ../metadata/target/classes/META-INF - - spring-configuration-metadata.json - - - + + + org.apache.maven.plugins + maven-antrun-plugin + + + copy-sources + generate-sources + + run + + + + + + + + + + + + + + + + + + + clean-sources + process-resources + + run + + + + + + + + + + + org.codehaus.mojo + build-helper-maven-plugin + + + add-sources + generate-sources + + add-source + + + + ${sources_directory} + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + + + gen-metadata + process-resources + + compile + + + only + true + + + + + + **/DubboMetadataGenerateAutoConfiguration.java + + + + 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 efdcf9bc65f1..7186970c1927 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 @@ -36,13 +36,15 @@ import java.util.LinkedHashMap; import java.util.Map; +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 ff56b943b440..000000000000 --- a/dubbo-spring-boot/dubbo-spring-boot-compatible/metadata/pom.xml +++ /dev/null @@ -1,187 +0,0 @@ - - - - - org.apache.dubbo - dubbo-spring-boot-compatible - ${revision} - ../pom.xml - - 4.0.0 - - 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 - process-sources - - run - - - - - - - - - - - - - - - - - - - - - - - - clean-sources - compile - - run - - - - - - - - - - - org.codehaus.mojo - build-helper-maven-plugin - - - add-source - generate-sources - - add-source - - - - ${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 926e7b27b030..1526635a7f73 100644 --- a/dubbo-spring-boot/dubbo-spring-boot-compatible/pom.xml +++ b/dubbo-spring-boot/dubbo-spring-boot-compatible/pom.xml @@ -37,7 +37,6 @@ autoconfigure actuator - metadata diff --git a/dubbo-test/dubbo-dependencies-all/pom.xml b/dubbo-test/dubbo-dependencies-all/pom.xml index a9834cd0edc6..ab5635e36e6f 100644 --- a/dubbo-test/dubbo-dependencies-all/pom.xml +++ b/dubbo-test/dubbo-dependencies-all/pom.xml @@ -517,11 +517,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