# ============================================ # 快速初始化脚本 - PowerShell 版本 # 预安装依赖模块到本地仓库 # ============================================ Write-Host "════════════════════════════════════════" -ForegroundColor Green Write-Host "预安装 shop-recycle-common 模块" -ForegroundColor Green Write-Host "════════════════════════════════════════" -ForegroundColor Green Write-Host "" # 获取脚本所在目录 $scriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path Set-Location $scriptDir # 构建并安装 common 模块到本地 Maven 仓库 Write-Host ">>> 构建 shop-recycle-common 模块..." -ForegroundColor Yellow mvn clean install -pl shop-recycle-common ` -DskipTests ` -B -q ` -Dmaven.test.skip=true if ($LASTEXITCODE -ne 0) { Write-Host "❌ 构建失败!" -ForegroundColor Red exit 1 } Write-Host "" Write-Host "════════════════════════════════════════" -ForegroundColor Green Write-Host "✅ 完成!common 模块已安装到本地仓库" -ForegroundColor Green Write-Host "════════════════════════════════════════" -ForegroundColor Green Write-Host "" Write-Host "本地仓库位置: ~/.m2/repository/com/shop/recycle/shop-recycle-common/" Write-Host "" Write-Host "现在可以使用优化版 Dockerfile 进行快速构建:" Write-Host "" Write-Host " # 使用缓存的优化版 Dockerfile" -ForegroundColor Cyan Write-Host " docker build -f shop-recycle-gateway/Dockerfile.optimized -t gateway:latest ." -ForegroundColor Cyan Write-Host "" Write-Host " # 或者使用快速构建脚本" -ForegroundColor Cyan Write-Host ' .\build-docker-optimized.ps1 gateway latest' -ForegroundColor Cyan Write-Host ""