Maven/BitBucket Validation for Production Code Deployment
Introduction
The justification for this document is to express a way to secure company code and create a possible company standardization for the WAR naming convention that is easily tracked back to a BitBucket commit that was used to deploy an interface to UAT and Production.
By adding a validation step that all code is committed to BitBucket, we circumvent code being accidentally lost on a team member’s laptop.
Example
Example WAR: acsdal-dmdc-mdr-2.0.10.e02cee9.war
The last 7 digits (e02cee9) can be used to track back to BitBucket where the Production Code is, who committed it and when it was last updated.
It works by utilizing the buildnumber-maven-plugin and maven-scm-plugin.
What happens if you try to create a production war file without pushing your code back to BitBucket first?
Once you commit your code, it will allow a build.
POM Instructions
Modify your POM by updating and adding these code block fields.
<artifactId>your project</artifactId> |
<maven-war-plugin–version>3.2.1</maven-war-plugin–version> |
Below must be set to your project repository in Bitbucket:
<scm> |
Add dependency:
<dependency> |
Set up a Production Profile. The ${buildNumber} will be added to the end of your WAR file name and is created by the scm plugin.
Make sure to update <outputDirectory> to where you want your WAR file save.
<profile> |
Additional Links