init-dependencies.ps1 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. # ============================================
  2. # 快速初始化脚本 - PowerShell 版本
  3. # 预安装依赖模块到本地仓库
  4. # ============================================
  5. Write-Host "════════════════════════════════════════" -ForegroundColor Green
  6. Write-Host "预安装 shop-recycle-common 模块" -ForegroundColor Green
  7. Write-Host "════════════════════════════════════════" -ForegroundColor Green
  8. Write-Host ""
  9. # 获取脚本所在目录
  10. $scriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path
  11. Set-Location $scriptDir
  12. # 构建并安装 common 模块到本地 Maven 仓库
  13. Write-Host ">>> 构建 shop-recycle-common 模块..." -ForegroundColor Yellow
  14. mvn clean install -pl shop-recycle-common `
  15. -DskipTests `
  16. -B -q `
  17. -Dmaven.test.skip=true
  18. if ($LASTEXITCODE -ne 0) {
  19. Write-Host "❌ 构建失败!" -ForegroundColor Red
  20. exit 1
  21. }
  22. Write-Host ""
  23. Write-Host "════════════════════════════════════════" -ForegroundColor Green
  24. Write-Host "✅ 完成!common 模块已安装到本地仓库" -ForegroundColor Green
  25. Write-Host "════════════════════════════════════════" -ForegroundColor Green
  26. Write-Host ""
  27. Write-Host "本地仓库位置: ~/.m2/repository/com/shop/recycle/shop-recycle-common/"
  28. Write-Host ""
  29. Write-Host "现在可以使用优化版 Dockerfile 进行快速构建:"
  30. Write-Host ""
  31. Write-Host " # 使用缓存的优化版 Dockerfile" -ForegroundColor Cyan
  32. Write-Host " docker build -f shop-recycle-gateway/Dockerfile.optimized -t gateway:latest ." -ForegroundColor Cyan
  33. Write-Host ""
  34. Write-Host " # 或者使用快速构建脚本" -ForegroundColor Cyan
  35. Write-Host ' .\build-docker-optimized.ps1 gateway latest' -ForegroundColor Cyan
  36. Write-Host ""