一、修改API的pom文件
pom.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 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<!-- <parent>
<groupId>com.suzao.center.user-center</groupId>
<artifactId>user-center</artifactId>
<version>1.0.0-SNAPSHOT</version>
</parent>-->
<!--自己的项目-->
<groupId>com.suzao.center.user-center</groupId>
<artifactId>user-center-api</artifactId>
<name>user-center-api-${project.version}</name>
<version>1.0.2-SNAPSHOT</version>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
<springboot.version>2.3.6.RELEASE</springboot.version>
<!-- juliye -->
<suzao-commons.version>1.0.4</suzao-commons.version>
<suzao-utils.version>1.0.1</suzao-utils.version>
<suzao-validator.version>1.1.0</suzao-validator.version>
<!-- plugin version -->
<maven-surefire-plugin.version>2.22.2</maven-surefire-plugin.version>
<maven-compiler-plugin.version>3.8.1</maven-compiler-plugin.version>
<maven-resources-plugin.version>3.2.0</maven-resources-plugin.version>
<maven-javadoc-plugin.version>3.2.0</maven-javadoc-plugin.version>
<maven-release-plugin.version>2.5.3</maven-release-plugin.version>
<maven-deploy-plugin.version>2.8.2</maven-deploy-plugin.version>
<maven-source-plugin.version>3.2.1</maven-source-plugin.version>
<maven-enforcer-plugin.version>1.4.1</maven-enforcer-plugin.version>
<wagon-ssh.version>3.4.2</wagon-ssh.version>
<msgpack.version>0.6.11</msgpack.version>
</properties>
<dependencies>
<dependency>
<groupId>com.suzao.utils</groupId>
<artifactId>suzao-utils</artifactId>
<version>${suzao-utils.version}</version>
</dependency>
<dependency>
<groupId>com.suzao.component</groupId>
<artifactId>validator-component</artifactId>
<version>${suzao-validator.version}</version>
<exclusions>
<exclusion>
<groupId>org.glassfish.web</groupId>
<artifactId>el-impl</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
<distributionManagement>
<repository>
<id>releases</id>
<name>Internal Releases</name>
<url>https://nexus.suzao.com/repository/maven-releases</url>
</repository>
<snapshotRepository>
<id>snapshots</id>
<name>Internal Snapshots</name>
<url>https://nexus.suzao.com/repository/maven-snapshots</url>
</snapshotRepository>
</distributionManagement>
<!--自己的项目-->
<scm>
<connection>scm:git:git@gitlab.suzao.com:server/user-center.git</connection>
<developerConnection>scm:git:git@gitlab.suzao.com:server/user-center.git</developerConnection>
<tag>HEAD</tag>
</scm>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>${springboot.version}</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>${maven-surefire-plugin.version}</version>
<configuration>
<testFailureIgnore>true</testFailureIgnore>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>${maven-compiler-plugin.version}</version>
<configuration>
<target>${java.version}</target>
<source>${java.version}</source>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>${maven-resources-plugin.version}</version>
<configuration>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>${maven-javadoc-plugin.version}</version>
<configuration>
<!-- <aggregate>true</aggregate>-->
<encoding>UTF-8</encoding>
<charset>UTF-8</charset>
<docencoding>UTF-8</docencoding>
</configuration>
<executions>
<execution>
<id>attach-javadocs</id>
<phase>package</phase>
<goals>
<goal>jar</goal>
</goals>
<configuration>
<doclint>none</doclint>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<version>${maven-release-plugin.version}</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<version>${maven-deploy-plugin.version}</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>${maven-source-plugin.version}</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<version>${maven-enforcer-plugin.version}</version>
<executions>
<execution>
<id>enforce-versions</id>
<goals>
<goal>enforce</goal>
</goals>
<configuration>
<rules>
<requireMavenVersion>
<version>3.3</version>
</requireMavenVersion>
<requireJavaVersion>
<version>${java.version}</version>
</requireJavaVersion>
</rules>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
<extensions>
<extension>
<groupId>org.apache.maven.wagon</groupId>
<artifactId>wagon-ssh</artifactId>
<version>${wagon-ssh.version}</version>
</extension>
</extensions>
</build>
</project>
替换的位置:
image.png
二、配置完成后执行下面指令
- mvn release:prepare
- mvn release:rollback(不回滚不需要执行)
- mvn release:perform
prepare命令做了哪些操作:
- 检查项目是否有未提交的代码。
- 检查项目是否有快照版本依赖。
- 根据用户的输入将快照版本升级为发布版。
- 将POM中的SCM信息更新为标签地址。
- 基于修改后的POM执行Maven构建。
- 提交POM变更。
- 基于用户输入为代码打标签。
- 将代码从发布版升级为新的快照版。
- 提交POM变更。
perform命令做了哪些操作:
- 生成doc文档
- 删除release.properties等发布过程文件
- 迁出release:prepare生成的标签中的源代码,并在此基础上执行mvn deploy命令打包并部署构件至仓库。
网友评论