# Script PowerShell pour démarrer Quarkus et tester Finance Workflow # À exécuter EN TANT QU'ADMINISTRATEUR # Clic droit → "Exécuter en tant qu'administrateur" Write-Host "============================================" -ForegroundColor Cyan Write-Host "Finance Workflow - Démarrage et Tests P0" -ForegroundColor Cyan Write-Host "============================================" -ForegroundColor Cyan Write-Host "" # Étape 1 : Arrêter tous les processus Java Write-Host "[1/5] Arrêt des processus Java existants..." -ForegroundColor Yellow try { $javaProcesses = Get-Process java -ErrorAction SilentlyContinue if ($javaProcesses) { $javaProcesses | Stop-Process -Force Write-Host " ✓ $($javaProcesses.Count) processus Java arrêtés" -ForegroundColor Green Start-Sleep -Seconds 2 } else { Write-Host " ✓ Aucun processus Java en cours" -ForegroundColor Green } } catch { Write-Host " ⚠ Erreur lors de l'arrêt des processus Java" -ForegroundColor Red Write-Host " → Utilisez le Gestionnaire des tâches pour tuer java.exe manuellement" -ForegroundColor Yellow Read-Host " Appuyez sur Entrée une fois les processus tués" } # Étape 2 : Vérifier que PostgreSQL est démarré Write-Host "" Write-Host "[2/5] Vérification PostgreSQL..." -ForegroundColor Yellow $postgresRunning = Get-Process postgres -ErrorAction SilentlyContinue if ($postgresRunning) { Write-Host " ✓ PostgreSQL est en cours d'exécution" -ForegroundColor Green } else { Write-Host " ⚠ PostgreSQL ne semble pas démarré" -ForegroundColor Red Write-Host " → Démarrez PostgreSQL ou le conteneur Docker" -ForegroundColor Yellow $continue = Read-Host " Continuer quand même ? (O/N)" if ($continue -ne "O") { Write-Host "Script arrêté." -ForegroundColor Red exit 1 } } # Étape 3 : Nettoyer et compiler Write-Host "" Write-Host "[3/5] Compilation du projet..." -ForegroundColor Yellow Write-Host " Commande: mvn clean compile" -ForegroundColor Gray Write-Host "" $compileResult = & mvn clean compile -DskipTests 2>&1 if ($LASTEXITCODE -eq 0) { Write-Host " ✓ Compilation réussie" -ForegroundColor Green } else { Write-Host " ✗ Échec de la compilation" -ForegroundColor Red Write-Host " Consultez les logs ci-dessus pour plus de détails" -ForegroundColor Yellow Read-Host "Appuyez sur Entrée pour quitter" exit 1 } # Étape 4 : Créer un fichier de log $timestamp = Get-Date -Format "yyyy-MM-dd_HH-mm-ss" $logFile = "quarkus-startup-$timestamp.log" Write-Host "" Write-Host "[4/5] Démarrage de Quarkus..." -ForegroundColor Yellow Write-Host " Port: 8085" -ForegroundColor Gray Write-Host " Logs: $logFile" -ForegroundColor Gray Write-Host "" Write-Host " ⏳ Patientez environ 30 secondes..." -ForegroundColor Yellow Write-Host "" Write-Host "============================================" -ForegroundColor Cyan Write-Host "SURVEILLEZ CES LIGNES DANS LES LOGS :" -ForegroundColor Cyan Write-Host "============================================" -ForegroundColor Cyan Write-Host " ✓ 'Flyway migrating schema to version 6'" -ForegroundColor Green Write-Host " ✓ 'Successfully applied 6 migrations'" -ForegroundColor Green Write-Host " ✓ 'started in X.XXXs. Listening on: http://0.0.0.0:8085'" -ForegroundColor Green Write-Host "" Write-Host "Démarrage en cours..." -ForegroundColor Yellow Write-Host "(Les logs s'afficheront ci-dessous)" -ForegroundColor Gray Write-Host "" # Démarrer Quarkus et capturer les logs # Note: Quarkus restera en cours d'exécution # Appuyez sur Ctrl+C pour arrêter & mvn quarkus:dev -D"quarkus.http.port=8085" | Tee-Object -FilePath $logFile Write-Host "" Write-Host "Quarkus arrêté." -ForegroundColor Yellow