From e4c31de3ee936a8db3233e34991b833d46c4df13 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E6=96=87=E8=81=AA?= Date: Fri, 5 Jun 2020 22:16:15 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BD=BF=E7=94=A8=E8=84=9A=E6=9C=AC=E6=9B=B4?= =?UTF-8?q?=E6=96=B0=E7=89=88=E6=9C=AC=E5=8F=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 5 +- growth-version.bat | 44 ++++++++++++++++ growth-version.sh | 50 +++++++++++++++++++ old-version.bat | 3 ++ .../osc-base-service-core/pom.xml | 4 +- .../osc-log-service-core/pom.xml | 4 +- 6 files changed, 107 insertions(+), 3 deletions(-) create mode 100644 growth-version.bat create mode 100755 growth-version.sh create mode 100644 old-version.bat diff --git a/.gitignore b/.gitignore index e78e002..8c911b1 100644 --- a/.gitignore +++ b/.gitignore @@ -38,4 +38,7 @@ logs/ **/mvnw.cmd **/.mvn -**/target \ No newline at end of file +**/target + +### bak ### +*.versionsBackup \ No newline at end of file diff --git a/growth-version.bat b/growth-version.bat new file mode 100644 index 0000000..879e3e9 --- /dev/null +++ b/growth-version.bat @@ -0,0 +1,44 @@ +@echo off + +REM ## 开始 +echo [INFO] ----------------------------- start -------------------------------------- + +REM ## 获取入参,版本号 +set new_versiont=%1% +REM ## 输出看一眼 +echo new_versiont: %new_versiont% + +REM ## 获取入参,是否需要备份(true | false) +set is_bak=%2% +REM ## 输出看一眼 +echo is_bak: %is_bak% + +REM ## 非空判断 +if defined new_versiont ( + REM ## 1. 更新 commons 工程版本号 + cd osc-commons/ + REM ## 获取当前工程的版本号 + REM for /f "delims=" %%i in ('..\old-version.bat') do set old_version=%%i + REM ## 输出看一眼 + REM echo old_version: %old_version% + REM ## 升级 + mvn versions:set -DoldVersion=* -DnewVersion=%new_versiont% -DgenerateBackupPoms=%is_bak% && mvn clean install + + REM ## 2. 更新 service 工程中的 commons 工程版本号 + cd ../osc-service/ + REM ## 获取当前工程的版本号 + REM for /f "delims=" %%i in ('..\old-version.bat') do set old_version=%%i + REM ## 输出看一眼 + REM echo old_version: %old_version% + REM ## 更新 + mvn versions:update-properties -DincludeProperties={osc.commons.version} -Dproperties=[%new_versiont%] -DgenerateBackupPoms=%is_bak% + + REM ## 3. 更新 service 工程版本号 + mvn versions:set -DoldVersion=* -DnewVersion=%new_versiont% -DgenerateBackupPoms=%is_bak% + + REM ## 结束 + echo [INFO] ----------------------------- end -------------------------------------- +) else ( + REM ## 结束 + echo [INFO] -------------------------- 缺少参数 ------------------------------------- +) diff --git a/growth-version.sh b/growth-version.sh new file mode 100755 index 0000000..99e32ce --- /dev/null +++ b/growth-version.sh @@ -0,0 +1,50 @@ +#!/bin/bash +## $() - 方法,${} - 变量 + +## 开始 +echo [INFO] ----------------------------- start -------------------------------------- + +## 获取入参,版本号 +new_versiont=$1 +## 输出看一眼 +echo new_versiont: ${new_versiont} + +## 获取入参,是否需要备份(true | false) +is_bak=$2 +## 输出看一眼 +echo is_bak: ${is_bak} + +## 非空判断 +if [ $new_versiont ]; +then + + ## 1. 更新 commons 工程版本号 + cd osc-commons/ + ## 获取当前工程的版本号 + ## old_version=$(mvn org.apache.maven.plugins:maven-help-plugin:3.2.0:evaluate -Dexpression=project.version -q -DforceStdout) + ## 输出看一眼 + ## echo old_version: ${old_version} + ## 升级 + mvn versions:set -DoldVersion=* -DnewVersion=${new_versiont} -DgenerateBackupPoms=${is_bak} && mvn clean install + + ## 2. 更新 service 工程中的 commons 工程版本号 + cd ../osc-service/ + ## 获取当前工程的版本号 + ## old_version=$(mvn org.apache.maven.plugins:maven-help-plugin:3.2.0:evaluate -Dexpression=project.version -q -DforceStdout) + ## 输出看一眼 + ## echo old_version: ${old_version} + ## 更新 + mvn versions:update-properties -DincludeProperties={osc.commons.version} -Dproperties=[${new_versiont}] -DgenerateBackupPoms=${is_bak} + + ## 3. 更新 service 工程版本号 + mvn versions:set -DoldVersion=* -DnewVersion=${new_versiont} -DgenerateBackupPoms=${is_bak} + + ## 结束 + echo [INFO] ----------------------------- end -------------------------------------- + +else + + ## 结束 + echo [INFO] -------------------------- 缺少参数 ------------------------------------- + +fi diff --git a/old-version.bat b/old-version.bat new file mode 100644 index 0000000..f32db13 --- /dev/null +++ b/old-version.bat @@ -0,0 +1,3 @@ +@echo off + +mvn org.apache.maven.plugins:maven-help-plugin:3.2.0:evaluate -Dexpression=project.version -q -DforceStdout diff --git a/osc-service/osc-base-service/osc-base-service-core/pom.xml b/osc-service/osc-base-service/osc-base-service-core/pom.xml index 6996144..6b14611 100644 --- a/osc-service/osc-base-service/osc-base-service-core/pom.xml +++ b/osc-service/osc-base-service/osc-base-service-core/pom.xml @@ -26,6 +26,8 @@ osc-base + + 1.4.3 @@ -34,7 +36,7 @@ com.zwc osc-commons - 1.4.3 + ${osc.commons.version} diff --git a/osc-service/osc-log-service/osc-log-service-core/pom.xml b/osc-service/osc-log-service/osc-log-service-core/pom.xml index c6b2c13..00941f3 100644 --- a/osc-service/osc-log-service/osc-log-service-core/pom.xml +++ b/osc-service/osc-log-service/osc-log-service-core/pom.xml @@ -26,6 +26,8 @@ osc-log + + 1.4.3 @@ -34,7 +36,7 @@ com.zwc osc-commons - 1.4.3 + ${osc.commons.version}