https://github.com/crowdcode-de/maven-bgav-plugin
https://github.com/crowdcode-de/maven-bgav-plugin
Last synced: 11 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/crowdcode-de/maven-bgav-plugin
- Owner: crowdcode-de
- Created: 2019-09-25T08:11:28.000Z (over 6 years ago)
- Default Branch: develop
- Last Pushed: 2023-09-18T19:20:57.000Z (over 2 years ago)
- Last Synced: 2024-04-16T11:05:51.856Z (about 2 years ago)
- Language: Java
- Size: 190 KB
- Stars: 3
- Watchers: 6
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Maven BGAV Plugin
## Overview
Maven plugin for adding ticket id to POM Version, if Git branch is feature, bugfix or hotfix
## Requirements
JDK 8+
## Installation
For local build you have to add the Maven BGAV Plugin to your project POM.
If you want to use with Jenkins, just add it your Jenkinsfile, tested on Jenkins with multi pipelines.
*Note:* Jenkins Git plugin checks out with the last commit id, make sure Jenkins is using this command: git checkout ${env.BRANCH_NAME}
### for local build
```java
io.crowdcode
bgav-maven-plugin
1.2.0
compile
bgav
(\p{Upper}{1,}-\d{1,})
gituser
gitpassword
your.groupid.namespace
```
### for Jenkins
```java
pipeline {
agent { label 'jenkins-jdk11' }
stages {
stage('checkout') {
steps {
echo 'Pulling...' + env.BRANCH_NAME
checkout scm
}
}
stage('Prepare') {
steps {
withCredentials(
[usernamePassword(credentialsId: 'crowdcodeBitbucket',
usernameVariable: 'gitUser',
passwordVariable: 'gitPwd'
)]) {
sh "git status"
sh "git checkout ${env.BRANCH_NAME}"
mvn("-DfailOnAlteredPom=false -DbranchName=${env.BRANCH_NAME} -Dgituser=${gituser} -D=gitpassword=${gitPwd} io.crowdcode:bgav-maven-plugin:1.2.0:bgav")
}
}
}
stage('Build') {
steps { mvn("clean install -DskipTests=true") }
}
stage('Unit tests') {
steps { mvn("test -P-checks,test-coverage -Dskip.unit.tests=false -Dskip.integration.tests=true") }
}
stage('Integration tests') {
steps { mvn("verify -P-checks,test-coverage -Dskip.unit.tests=true -Dskip.integration.tests=false") }
}
stage('Deploy') {
steps { mvn("deploy -P-checks -DskipTests=true ") }
}
}
}
def mvn(param) {
withMaven(
mavenOpts: '-Xmx1536m -Xms512m',
mavenSettingsConfig: 'crowdcode-maven-settings',
maven: 'maven-3.6.0') {
sh "mvn -U -B -e ${param}"
}
}
```
## Usage
mvn -Dgituser=xxxx -D=gitpassword=yyyy io.crowdcode:bgav-maven-plugin:bgav
## Parameters
- gituser, Git user
- gitpassword, Git password
- regex_ticket, RegEx for getting the ticket id
- regex_branch, RegEx for getting the branch
- (DEPRECATED) failOnMissingBranchId, flag for fail on Jenkins if missing branch id, default true, set for Jenkins build to false, -DfailOnMissingBranchId=false
- failOnAlteredPom, flag to fail the build if the pom has been modified, commited and pushed by the plugin
- branchName, for setting branch name in Jenkins
- namespace, a list of groupIds which shall be regarded when the plugin is walking through the dependencies. Normally this
should be the groupIds of your own modules, e.g. com.yourcompany
- pomFile - if your target pom is not pom.xml, you can override the pom.xml filename
- suppressCommit - with suppress a commit after modifying the pom (only useful on development)
- suppressCommit - with suppress a commit after modifying the pom (only useful on development)
- suppressPush - do not push the changes. This can be useful, if the push is handled by the caller (e.g. Jenkinsfile)
## Author
Andreas Ernst, andreas.ernst@crowdcode.io
Marcus Nörder-Tuitje, marcus.noerder-tuitje@crowdcode.io