| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 |
- # Build MES TuHan (projection welding) Windows exe
- # Requires: Maven + JDK 8+
- # Run: .\pack\build-exe.ps1
- $ErrorActionPreference = "Stop"
- $Root = Split-Path -Parent $PSScriptRoot
- if (-not (Test-Path (Join-Path $Root "pom.xml"))) {
- Write-Error "pom.xml not found. Run from HuHan project."
- }
- Set-Location $Root
- Write-Host "Project: $Root"
- Write-Host "Running: mvn -Pexe clean package"
- if (-not (Get-Command mvn -ErrorAction SilentlyContinue)) {
- Write-Error "mvn not found in PATH"
- }
- & mvn -Pexe clean package
- if ($LASTEXITCODE -ne 0) {
- Write-Error "Maven failed, exit=$LASTEXITCODE"
- }
- $dist = Join-Path $Root "pack\dist"
- New-Item -ItemType Directory -Path $dist -Force | Out-Null
- $exe = Join-Path $dist "tuhan-client.exe"
- if (-not (Test-Path $exe)) {
- Write-Error "exe not found: $exe"
- }
- $cfgDir = Join-Path $dist "config"
- New-Item -ItemType Directory -Path $cfgDir -Force | Out-Null
- $ymlSrc = Join-Path $Root "src\main\resources\config\application.yml"
- $ymlDst = Join-Path $cfgDir "application.yml"
- if (Test-Path $ymlSrc) {
- Copy-Item $ymlSrc $ymlDst -Force
- }
- $readmePath = Join-Path $dist "README.txt"
- @(
- "MES TuHan Client"
- ""
- "1. Install Java 8+ (JRE/JDK). Check: java -version"
- "2. Double-click tuhan-client.exe"
- "3. Edit config\application.yml for server-ip / station / COM port"
- " Exe already loads optional:./config/ next to the exe."
- ""
- "Output: $exe"
- ) | Set-Content -Path $readmePath -Encoding ASCII
- Write-Host ""
- Write-Host "OK: $exe"
- Write-Host "Config sample: $ymlDst"
- Write-Host "Readme: $readmePath"
|