Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Add jenkins Build number to Plugin Version

Youssef Bouchara January 20, 2022

Hi guys, so I'm building my plugin in Jenkins and with every build my jar file gets a number from jenkins like  "plugin-branch#build#149.jar". I wanted to add that number to "Version" when I install the plugin on Jira, in my case the Version says: 1.0.0-SNAPSHOT because my pom.xml looks like this: 

<?xml version="1.0" encoding="UTF-8"?>

<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">
<modelVersion>4.0.0</modelVersion>
<groupId>com.company.jira.plugin</groupId>
<artifactId>service</artifactId>
<version>1.0.0-SNAPSHOT</version>
<organization>
<name>Capgemini</name>
<url>http://www.company.com/</url>
</organization>
<name>security-service</name>
<description>This is the com.company.jira.plugin:security plugin for Atlassian JIRA.</description>
<packaging>atlassian-plugin</packaging>
<dependencies>
<dependency>
<groupId>com.atlassian.jira</groupId>
<artifactId>jira-api</artifactId>
<version>${jira.version}</version>
<scope>provided</scope>
</dependency>

 

How can I include the jenkins Build number into my plugin automatically when I build on Jenkins? I tried this but it's not working.

 

image.png

1 answer

1 accepted

1 vote
Answer accepted
Youssef Bouchara January 20, 2022

This worked for me : 

<version>${BUILD_NUMBER}-SNAPSHOT</version>

Suggest an answer

Log in or Sign up to answer