maven_command doesn't seem to be applied properly to the "Install Dependencies "step
Closed this issue · 1 comments
Orb Version
1.0.1
Describe the bug
When using the test
job a custom maven_command
doesn't seem to be applied to the "Install Dependencies" step, resulting in the step using mvn
, instead of whatever's specified in maven_command
. This causes issues if you're using Maven wrapper and trying to set maven_command = mvnw
.
To Reproduce
Here's a compiled config straight from the CircleCI web UI:
# Orb 'circleci/maven@1.0.1' resolved to 'circleci/maven@1.0.1'
version: 2
jobs:
maven/test:
docker:
- image: adoptopenjdk/openjdk11:jdk-11.0.8_10-alpine
steps:
- checkout
- run:
command: find . -name 'pom.xml' | sort | xargs cat > /tmp/maven_cache_seed
name: Generate Cache Checksum
working_directory: $CIRCLE_WORKING_DIRECTORY/
- restore_cache:
key: maven-{{ checksum "/tmp/maven_cache_seed" }}
- run:
command: |
if [ -n "" ]; then
set -- "$@" --settings ""
fi
mvn dependency:go-offline "$@"
name: Install Dependencies
working_directory: ''
- run:
command: |
if [ -n "" ]; then
set -- "$@" --settings ""
fi
mvnw -am -pl service/example verify "$@"
name: Run Tests
working_directory: ''
- save_cache:
key: maven-{{ checksum "/tmp/maven_cache_seed" }}
paths:
- ~/.m2
- store_test_results:
path: target/surefire-reports
workflows:
build_and_test:
jobs:
- maven/test
version: 2
# Original config.yml file:
# version: 2.1
#
# orbs:
# maven: \"circleci/maven@1.0.1\"
#
# executors:
# java-build-executor:
# docker:
# - image: \"adoptopenjdk/openjdk11:jdk-11.0.8_10-alpine\"
#
# workflows:
# build_and_test:
# jobs:
# - maven/test:
# executor: \"java-build-executor\"
# maven_command: \"mvnw\"
# command: \"-am -pl service/example verify\"
You can see the maven/test
job in the workflow specifies maven_command = mvnw
. However, the "Install Dependencies" step still uses mvn dependency:go-offline "$@"
. The "Run Tests" step appears to be correctly picking up the maven_command
value as it's showing mvnw -am -pl service/example verify "$@"
.
Expected behavior
When maven_command
is set to mvnw
there should be no instances where mvn
is used instead.
Additional context
N/A.
Excellent catch @rkennedy-mode - looking into this.