Files
java21-template/pom.xml
T
Bruno GaoandQwen-Coder eefe2c5b34 M2: Add complete Java21 template with Clean Architecture implementation
- Add four-layer modular structure (domain, application, infrastructure, api)
- Implement complete CRUD example with Order entity
- Add ArchUnit architecture compliance tests
- Add Maven configuration with proper dependency management
- Add Dockerfile for containerization
- Add Kustomize deployment templates
- Add initialization script (init.sh)
- Add CI/CD workflow configuration
- Add comprehensive documentation and configuration files

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
2026-02-11 23:54:21 +08:00

172 lines
6.7 KiB
XML

<?xml version="1.0" encoding="UTF-8"?>
<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
https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>3.5.10</version>
<relativePath/>
</parent>
<groupId>com.example.tmpl</groupId>
<artifactId>tmpl-service</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>pom</packaging>
<name>tmpl-service</name>
<description>Java 21 Service Template - Clean Architecture</description>
<modules>
<module>tmpl-domain</module>
<module>tmpl-application</module>
<module>tmpl-infrastructure</module>
<module>tmpl-api</module>
</modules>
<properties>
<java.version>21</java.version>
<maven.compiler.source>21</maven.compiler.source>
<maven.compiler.target>21</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<!-- 依赖版本(Spring Boot 管理的不在此重复声明) -->
<mapstruct.version>1.6.3</mapstruct.version>
<springdoc.version>2.8.4</springdoc.version>
<archunit.version>1.3.0</archunit.version>
<!-- 插件版本 -->
<spotless.version>2.44.0</spotless.version>
<spotbugs.version>4.8.6.6</spotbugs.version>
<dependency-check.version>11.1.1</dependency-check.version>
<jacoco.version>0.8.12</jacoco.version>
</properties>
<dependencyManagement>
<dependencies>
<!-- ===== 内部模块 ===== -->
<dependency>
<groupId>com.example.tmpl</groupId>
<artifactId>tmpl-domain</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.example.tmpl</groupId>
<artifactId>tmpl-application</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.example.tmpl</groupId>
<artifactId>tmpl-infrastructure</artifactId>
<version>${project.version}</version>
</dependency>
<!-- ===== 第三方 ===== -->
<dependency>
<groupId>org.mapstruct</groupId>
<artifactId>mapstruct</artifactId>
<version>${mapstruct.version}</version>
</dependency>
<dependency>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-starter-webmvc-ui</artifactId>
<version>${springdoc.version}</version>
</dependency>
<dependency>
<groupId>com.tngtech.archunit</groupId>
<artifactId>archunit-junit5</artifactId>
<version>${archunit.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
</dependencyManagement>
<build>
<pluginManagement>
<plugins>
<!-- Compiler: Java 21 + MapStruct -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>21</source>
<target>21</target>
<annotationProcessorPaths>
<path>
<groupId>org.mapstruct</groupId>
<artifactId>mapstruct-processor</artifactId>
<version>${mapstruct.version}</version>
</path>
</annotationProcessorPaths>
<compilerArgs>
<arg>-Amapstruct.defaultComponentModel=spring</arg>
</compilerArgs>
</configuration>
</plugin>
<!-- Spotless: Google Java Format (AOSP 4空格) -->
<plugin>
<groupId>com.diffplug.spotless</groupId>
<artifactId>spotless-maven-plugin</artifactId>
<version>${spotless.version}</version>
<configuration>
<java>
<googleJavaFormat>
<version>1.25.2</version>
<style>AOSP</style>
</googleJavaFormat>
<removeUnusedImports/>
<importOrder>
<order>
java|javax|jakarta,org,com,com.example</order>
</importOrder>
</java>
</configuration>
</plugin>
<!-- JaCoCo -->
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>${jacoco.version}</version>
</plugin>
<!-- SpotBugs -->
<plugin>
<groupId>com.github.spotbugs</groupId>
<artifactId>spotbugs-maven-plugin</artifactId>
<version>${spotbugs.version}</version>
<configuration>
<effort>Max</effort>
<threshold>Medium</threshold>
<failOnError>true</failOnError>
</configuration>
</plugin>
<!-- OWASP Dependency Check -->
<plugin>
<groupId>org.owasp</groupId>
<artifactId>dependency-check-maven</artifactId>
<version>${dependency-check.version}</version>
<configuration>
<failBuildOnCVSS>7</failBuildOnCVSS>
<formats>
<format>HTML</format>
<format>JSON</format>
</formats>
</configuration>
</plugin>
</plugins>
</pluginManagement>
<!-- 所有模块默认启用 Spotless -->
<plugins>
<plugin>
<groupId>com.diffplug.spotless</groupId>
<artifactId>spotless-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>