diff --git a/README.md b/README.md index 63512e05fe0564a7c0a992bb270418d9bf09bad4..bffa72d0f5d076391790e83124050ab7826a68c0 100644 --- a/README.md +++ b/README.md @@ -22,6 +22,7 @@ The Maven template uses some global configuration used throughout all jobs. | Name | description | default value | | --------------------- | -------------------------------------- | ----------------- | | `MAVEN_IMAGE` | The Docker image used to run Maven <br/>:warning: **set the version required by your project** | `maven:latest` | +| AVEN_PROJECT_DIR` | Maven projet root directory | `.` | | `MAVEN_CFG_DIR` | The Maven configuration directory | `.m2` | | `MAVEN_OPTS` | [Global Maven options](http://maven.apache.org/configure.html#maven_opts-environment-variable) | `-Dhttps.protocols=TLSv1.2 -Dmaven.repo.local=${MAVEN_CFG_DIR}/repository -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=WARN -Dorg.slf4j.simpleLogger.showDateTime=true -Djava.awt.headless=true` | | `MAVEN_CLI_OPTS` | Additional [Maven options](https://maven.apache.org/ref/3-LATEST/maven-embedder/cli.html) used on the command line | `--batch-mode --errors --fail-at-end --show-version -DinstallAtEnd=true -DdeployAtEnd=true` | diff --git a/kicker.json b/kicker.json index 724dfba268f37006cb480cc35f7cf65d4265e91c..cc9e493494a18ea45787ba598530d87bd7060d17 100644 --- a/kicker.json +++ b/kicker.json @@ -9,6 +9,12 @@ "description": "The Docker image used to run Maven - **set the version required by your project**", "default": "maven:latest" }, + { + "name": "MAVEN_PROJECT_DIR", + "description": "Maven project root directory", + "default": ".", + "advanced": true + }, { "name": "MAVEN_CFG_DIR", "description": "The Maven configuration directory", diff --git a/templates/gitlab-ci-maven.yml b/templates/gitlab-ci-maven.yml index 76d1cb21be259df4eb698f39caccd8f4d9d45d3c..8f7c409a588cee9ed5a26bf36351b225d9296016 100644 --- a/templates/gitlab-ci-maven.yml +++ b/templates/gitlab-ci-maven.yml @@ -14,6 +14,9 @@ # Floor, Boston, MA 02110-1301, USA. # ========================================================================================= variables: + # Default Maven project root directory + MAVEN_PROJECT_DIR: . + # Maven image (can be overridden) MAVEN_IMAGE: "maven:latest" @@ -450,6 +453,7 @@ stages: - install_ca_certs "${CUSTOM_CA_CERTS:-$DEFAULT_CA_CERTS}" - eval_java_proxy_args - eval_mvn_settings_opt + - cd ${MAVEN_PROJECT_DIR} # Cache downloaded dependencies and plugins between builds. # To keep cache across branches add 'key: "$CI_JOB_NAME"' cache: @@ -472,9 +476,9 @@ mvn-build: when: always reports: junit: - - "**/target/*-reports/TEST-*.xml" + - "${MAVEN_PROJECT_DIR}/**/target/*-reports/TEST-*.xml" paths: - - "**/target" + - "${MAVEN_PROJECT_DIR}/**/target" rules: # exclude merge requests - if: '$CI_MERGE_REQUEST_ID == null' @@ -533,7 +537,7 @@ mvn-dependency-check: expire_in: 1 day when: always paths: - - "**/target/dependency-check-report.*" + - "${MAVEN_PROJECT_DIR}/**/target/dependency-check-report.*" mvn-forbid-snapshot-dependencies: extends: .mvn-base