BP-MAVEN-STEP is a versatile BuildPiper marketplace step designed to build, test, deploy, and analyze Java projects using Maven — with multi-JDK, multi-Maven, Node.js/NPM support, dynamic variable injection, and SonarQube integration.
git clone git@github.com:OT-BUILDPIPER-MARKETPLACE/BP-MAVEN-STEP.git
cd BP-MAVEN-STEPgit submodule init
git submodule update# Default Maven build
docker run -it --rm \
-v $PWD:/src \
-e WORKSPACE=/src \
-e CODEBASE_DIR=/ \
registry.buildpiper.in/maven-execute:latest
# Compile only
docker run -it --rm \
-v $PWD:/src \
-e WORKSPACE=/src \
-e CODEBASE_DIR=/ \
-e INSTRUCTION=compile \
registry.buildpiper.in/maven-execute:latest
# Custom JDK + Maven versions
docker run -it --rm \
-v $PWD:/src \
-e WORKSPACE=/src \
-e CODEBASE_DIR=/ \
-e JAVA_VERSION=11 \
-e MAVEN_VERSION=3.8.1 \
registry.buildpiper.in/maven-execute:latest| Variable | Description | Default |
|---|---|---|
WORKSPACE |
Workspace directory containing code | /bp/workspace |
CODEBASE_DIR |
Sub-directory within workspace | / |
JAVA_VERSION |
JDK version: 8, 11, 17, 21, 22, 23, 24 |
8 |
MAVEN_VERSION |
Maven version: 3.5.4, 3.6.3, 3.8.1, 3.9.9 |
3.6.3 |
INSTRUCTION |
Maven command or goal (e.g., clean install) |
package |
INSTRUCTION_TYPE |
BUILD, DEPLOY, TEST, CUSTOM, SONAR_SCAN |
BUILD |
SONAR_TESTING_TYPE |
Integration → adds -it, Unit → adds -ut, default → none |
(Optional) |
VALIDATION_FAILURE_ACTION |
WARNING or FAILURE |
WARNING |
ENABLE_CUSTOM_HTML_SCAN |
Parse custom HTML test reports | false |
TEST_FAILURE_THRESHOLD |
Failure threshold (%) | 50 |
TEST_RESULT_DIR |
Directory for test result files | / |
SOURCE_VARIABLE_REPO |
Git repo for dynamic variables (mavenrepos.json) |
(Optional) |
MAVEN_OPTIONS |
Additional Maven flags | (Optional) |
- Dynamically sets JDK and Maven.
- Auto-validates combinations and defaults to
JDK 8 + Maven 3.6.3.
-
If
SOURCE_VARIABLE_REPOis set:- Clones repo at branch =
$APPLICATION_NAME. - Extracts vars like
TO,CC,BCC,DNS_URL,TELEGRAM_CHAT_ID. - Auto-applies them to environment.
- Clones repo at branch =
-
Enabled via
INSTRUCTION_TYPE=SONAR_SCAN. -
Supports suffix-based project naming via
SONAR_TESTING_TYPE. -
Example:
Integration→project-itUnit→project-ut
-
Sonar tokens are masked in logs for security.
If INSTRUCTION is not manually set:
case "$INSTRUCTION_TYPE" in
BUILD) INSTRUCTION=$MAVEN_BUILD_INSTRUCTION ;;
DEPLOY) INSTRUCTION=$MAVEN_DEPLOY_INSTRUCTION ;;
TEST) INSTRUCTION=$MAVEN_TEST_INSTRUCTION ;;
CUSTOM) INSTRUCTION=$MAVEN_CUSTOM_INSTRUCTION ;;
SONAR_SCAN) INSTRUCTION=$MAVEN_SONAR_SCAN_INSTRUCTION ;;
esac- If
SOURCE_VARIABLE_REPOis missing, the script logs a warning and continues. - If invalid versions are supplied, the script reverts to safe defaults.
- All Maven commands are logged without exposing credentials.
JDK Releases:
Maven Releases:
Additional:
| Version | Date | Maintainer | Summary |
|---|---|---|---|
| 2.5.2.8 | 2025-10-08 | Mukul Joshi | ➕ Added SONAR_TESTING_TYPE for dynamic Sonar suffix (-it / -ut) 🧠 Enhanced instruction handling for SONAR_SCAN 🔒 Masked token from logs for Sonar command |
| 2.5.2.7 | 2025-10-01 | Mukul Joshi | 🆕 Added Java version support for 22, 23, 24 ✅ Full backward compatibility |
| 2.5.2.6 | 2025-09-15 | Mukul Joshi | 🧩 Introduced dynamic variable fetching from SOURCE_VARIABLE_REPO 📬 Integrated with mavenrepos.json parsing |
| 2.5.2.5 | 2025-09-05 | Mukul Joshi | ⚡ Introduced multi-Maven (3.5.4–3.9.9) and multi-JDK (8–21) support 🧱 Added image variant multi-jdk-21-3.9 |
| 2.5.2.4 | 2025-08-18 | Mukul Joshi | 🧹 Improved Maven instruction handling 🔄 Refactored variable extraction logic |
| 2.5.2.3 | 2025-08-05 | Mukul Joshi | 🪶 Added support for MAVEN_OPTIONS and VALIDATION_FAILURE_ACTION |
| 2.5.2.2 | 2025-07-28 | Mukul Joshi | 🧰 Initial version supporting multi-jdk-air and npm-support builds |
Author: Mukul Joshi Email: mukul.joshi@opstree.com GitHub: @mukulmj
