build: 新增 Maven deploy 配置

This commit is contained in:
2023-11-19 13:23:41 +08:00
parent 3796790db4
commit d970c5f673
5 changed files with 184 additions and 31 deletions

3
.gitignore vendored
View File

@@ -32,6 +32,9 @@ build/
### VS Code ### ### VS Code ###
.vscode/ .vscode/
# Maven ignore
.flattened-pom.xml
### Temp ### ### Temp ###
*.log *.log
*.logs *.logs

View File

@@ -52,6 +52,63 @@ ContiNew StarterContinue New Starter是一种特殊类型的 Spring Boot S
💬 如无加群意愿,欢迎在 <a href="https://github.com/Charles7c/continew-starter/discussions" target="_blank">Discussions</a> 中进行交流探讨~ 🍻 💬 如无加群意愿,欢迎在 <a href="https://github.com/Charles7c/continew-starter/discussions" target="_blank">Discussions</a> 中进行交流探讨~ 🍻
</details> </details>
## 快速使用
> **Note**
> 目前 ContiNew Starter 尚处于开发中,若要提前体验 Snapshot快照版本请按以下方法进行。如遇问题诚邀反馈。
1.在项目 pom.xml 中配置 Snapshot快照仓库地址
```xml
<repositories>
<repository>
<id>sonatype-nexus-snapshots</id>
<name>Sonatype Nexus Snapshots</name>
<url>https://s01.oss.sonatype.org/content/repositories/snapshots/</url>
</repository>
</repositories>
```
2.在项目 pom.xml 中锁定版本,替换 Spring Boot 父依赖/添加 ContiNew Starter 父依赖
```xml
<parent>
<groupId>top.charles7c.continew</groupId>
<artifactId>continew-starter</artifactId>
<version>1.0.0-SNAPSHOT</version>
</parent>
```
3.在项目 pom.xml 中引入所需模块依赖
```xml
<dependencies>
<!-- 核心模块 -->
<dependency>
<groupId>top.charles7c.continew</groupId>
<artifactId>continew-starter-core</artifactId>
</dependency>
</dependencies>
```
4.在 application.yml 中根据引入模块,添加所需配置
e.g. 跨域配置
```yaml
--- ### 跨域配置
cors:
enabled: true
# 配置允许跨域的域名
allowedOrigins: '*'
# 配置允许跨域的请求方式
allowedMethods: '*'
# 配置允许跨域的请求头
allowedHeaders: '*'
# 配置允许跨域的响应头
exposedHeaders: '*'
```
## 贡献代码 ## 贡献代码
### 分支说明 ### 分支说明

View File

@@ -3,6 +3,7 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 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"> 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> <modelVersion>4.0.0</modelVersion>
<parent> <parent>
<groupId>top.charles7c.continew</groupId> <groupId>top.charles7c.continew</groupId>
<artifactId>continew-starter</artifactId> <artifactId>continew-starter</artifactId>

View File

@@ -4,6 +4,13 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 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> <modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>3.1.5</version>
<relativePath/>
</parent>
<groupId>top.charles7c.continew</groupId> <groupId>top.charles7c.continew</groupId>
<artifactId>continew-starter-dependencies</artifactId> <artifactId>continew-starter-dependencies</artifactId>
<version>${revision}</version> <version>${revision}</version>
@@ -22,6 +29,15 @@
<properties> <properties>
<revision>1.0.0-SNAPSHOT</revision> <revision>1.0.0-SNAPSHOT</revision>
<hutool.version>5.8.23</hutool.version> <hutool.version>5.8.23</hutool.version>
<!-- 基础配置 -->
<java.version>17</java.version>
<resource.delimiter>@</resource.delimiter>
<maven.compiler.source>${java.version}</maven.compiler.source>
<maven.compiler.target>${java.version}</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<maven-gpg-plugin.version>3.1.0</maven-gpg-plugin.version>
<flatten-maven-plugin.version>1.5.0</flatten-maven-plugin.version>
</properties> </properties>
<dependencyManagement> <dependencyManagement>
@@ -37,7 +53,7 @@
<dependency> <dependency>
<groupId>top.charles7c.continew</groupId> <groupId>top.charles7c.continew</groupId>
<artifactId>continew-starter-core</artifactId> <artifactId>continew-starter-core</artifactId>
<version>${project.version}</version> <version>${revision}</version>
</dependency> </dependency>
</dependencies> </dependencies>
</dependencyManagement> </dependencyManagement>
@@ -65,4 +81,97 @@
<url>https://github.com/Bull-BCLS</url> <url>https://github.com/Bull-BCLS</url>
</developer> </developer>
</developers> </developers>
<scm>
<url>https://github.com/Charles7c/continew-starter</url>
<connection>scm:git:git@github.com:Charles7c/continew-starter.git</connection>
<developerConnection>scm:git:git@github.com:Charles7c/continew-starter.git</developerConnection>
</scm>
<profiles>
<profile>
<id>release</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>jar-no-fork</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>${maven-gpg-plugin.version}</version>
<executions>
<execution>
<phase>verify</phase>
<goals>
<goal>sign</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>flatten-maven-plugin</artifactId>
<version>${flatten-maven-plugin.version}</version>
<configuration>
<updatePomFile>true</updatePomFile>
<flattenMode>resolveCiFriendliesOnly</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>
</build>
<distributionManagement>
<repository>
<id>sonatype-nexus-staging</id>
<name>Nexus Release Repository</name>
<url>https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/</url>
</repository>
<snapshotRepository>
<id>sonatype-nexus-snapshots</id>
<name>Sonatype Nexus Snapshots</name>
<url>https://s01.oss.sonatype.org/content/repositories/snapshots/</url>
</snapshotRepository>
</distributionManagement>
</profile>
</profiles>
</project> </project>

43
pom.xml
View File

@@ -19,9 +19,14 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 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> <modelVersion>4.0.0</modelVersion>
<groupId>top.charles7c.continew</groupId> <parent>
<groupId>top.charles7c.continew</groupId>
<artifactId>continew-starter-dependencies</artifactId>
<version>${revision}</version>
<relativePath>continew-starter-dependencies/pom.xml</relativePath>
</parent>
<artifactId>continew-starter</artifactId> <artifactId>continew-starter</artifactId>
<version>${revision}</version>
<packaging>pom</packaging> <packaging>pom</packaging>
<name>${project.artifactId}</name> <name>${project.artifactId}</name>
@@ -45,37 +50,9 @@
</modules> </modules>
<properties> <properties>
<revision>1.0.0-SNAPSHOT</revision>
<spring-boot.version>3.1.5</spring-boot.version>
<spotless.version>2.30.0</spotless.version> <spotless.version>2.30.0</spotless.version>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties> </properties>
<dependencyManagement>
<dependencies>
<!-- Spring 依赖 -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-dependencies</artifactId>
<version>${spring-boot.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<!-- ContiNew Starter 依赖 -->
<dependency>
<groupId>top.charles7c.continew</groupId>
<artifactId>continew-starter-dependencies</artifactId>
<version>${project.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<build> <build>
<plugins> <plugins>
<!-- 代码等格式化插件 --> <!-- 代码等格式化插件 -->
@@ -126,4 +103,10 @@
<url>https://github.com/Bull-BCLS</url> <url>https://github.com/Bull-BCLS</url>
</developer> </developer>
</developers> </developers>
<scm>
<url>https://github.com/Charles7c/continew-starter</url>
<connection>scm:git:git@github.com:Charles7c/continew-starter.git</connection>
<developerConnection>scm:git:git@github.com:Charles7c/continew-starter.git</developerConnection>
</scm>
</project> </project>