fix: Resolve mvn command not found error in CI workflow

- Replace 'mvn' commands with './mvnw' in CI workflow
- Add chmod +x ./mvnw step to make Maven wrapper executable
- Add cache: maven to Java setup step for better caching
- Update troubleshooting scripts to use correct port 40047
- Update documentation to reflect port change

This fixes the 'mvn: command not found' error by ensuring
all Maven commands use the Maven wrapper (mvnw) which is
included in the project and doesn't require Maven to be
pre-installed on the runner.
This commit is contained in:
GSRN
2025-09-15 17:16:13 +02:00
parent e787aa64a3
commit 8c9ffb50ce
4 changed files with 15 additions and 11 deletions

View File

@@ -27,6 +27,10 @@ jobs:
with: with:
java-version: '17' java-version: '17'
distribution: 'temurin' distribution: 'temurin'
cache: maven
- name: Make Maven wrapper executable
run: chmod +x ./mvnw
- name: Cache Maven dependencies - name: Cache Maven dependencies
uses: actions/cache@v4 uses: actions/cache@v4
@@ -37,13 +41,13 @@ jobs:
fail-on-cache-miss: false fail-on-cache-miss: false
- name: Run tests - name: Run tests
run: mvn test run: ./mvnw test
- name: Run code quality checks - name: Run code quality checks
run: mvn spotbugs:check checkstyle:check run: ./mvnw spotbugs:check checkstyle:check
- name: Build application - name: Build application
run: mvn clean package -DskipTests run: ./mvnw clean package -DskipTests
- name: Build Docker image (test only) - name: Build Docker image (test only)
run: docker build -t api-gateway:test . run: docker build -t api-gateway:test .

View File

@@ -33,7 +33,7 @@ This ensures that cache failures don't cause the entire pipeline to fail.
Updated all existing runner configuration files with: Updated all existing runner configuration files with:
- **Auto-detect Host**: Empty host field (allows act_runner to auto-detect the correct IP) - **Auto-detect Host**: Empty host field (allows act_runner to auto-detect the correct IP)
- **Fixed Port**: `44029` (instead of random port 0) - **Fixed Port**: `40047` (instead of random port 0)
- **Host Network**: Uses host networking for better connectivity - **Host Network**: Uses host networking for better connectivity
Updated files: Updated files:
@@ -92,7 +92,7 @@ Update your runner configuration with these key changes:
cache: cache:
enabled: true enabled: true
host: "" # Auto-detect host IP host: "" # Auto-detect host IP
port: 44029 # Fixed port port: 40047 # Fixed port
container: container:
network: "host" # Use host networking network: "host" # Use host networking

View File

@@ -109,8 +109,8 @@ function Fix-CacheIssues {
$hostIP = Get-HostIP $hostIP = Get-HostIP
# Set proper environment variables # Set proper environment variables
$env:ACTIONS_CACHE_URL = "http://${hostIP}:44029/" $env:ACTIONS_CACHE_URL = "http://${hostIP}:40047/"
$env:ACTIONS_RUNTIME_URL = "http://${hostIP}:44029/" $env:ACTIONS_RUNTIME_URL = "http://${hostIP}:40047/"
Write-Host "✅ Cache directory created and configured" -ForegroundColor Green Write-Host "✅ Cache directory created and configured" -ForegroundColor Green
Write-Host "✅ Environment variables set with host IP: $hostIP" -ForegroundColor Green Write-Host "✅ Environment variables set with host IP: $hostIP" -ForegroundColor Green
@@ -163,7 +163,7 @@ function Test-CacheFunctionality {
# Try to test cache service (this will fail but we can check the error) # Try to test cache service (this will fail but we can check the error)
Write-Host " Testing cache service response..." -ForegroundColor Gray Write-Host " Testing cache service response..." -ForegroundColor Gray
try { try {
$response = Invoke-WebRequest -Uri "http://host.docker.internal:44029/cache/$testKey" -TimeoutSec 5 -ErrorAction SilentlyContinue $response = Invoke-WebRequest -Uri "http://${hostIP}:40047/cache/$testKey" -TimeoutSec 5 -ErrorAction SilentlyContinue
Write-Host "✅ Cache service responding" -ForegroundColor Green Write-Host "✅ Cache service responding" -ForegroundColor Green
} catch { } catch {
Write-Host "❌ Cache service not responding: $($_.Exception.Message)" -ForegroundColor Yellow Write-Host "❌ Cache service not responding: $($_.Exception.Message)" -ForegroundColor Yellow

View File

@@ -104,8 +104,8 @@ fix_cache_issues() {
HOST_IP=$(detect_host_ip) HOST_IP=$(detect_host_ip)
# Set proper environment variables # Set proper environment variables
export ACTIONS_CACHE_URL="http://${HOST_IP}:44029/" export ACTIONS_CACHE_URL="http://${HOST_IP}:40047/"
export ACTIONS_RUNTIME_URL="http://${HOST_IP}:44029/" export ACTIONS_RUNTIME_URL="http://${HOST_IP}:40047/"
echo "✅ Cache directory created and configured" echo "✅ Cache directory created and configured"
echo "✅ Environment variables set with host IP: $HOST_IP" echo "✅ Environment variables set with host IP: $HOST_IP"
@@ -154,7 +154,7 @@ test_cache() {
# Try to restore (this will fail but we can check the error) # Try to restore (this will fail but we can check the error)
echo " Testing cache restore..." echo " Testing cache restore..."
if curl -s "http://host.docker.internal:44029/cache/$TEST_KEY" > /dev/null 2>&1; then if curl -s "http://${HOST_IP}:40047/cache/$TEST_KEY" > /dev/null 2>&1; then
echo "✅ Cache service responding" echo "✅ Cache service responding"
else else
echo "❌ Cache service not responding" echo "❌ Cache service not responding"