mirror of
https://github.com/hpd840321/starRiverProperty.git
synced 2026-06-09 16:30:29 +08:00
418c7db202
- davinci-manager-storage:FilePart 路径与基址按 V1 JAR(/portal/file、/part/*、GET /download) - 启动类:扫描 cn.cloudwalk.serial 与 cn.cloudwalk.cwos.client.resource,补 UUIDSerial 与 ApplicationService - deploy:v1/v2 application 中 cloudwalk.serial.enabled、Kafka 指向 192.168.3.12:9092;deploy/.gitignore 忽略日志 - cloudwalk-common-serial:补充 META-INF/spring.factories(Boot 自动配置) - 电梯:Session 配置、Davinci Bean、Feign 包、MQTT/Visitor/Zone Feign;部署脚本与 API parity 工具更新 - 文档与根脚本若干;未纳入大体积 jar/zip 与 v1 CFR 对比目录 Made-with: Cursor Former-commit-id: b76d142d13ebb5c0898de2d9d11bc583876829c2
116 lines
4.3 KiB
Bash
Executable File
116 lines
4.3 KiB
Bash
Executable File
#!/usr/bin/env bash
|
||
# 将 cw_lib 中的 intelligent-cwoscomponent(父 POM 桩 + interface + rest)部署到 Nexus
|
||
# 与 docs/operations/deploy_cw_elevator_v1_lib_to_nexus.py 使用同一 server id / 仓库 URL 约定。
|
||
#
|
||
# 需要 ~/.m2/settings.xml 中配置 server id:nexus-releases(密码等)。
|
||
#
|
||
# 环境变量(可选):
|
||
# NEXUS_RELEASES_URL 默认 http://192.168.3.12:8081/repository/maven-releases/
|
||
# NEXUS_RELEASES_ID 默认 nexus-releases
|
||
# ELEVATOR_CW_LIB_DIR 默认 反编译根下 cw-elevator-application-V1.0.0.20211103/cw_lib
|
||
# ELEVATOR_ICOMP_VER 默认 2.9.2-xinghewan
|
||
# DRY_RUN=1 仅打印命令
|
||
# ELEVATOR_INSTALL_LOCAL_M2=1(默认)部署后再把 cw_lib 安装到 ~/.m2(与 build_nexus_only
|
||
# 一致;因私服上子 POM 缺版本段时 dependency:get 可能无效模型,本地以桩父 POM+install-file 为准)
|
||
# ELEVATOR_INSTALL_LOCAL_M2=0 跳过本机安装
|
||
set -euo pipefail
|
||
|
||
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
||
REPO_ROOT="$(cd "$SCRIPT_DIR/../.." && pwd)"
|
||
REPO_ROOT="${ELEVATOR_REPO_ROOT_OVERRIDE:-$REPO_ROOT}"
|
||
|
||
NEXUS_RELEASES_URL="${NEXUS_RELEASES_URL:-http://192.168.3.12:8081/repository/maven-releases/}"
|
||
NEXUS_RELEASES_ID="${NEXUS_RELEASES_ID:-nexus-releases}"
|
||
ICOMP_VER="${ELEVATOR_ICOMP_VER:-2.9.2-xinghewan}"
|
||
CW_LIB="${ELEVATOR_CW_LIB_DIR:-$REPO_ROOT/cw-elevator-application-V1.0.0.20211103/cw_lib}"
|
||
PARENT_STUB="$SCRIPT_DIR/legacy-poms/intelligent-cwoscomponent-2.9.2-xinghewan-parent.pom"
|
||
|
||
die() { echo "ERROR: $*" >&2; exit 1; }
|
||
|
||
[[ -f "$PARENT_STUB" ]] || die "缺少父 POM 桩: $PARENT_STUB"
|
||
[[ -d "$CW_LIB" ]] || die "cw_lib 目录不存在: $CW_LIB"
|
||
|
||
IJ="$CW_LIB/intelligent-cwoscomponent-interface-${ICOMP_VER}.jar"
|
||
IP="$CW_LIB/intelligent-cwoscomponent-interface-${ICOMP_VER}.pom"
|
||
RJ="$CW_LIB/intelligent-cwoscomponent-rest-${ICOMP_VER}.jar"
|
||
RP="$CW_LIB/intelligent-cwoscomponent-rest-${ICOMP_VER}.pom"
|
||
|
||
for f in "$IJ" "$IP" "$RJ" "$RP"; do
|
||
[[ -f "$f" ]] || die "缺少文件: $f"
|
||
done
|
||
|
||
# 在无 reactor pom 的目录执行 deploy:deploy-file,避免误挂到 cw-elevator-application-reactor。
|
||
# Release 仓库已存在同版本时 Nexus 返回 400 cannot be updated — 视为已发布,跳过。
|
||
deploy_file_or_skip() {
|
||
local label="$1"
|
||
shift
|
||
if [[ "${DRY_RUN:-}" == "1" ]]; then
|
||
echo "DRY-RUN [$label]:" "$@"
|
||
return 0
|
||
fi
|
||
local out rc
|
||
set +e
|
||
out="$(cd "$CW_LIB" && mvn -B -q deploy:deploy-file "$@" 2>&1)"
|
||
rc=$?
|
||
set -e
|
||
if [[ "$rc" -eq 0 ]]; then
|
||
echo "OK [$label]"
|
||
return 0
|
||
fi
|
||
if echo "$out" | grep -qE 'cannot be updated|status code: 400'; then
|
||
echo "SKIP [$label](Nexus 已存在该 release 坐标,不可覆盖)"
|
||
return 0
|
||
fi
|
||
echo "$out" >&2
|
||
return "$rc"
|
||
}
|
||
|
||
echo "==> Nexus releases: $NEXUS_RELEASES_URL (id=$NEXUS_RELEASES_ID)"
|
||
echo "==> cw_lib: $CW_LIB"
|
||
|
||
echo "==> [1/3] deploy 父 POM cn.cloudwalk.intelligent:intelligent-cwoscomponent:${ICOMP_VER}"
|
||
deploy_file_or_skip "parent pom" \
|
||
-DrepositoryId="$NEXUS_RELEASES_ID" \
|
||
-Durl="$NEXUS_RELEASES_URL" \
|
||
-Dfile="$PARENT_STUB" \
|
||
-DpomFile="$PARENT_STUB" \
|
||
-DgroupId=cn.cloudwalk.intelligent \
|
||
-DartifactId=intelligent-cwoscomponent \
|
||
-Dversion="$ICOMP_VER" \
|
||
-Dpackaging=pom
|
||
|
||
echo "==> [2/3] deploy intelligent-cwoscomponent-interface"
|
||
deploy_file_or_skip "interface" \
|
||
-DrepositoryId="$NEXUS_RELEASES_ID" \
|
||
-Durl="$NEXUS_RELEASES_URL" \
|
||
-Dfile="$IJ" \
|
||
-DpomFile="$IP" \
|
||
-Dpackaging=jar
|
||
|
||
echo "==> [3/3] deploy intelligent-cwoscomponent-rest"
|
||
deploy_file_or_skip "rest" \
|
||
-DrepositoryId="$NEXUS_RELEASES_ID" \
|
||
-Durl="$NEXUS_RELEASES_URL" \
|
||
-Dfile="$RJ" \
|
||
-DpomFile="$RP" \
|
||
-Dpackaging=jar
|
||
|
||
if [[ "${DRY_RUN:-}" == "1" ]]; then
|
||
echo "DRY-RUN 结束。"
|
||
exit 0
|
||
fi
|
||
|
||
if [[ "${ELEVATOR_INSTALL_LOCAL_M2:-1}" == "1" ]]; then
|
||
echo "==> 本机 ~/.m2:父 POM 桩 + install-file(与 build_nexus_only 闭包一致)"
|
||
mvn -B -q -N -f "$PARENT_STUB" install -DskipTests
|
||
mvn -B -q org.apache.maven.plugins:maven-install-plugin:3.1.1:install-file \
|
||
-DpomFile="$IP" -Dfile="$IJ" -Dpackaging=jar
|
||
mvn -B -q org.apache.maven.plugins:maven-install-plugin:3.1.1:install-file \
|
||
-DpomFile="$RP" -Dfile="$RJ" -Dpackaging=jar
|
||
else
|
||
echo "==> 跳过本机 ~/.m2(ELEVATOR_INSTALL_LOCAL_M2=0)"
|
||
fi
|
||
|
||
echo "完成。"
|
||
echo " ~/.m2: ls \"\$HOME/.m2/repository/cn/cloudwalk/intelligent/intelligent-cwoscomponent-rest/$ICOMP_VER/\""
|