Skip to content

Commit

Permalink
fix(pom): Merge metadata module into autoconfigure module
Browse files Browse the repository at this point in the history
  • Loading branch information
oxsean committed Nov 7, 2023
1 parent 88deb9b commit 8c62620
Show file tree
Hide file tree
Showing 10 changed files with 94 additions and 220 deletions.
1 change: 0 additions & 1 deletion .artifacts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 0 additions & 5 deletions dubbo-distribution/dubbo-bom/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -643,11 +643,6 @@
<artifactId>dubbo-spring-boot-autoconfigure-compatible</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.dubbo</groupId>
<artifactId>dubbo-spring-boot-configuration-metadata-compatible</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.dubbo</groupId>
<artifactId>dubbo-spring-boot-starter</artifactId>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# About dubbo-spring-boot-configuration-metadata-compatible module
# About spring-configuration-metadata

## Why

Expand All @@ -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

Expand Down
105 changes: 89 additions & 16 deletions dubbo-spring-boot/dubbo-spring-boot-compatible/autoconfigure/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@
<artifactId>dubbo-spring-boot-autoconfigure-compatible</artifactId>
<description>Apache Dubbo Spring Boot Compatible for Spring Boot 1.x Auto-Configure</description>

<properties>
<sources_directory>${project.build.directory}/generated-sources/java</sources_directory>
</properties>

<dependencies>
<!-- Spring Boot dependencies -->
<dependency>
Expand Down Expand Up @@ -70,10 +74,9 @@
</dependency>

<dependency>
<groupId>org.apache.dubbo</groupId>
<artifactId>dubbo-spring-boot-configuration-metadata-compatible</artifactId>
<version>${project.version}</version>
<scope>provided</scope>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-configuration-processor</artifactId>
<optional>true</optional>
</dependency>

<!-- Test Dependencies -->
Expand All @@ -85,17 +88,87 @@
</dependencies>

<build>
<resources>
<resource>
<directory>src/main/resources</directory>
</resource>
<resource>
<targetPath>META-INF</targetPath>
<directory>../metadata/target/classes/META-INF</directory>
<includes>
<include>spring-configuration-metadata.json</include>
</includes>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<id>copy-sources</id>
<phase>generate-sources</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<target>
<delete dir="${sources_directory}" quiet="true"/>
<copy todir="${sources_directory}">
<fileset dir="../../../dubbo-common/src/main/java">
<include name="org/apache/dubbo/config/**/*.java"/>
</fileset>
</copy>
<replace token="@Nested" value="@org.springframework.boot.context.properties.NestedConfigurationProperty">
<fileset dir="${sources_directory}">
<include name="**/*.java"/>
</fileset>
</replace>
</target>
</configuration>
</execution>
<execution>
<id>clean-sources</id>
<phase>process-resources</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<target>
<delete dir="${sources_directory}" quiet="true"/>
</target>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<executions>
<execution>
<id>add-sources</id>
<phase>generate-sources</phase>
<goals>
<goal>add-source</goal>
</goals>
<configuration>
<sources>
<source>${sources_directory}</source>
</sources>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<executions>
<execution>
<id>gen-metadata</id>
<phase>process-resources</phase>
<goals>
<goal>compile</goal>
</goals>
<configuration combine.self="override">
<proc>only</proc>
<fork>true</fork>
</configuration>
</execution>
</executions>
<configuration>
<excludes>
<exclude>**/DubboMetadataGenerateAutoConfiguration.java</exclude>
</excludes>
</configuration>
</plugin>
</plugins>
</build>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

/**
Expand Down
187 changes: 0 additions & 187 deletions dubbo-spring-boot/dubbo-spring-boot-compatible/metadata/pom.xml

This file was deleted.

1 change: 0 additions & 1 deletion dubbo-spring-boot/dubbo-spring-boot-compatible/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
<modules>
<module>autoconfigure</module>
<module>actuator</module>
<module>metadata</module>
</modules>

<profiles>
Expand Down
5 changes: 0 additions & 5 deletions dubbo-test/dubbo-dependencies-all/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -517,11 +517,6 @@
<artifactId>dubbo-spring-boot-autoconfigure-compatible</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.dubbo</groupId>
<artifactId>dubbo-spring-boot-configuration-metadata-compatible</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.dubbo</groupId>
<artifactId>dubbo-spring-boot-starter</artifactId>
Expand Down

0 comments on commit 8c62620

Please sign in to comment.