1

I am using a Bamboo CICD pipeline to build and deploy spring boot jar using maven release. Build is working fine and a spring boot jar is created. Since maven release updates the jar version after every run, I am unable to use this jar in the next stages of bamboo pipeline.

I have gone through bamboo documentation and discussion forums in Atlassian and Stackoverflow but unable to get the required solution. I tried to get the artifact in the next stages using "Artifact Download" task but unable to use it since jar version always varies.

I tried to fetch the shared artifact file using regular expression such as target/*.war in the deploy step (Command task - Argument field) but guess bamboo is not able to execute the regex. It is giving the following error message.

Incorrect Usage: The specified path 'target/*.war' does not exist.

If I give the correct name such as target/appname-0.0.1-snapshot.war bamboo is able to find the war file and deploying it successfully.

Is there any way that the exact war or jar name can be obtained in further stages without the need of manual update after every run? Any help on this would be greatly appreciated.

ASD
  • 325
  • 1
  • 2
  • 9
  • There are two thing that came to mind. You can use the bamboo variables to assign to the generated war file then in another task rename it, or you can configure maven to generate your war file with the same name without the version. See this thread about the maven configuration for reference: https://stackoverflow.com/questions/9593473/how-to-build-project-with-maven-without-version – Jorge Campos Jan 29 '18 at 01:47
  • Hi @JorgeCampos , Thank you for the response. I have gone through the reference link but version is required in my case as we are pushing the artifact to nexus repository. Can you please explain a bit more on the first option or give some reference links if possible? I know that we can assign static values to bamboo variables in the "Variables" section of the plan but is there any way we can assign the war file name to bamboo variable and use it in the next stage? – ASD Jan 29 '18 at 01:56

2 Answers2

0

Regular expression is not working in the command task but I was able to resolve this issue by using the bamboo script task. Regular expression is working fine and target/*.war has been resolved correctly.

ASD
  • 325
  • 1
  • 2
  • 9
0

You can also try Maven POM Value Extractor plugin. This plugin provides a build task that extracts values from Maven POMs and sets build variables using those values. This allows you to keep you Bamboo variables in sync with your Maven POM.

You can automatically extract your artifact's GAV (GroupId, Artifact, Version).

Hamed
  • 1,175
  • 3
  • 20
  • 46