What is the best approach to have my maven package-deploy project write to a properties file inside of a WAR file?
I currently have three separate maven projects that create their own packages:
a.war, b.zip, and c.tar.gz
Inside of the WAR file (a.war), there is a properties file that contains the following:
buildDate=2018-01-25 16:11:49 PST
aUiNumber=2.1.0-SNAPSHOT.5
buildNumber=2.1.0-SNAPSHOT.${deploy.number}
The file is located here (inside of the WAR file):
WEB-INF/classes/a-version.properties
On a Jenkins server, I have a job that uses maven to do the following:
- Pull the latest a.war, b.zip, c.tar.gz from nexus
- Package these into app-assets.zip
- Deploy app-assets.zip
I would like to have this maven job populate the ${deploy.number}
in the a-version.properties file with the Jenkins job number. What is the best approach for this? Is there a way to do it without unpacking the WAR file?
I attempted this by adding the a.war/WEB-INF/classes
to the <directory>
section of the war file. As expected, the build did not fail; however, it did not populate the variable as well:
mvn -U -f ./PackageDeployPom.xml resources:resources -Ddeploy.number=${BUILD_NUMBER}
[INFO] skip non existing resourceDirectory /home/jenkins/app-assets/apache-tomcat-8.0.41/webapps/a.war/WEB-INF/classes