Hi everyone, I have a POM file that looks like this:
<span><?xml version="1.0" encoding="UTF-8"?></span> <span><project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"></span> <span><modelVersion></span>4.0.0<span></modelVersion></span> <span><groupId></span>com.company.jira.plugin<span></groupId></span> <span><artifactId></span>security-service<span></artifactId></span> <span><version></span> ${POM_JIRAVERSION}-${BUILD_NUMBER}-SNAPSHOT<span></version></span>
I've got an HTML UI where I want to display my POM version number, my version number is dynamic as you can see and changes with every build I make on Jenkins. How can I retrieve the version from the POM.xml and display it on my HTML ?
Found the solution using a maven replacer:
<plugin><groupId>com.google.code.maven-replacer-plugin</groupId><artifactId>replacer</artifactId><version>1.5.3</version><executions><execution><phase>generate-resources</phase><goals><goal>replace</goal></goals> </execution></executions><configuration> <file>src/main/resources/templates/scheduleraction/main.vm</file><replacements><replacement><token>%PROJECT_VERSION%</token><value>${project.version}</value></replacement></replacements></configuration></plugin>
It looks like you're new here. Sign in or register to get started.