Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

To use Bamboo Customized Plan variables in pom.xml

I have 3 modules in my Project and 3 testng files for which different tests should invoke. I want to choose testng_ModuleName.xml as per Bamboo variable (bamboo.module=ModuleName) value while running the customized plan in Bamboo. In pom.xml , ${bambooModule}  is used as below:

<suiteXmlFiles>
<suiteXmlFile>${bambooModule}</suiteXmlFile>
</suiteXmlFiles>

  Maven goal in Bamboo job:

test -DbambooModule=testng_${bamboo.module}.xml

 

It gives below error:

\bamboo-home\xml-data\build-dir\JOB1\ProjectName\testng_${bamboo.module}.xml is not a valid file

 

Not sure where i'm wrong. Can anyone please help.

1 answer

1 accepted

2 votes
Answer accepted
rsperafico Atlassian Team Sep 26, 2018

Hi @Vandana Arora,

Thank you for your inquire.

Here is an example where artifactId is receiving a Bamboo Variable

<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/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>my.package</groupId>
    <artifactId>sample-${bamboo_buildNumber}</artifactId>
    <packaging>jar</packaging>
    <name>Sample</name>
    <version>1.0.0</version>
    <dependencies>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.11</version>
        </dependency>
    </dependencies>
    <build>
     <sourceDirectory>src</sourceDirectory>
     <plugins>
         <plugin>
             <artifactId>maven-compiler-plugin</artifactId>
             <version>3.2.1</version>
             <configuration>
                 <source>1.8</source>
                 <target>1.8</target>
             </configuration>
         </plugin>
     </plugins>
   </build>
</project>

Whereas in the build log you would find:

...bamboo_planRepository_name=Maven 3.x\nbamboo_buildNumber=1...

Please, notice the _ (underscore) used instead of . (dot) when calling the variable.

Kind regards,

Rafael

Thanks for your Reply @rsperafico.. it worked for me now.

I have updated pom.xml as:

<suiteXmlFiles>
<suiteXmlFile>testng${bamboo_module}.xml</suiteXmlFile>
</suiteXmlFiles>

and the maven goal as:

 -Dbamboo_module=${bamboo.module} test

and my Build variable is :

module= some value

Like Steffen Opel _Utoolity_ likes this

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Bamboo

Bamboo Data Center 8.1 is now available

G’day Bamboo customers, Bamboo DC 8.1 is now available with it the following features and programs: SAML 2.0, OpenID Connect, and Crowd SSO In order to help admins with a simplified user manage...

213 views 0 4
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you