Skip to content

Commit ece13b4

Browse files
committed
Enhance GitHub Actions workflow to support Maven wrapper and improve build steps
1 parent dba9ecc commit ece13b4

File tree

1 file changed

+25
-3
lines changed

1 file changed

+25
-3
lines changed

.github/workflows/build.yml

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,36 @@ jobs:
3232
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
3333
restore-keys: ${{ runner.os }}-m2
3434

35+
# Make Maven wrapper executable (if it exists)
36+
- name: Make Maven wrapper executable
37+
run: |
38+
if [ -f "./mvnw" ]; then
39+
chmod +x ./mvnw
40+
echo "Maven wrapper found and made executable"
41+
else
42+
echo "No Maven wrapper found, will use system Maven"
43+
fi
44+
45+
# Use Maven wrapper if available, otherwise use system Maven
3546
- name: Build with Maven
36-
run: mvn clean compile -DskipTests
47+
run: |
48+
if [ -f "./mvnw" ]; then
49+
./mvnw clean compile -DskipTests
50+
else
51+
mvn clean compile -DskipTests
52+
fi
3753
3854
- name: Run tests
39-
run: mvn test
55+
run: |
56+
if [ -f "./mvnw" ]; then
57+
./mvnw test
58+
else
59+
mvn test
60+
fi
4061
4162
- name: Submit Dependency Snapshot
4263
uses: advanced-security/maven-dependency-submission-action@v4
4364
with:
4465
settings-file: ''
45-
ignore-maven-wrapper: false
66+
ignore-maven-wrapper: true
67+
directory: ${{ github.workspace }}

0 commit comments

Comments
 (0)