fix: cross-Boot-version autoconfiguration and CI-friendly version resolution

- OrdoJdbcAutoConfiguration: use string-based @AutoConfigureAfter(name = ...)
  to reference both Spring Boot 3.x and 4.x DataSource/Flyway autoconfiguration
  classes, since Boot 4 relocated these to dedicated modules.
- flatten-maven-plugin: switch flattenMode from resolveCiFriendliesOnly to
  defaults so inter-module dependency versions are fully resolved (not just
  the project's own <version>) when installed, fixing dependency resolution
  for external consumers.
- Align sibling-module dependency versions to use \ consistently.
- Ignore generated .flattened-pom.xml files.
This commit is contained in:
0264408
2026-09-10 10:26:59 +08:00
parent c782e6cdc3
commit c524c74289
9 changed files with 64 additions and 19 deletions
+1
View File
@@ -3,6 +3,7 @@ target/
!**/src/main/**/target/ !**/src/main/**/target/
!**/src/test/**/target/ !**/src/test/**/target/
.kotlin .kotlin
.flattened-pom.xml
### IntelliJ IDEA ### ### IntelliJ IDEA ###
.idea/modules.xml .idea/modules.xml
+1 -1
View File
@@ -6,7 +6,7 @@
<parent> <parent>
<groupId>com.jetlumen</groupId> <groupId>com.jetlumen</groupId>
<artifactId>ordo</artifactId> <artifactId>ordo</artifactId>
<version>1.0-SNAPSHOT</version> <version>${revision}</version>
</parent> </parent>
<artifactId>ordo-api</artifactId> <artifactId>ordo-api</artifactId>
+2 -2
View File
@@ -6,7 +6,7 @@
<parent> <parent>
<groupId>com.jetlumen</groupId> <groupId>com.jetlumen</groupId>
<artifactId>ordo</artifactId> <artifactId>ordo</artifactId>
<version>1.0-SNAPSHOT</version> <version>${revision}</version>
</parent> </parent>
<artifactId>ordo-core</artifactId> <artifactId>ordo-core</artifactId>
@@ -15,7 +15,7 @@
<dependency> <dependency>
<groupId>com.jetlumen</groupId> <groupId>com.jetlumen</groupId>
<artifactId>ordo-api</artifactId> <artifactId>ordo-api</artifactId>
<version>${project.version}</version> <version>${revision}</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.junit.jupiter</groupId> <groupId>org.junit.jupiter</groupId>
+3 -3
View File
@@ -6,7 +6,7 @@
<parent> <parent>
<groupId>com.jetlumen</groupId> <groupId>com.jetlumen</groupId>
<artifactId>ordo</artifactId> <artifactId>ordo</artifactId>
<version>1.0-SNAPSHOT</version> <version>${revision}</version>
</parent> </parent>
<artifactId>ordo-example</artifactId> <artifactId>ordo-example</artifactId>
@@ -15,12 +15,12 @@
<dependency> <dependency>
<groupId>com.jetlumen</groupId> <groupId>com.jetlumen</groupId>
<artifactId>ordo-api</artifactId> <artifactId>ordo-api</artifactId>
<version>${project.version}</version> <version>${revision}</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.jetlumen</groupId> <groupId>com.jetlumen</groupId>
<artifactId>ordo-core</artifactId> <artifactId>ordo-core</artifactId>
<version>${project.version}</version> <version>${revision}</version>
</dependency> </dependency>
</dependencies> </dependencies>
+4 -4
View File
@@ -6,7 +6,7 @@
<parent> <parent>
<groupId>com.jetlumen</groupId> <groupId>com.jetlumen</groupId>
<artifactId>ordo</artifactId> <artifactId>ordo</artifactId>
<version>1.0-SNAPSHOT</version> <version>${revision}</version>
</parent> </parent>
<artifactId>ordo-spring-boot-autoconfigure</artifactId> <artifactId>ordo-spring-boot-autoconfigure</artifactId>
@@ -34,17 +34,17 @@
<dependency> <dependency>
<groupId>com.jetlumen</groupId> <groupId>com.jetlumen</groupId>
<artifactId>ordo-api</artifactId> <artifactId>ordo-api</artifactId>
<version>${project.version}</version> <version>${revision}</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.jetlumen</groupId> <groupId>com.jetlumen</groupId>
<artifactId>ordo-core</artifactId> <artifactId>ordo-core</artifactId>
<version>${project.version}</version> <version>${revision}</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.jetlumen</groupId> <groupId>com.jetlumen</groupId>
<artifactId>ordo-storage-jdbc</artifactId> <artifactId>ordo-storage-jdbc</artifactId>
<version>${project.version}</version> <version>${revision}</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
@@ -18,8 +18,6 @@ import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.autoconfigure.flyway.FlywayAutoConfiguration;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.boot.sql.init.dependency.DependsOnDatabaseInitialization; import org.springframework.boot.sql.init.dependency.DependsOnDatabaseInitialization;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
@@ -37,7 +35,14 @@ import java.time.Clock;
@ConditionalOnProperty(prefix = "ordo", name = "enabled", havingValue = "true", matchIfMissing = true) @ConditionalOnProperty(prefix = "ordo", name = "enabled", havingValue = "true", matchIfMissing = true)
@ConditionalOnClass(DataSource.class) @ConditionalOnClass(DataSource.class)
@ConditionalOnBean(DataSource.class) @ConditionalOnBean(DataSource.class)
@AutoConfigureAfter({DataSourceAutoConfiguration.class, FlywayAutoConfiguration.class}) @AutoConfigureAfter(name = {
// Spring Boot 3.x locations
"org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration",
"org.springframework.boot.autoconfigure.flyway.FlywayAutoConfiguration",
// Spring Boot 4.x locations (JDBC/Flyway autoconfiguration moved to dedicated modules)
"org.springframework.boot.jdbc.autoconfigure.DataSourceAutoConfiguration",
"org.springframework.boot.flyway.autoconfigure.FlywayAutoConfiguration"
})
@EnableConfigurationProperties(OrdoProperties.class) @EnableConfigurationProperties(OrdoProperties.class)
public class OrdoJdbcAutoConfiguration { public class OrdoJdbcAutoConfiguration {
+2 -2
View File
@@ -6,7 +6,7 @@
<parent> <parent>
<groupId>com.jetlumen</groupId> <groupId>com.jetlumen</groupId>
<artifactId>ordo</artifactId> <artifactId>ordo</artifactId>
<version>1.0-SNAPSHOT</version> <version>${revision}</version>
</parent> </parent>
<artifactId>ordo-spring-boot-starter</artifactId> <artifactId>ordo-spring-boot-starter</artifactId>
@@ -34,7 +34,7 @@
<dependency> <dependency>
<groupId>com.jetlumen</groupId> <groupId>com.jetlumen</groupId>
<artifactId>ordo-spring-boot-autoconfigure</artifactId> <artifactId>ordo-spring-boot-autoconfigure</artifactId>
<version>${project.version}</version> <version>${revision}</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
+3 -3
View File
@@ -6,7 +6,7 @@
<parent> <parent>
<groupId>com.jetlumen</groupId> <groupId>com.jetlumen</groupId>
<artifactId>ordo</artifactId> <artifactId>ordo</artifactId>
<version>1.0-SNAPSHOT</version> <version>${revision}</version>
</parent> </parent>
<artifactId>ordo-storage-jdbc</artifactId> <artifactId>ordo-storage-jdbc</artifactId>
@@ -15,12 +15,12 @@
<dependency> <dependency>
<groupId>com.jetlumen</groupId> <groupId>com.jetlumen</groupId>
<artifactId>ordo-api</artifactId> <artifactId>ordo-api</artifactId>
<version>${project.version}</version> <version>${revision}</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.jetlumen</groupId> <groupId>com.jetlumen</groupId>
<artifactId>ordo-core</artifactId> <artifactId>ordo-core</artifactId>
<version>${project.version}</version> <version>${revision}</version>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<dependency> <dependency>
+40 -1
View File
@@ -6,7 +6,7 @@
<groupId>com.jetlumen</groupId> <groupId>com.jetlumen</groupId>
<artifactId>ordo</artifactId> <artifactId>ordo</artifactId>
<version>1.0-SNAPSHOT</version> <version>${revision}</version>
<packaging>pom</packaging> <packaging>pom</packaging>
@@ -22,6 +22,7 @@
</modules> </modules>
<properties> <properties>
<revision>0.0.1-SNAPSHOT</revision>
<maven.compiler.source>21</maven.compiler.source> <maven.compiler.source>21</maven.compiler.source>
<maven.compiler.target>21</maven.compiler.target> <maven.compiler.target>21</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
@@ -63,6 +64,44 @@
<artifactId>maven-surefire-plugin</artifactId> <artifactId>maven-surefire-plugin</artifactId>
<version>3.5.2</version> <version>3.5.2</version>
</plugin> </plugin>
<plugin>
<!--
Resolves ${revision} and inter-module dependency versions before the
POM is installed/deployed, so consumers outside this reactor (e.g.
rhizome) get concrete versions instead of unresolved placeholders.
flattenMode=resolveCiFriendliesOnly only resolves the revision/sha1/
changelist properties inside <version>/<parent><version> and leaves
everything else (including <dependency><version>${revision}</version>)
untouched - that mode is NOT sufficient here. "defaults" performs full
dependency resolution (pulling exact versions from dependencyManagement
and interpolating all properties), producing a self-contained pom for
each module with no leftover placeholders.
-->
<groupId>org.codehaus.mojo</groupId>
<artifactId>flatten-maven-plugin</artifactId>
<version>1.6.0</version>
<configuration>
<updatePomFile>true</updatePomFile>
<flattenMode>defaults</flattenMode>
</configuration>
<executions>
<execution>
<id>flatten</id>
<phase>process-resources</phase>
<goals>
<goal>flatten</goal>
</goals>
</execution>
<execution>
<id>flatten.clean</id>
<phase>clean</phase>
<goals>
<goal>clean</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins> </plugins>
</build> </build>