fix(pom): Merge metadata module into autoconfigure module (#13330)

This commit is contained in:
Sean Yang 2023-11-08 08:13:05 +08:00 committed by GitHub
parent 90bc72e641
commit 2b62e88974
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
16 changed files with 97 additions and 226 deletions

View File

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

View File

@ -29,3 +29,6 @@ insert_final_newline = true
[*.{java,xml}]
indent_style = space
indent_size = 4
[pom.xml]
indent_size = 2

View File

@ -297,7 +297,6 @@
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<forkCount>1</forkCount>
<!--<reuseForks>false</reuseForks>-->
</configuration>
</plugin>
</plugins>

View File

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

View File

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

View File

@ -27,6 +27,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>
@ -68,10 +72,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 -->
@ -83,17 +86,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>
<goals>
<goal>run</goal>
</goals>
<phase>generate-sources</phase>
<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>
<goals>
<goal>run</goal>
</goals>
<phase>process-resources</phase>
<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>
<goals>
<goal>add-source</goal>
</goals>
<phase>generate-sources</phase>
<configuration>
<sources>
<source>${sources_directory}</source>
</sources>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<excludes>
<exclude>**/DubboMetadataGenerateAutoConfiguration.java</exclude>
</excludes>
</configuration>
<executions>
<execution>
<id>gen-metadata</id>
<goals>
<goal>compile</goal>
</goals>
<phase>process-resources</phase>
<configuration combine.self="override">
<proc>only</proc>
<fork>true</fork>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

View File

@ -37,13 +37,15 @@ import java.util.Map;
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 {
/**

View File

@ -1,185 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
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.
-->
<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 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.apache.dubbo</groupId>
<artifactId>dubbo-spring-boot-compatible</artifactId>
<version>${revision}</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>dubbo-spring-boot-configuration-metadata-compatible</artifactId>
<properties>
<skip_maven_deploy>true</skip_maven_deploy>
<sources_directory>${project.build.directory}/generated-sources/java</sources_directory>
</properties>
<dependencies>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-autoconfigure</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.apache.dubbo</groupId>
<artifactId>dubbo-common</artifactId>
<version>${project.version}</version>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-configuration-processor</artifactId>
<optional>true</optional>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<id>get-version-infos</id>
<phase>none</phase>
</execution>
<execution>
<id>copy-sources</id>
<goals>
<goal>run</goal>
</goals>
<phase>process-sources</phase>
<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>
<copy todir="${sources_directory}">
<fileset dir="../autoconfigure/src/main/java">
<include name="**/DubboConfigurationProperties.java" />
</fileset>
</copy>
</target>
</configuration>
</execution>
<execution>
<id>clean-sources</id>
<goals>
<goal>run</goal>
</goals>
<phase>compile</phase>
<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-source</id>
<goals>
<goal>add-source</goal>
</goals>
<phase>generate-sources</phase>
<configuration>
<sources>
<source>${sources_directory}</source>
</sources>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<proc>only</proc>
</configuration>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
<plugin>
<artifactId>maven-javadoc-plugin</artifactId>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<executions>
<execution>
<id>default-jar</id>
<phase>none</phase>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-install-plugin</artifactId>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
<plugin>
<artifactId>maven-source-plugin</artifactId>
<configuration>
<skipSource>true</skipSource>
</configuration>
</plugin>
</plugins>
</build>
</project>

View File

@ -31,7 +31,6 @@
<modules>
<module>autoconfigure</module>
<module>actuator</module>
<module>metadata</module>
</modules>
<properties>
@ -60,7 +59,6 @@
<configuration>
<useSystemClassLoader>true</useSystemClassLoader>
<forkCount>1</forkCount>
<reuseForks>false</reuseForks>
<argLine>${argline} ${jacocoArgLine}
--add-opens java.base/java.lang=ALL-UNNAMED
--add-opens java.base/java.math=ALL-UNNAMED

View File

@ -516,11 +516,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>

View File

@ -97,7 +97,6 @@
<configuration>
<useSystemClassLoader>true</useSystemClassLoader>
<forkCount>1</forkCount>
<reuseForks>false</reuseForks>
<argLine>${argline} ${jacocoArgLine}
--add-opens java.base/java.lang=ALL-UNNAMED
--add-opens java.base/java.math=ALL-UNNAMED

View File

@ -97,7 +97,6 @@
<configuration>
<useSystemClassLoader>true</useSystemClassLoader>
<forkCount>1</forkCount>
<reuseForks>false</reuseForks>
<argLine>${argline} ${jacocoArgLine}
--add-opens java.base/java.lang=ALL-UNNAMED
--add-opens java.base/java.math=ALL-UNNAMED

View File

@ -97,7 +97,6 @@
<configuration>
<useSystemClassLoader>true</useSystemClassLoader>
<forkCount>1</forkCount>
<reuseForks>false</reuseForks>
<argLine>${argline} ${jacocoArgLine}
--add-opens java.base/java.lang=ALL-UNNAMED
--add-opens java.base/java.math=ALL-UNNAMED

View File

@ -357,7 +357,6 @@
<configuration>
<useSystemClassLoader>true</useSystemClassLoader>
<forkCount>1</forkCount>
<reuseForks>false</reuseForks>
<argLine>${argline} ${jacocoArgLine}</argLine>
<systemProperties>
<!-- common shared -->
@ -761,7 +760,6 @@
<configuration>
<useSystemClassLoader>true</useSystemClassLoader>
<forkCount>1</forkCount>
<reuseForks>false</reuseForks>
<argLine>${argline} ${jacocoArgLine}
--add-opens java.base/java.lang=ALL-UNNAMED
--add-opens java.base/java.math=ALL-UNNAMED
@ -786,7 +784,6 @@
<configuration>
<useSystemClassLoader>true</useSystemClassLoader>
<forkCount>1</forkCount>
<reuseForks>false</reuseForks>
<argLine>${argline} ${jacocoArgLine}</argLine>
<systemProperties>
<!-- common shared -->