How to pass value from script to MAVEN TASK 3.x
Asked by Hemant Sharma:

I am not able to pass values from my script to maven task 3.x  

I am not able to refer the bamboo injected values under goal section of maven task.  
Other bamboo plan variables are accessible but the Bamboo injected variables are not accessible


Answers:
author: Eduardo Alvarenga
body: Hello [@Hemant Sharma](/t5/user/viewprofilepage/user-id/5329399)

Welcome to **Atlassian Community**!

Bamboo works normally with variables (native or injected) in Maven 3.x tasks. Can you show how you are declaring and consuming them? Also, let us know the Bamboo version you are using.

Cheers,

Eduardo Alvarenga  
Atlassian Support APAC

**--please don't forget to Accept the answer if the reply is helpful--**

comments: author: Hemant Sharma
body: Hi [@Eduardo Alvarenga](https://community.atlassian.com/t5/user/viewprofilepage/user-id/4365410)   

Bamboo version 9.2  

**Script configuaration task**   
Interpreter - /bin/sh or cmd.exe

script location Inline

FILE_NAME=variables.properties

...

# some code that generates value for below two variables.

...  
echo "RELEASECANDIDATE=$RELEASE_CANDIDATE" \>\> $FILE_NAME  
echo "ENVTYPE=$ENV_TYPE" \>\> $FILE_NAME

echo "\*\*\*\* SCRIPT COMPLETED \*\*\*\*"  

<br />

Inject Bamboo variables configuration {#toc-hId--414439118}
-----------------------------------------------------------

Path to properties file - variables.properties

Namespace: - abcd  

Maven 3.x configuration {#toc-hId-2073073715}
---------------------------------------------

-settings ./settings.xml clean deploy -P${bamboo.ENVTYPE} -Denv=${bamboo.ENVTYPE} -Drevision=${bamboo.TAG_FOR_RELEASE}.${bamboo.RUNNING_NUMBER}-${bamboo.RELEASECANDIDATE}  

the values ENVTYPE and RELEASECANDIDATE are not resolved.


author: Eduardo Alvarenga
body: Hello [@Hemant Sharma](/t5/user/viewprofilepage/user-id/5329399)

You are missing the namespace declared during the Inject Bamboo variables task. Try:

* ***${bamboo.abcd.VAR_NAME}***

Sincerely,

Eduardo Alvarenga  
Atlassian Support APAC

**--please don't forget to Accept the answer if the reply is helpful--**


author: Hemant Sharma
body: Thanks a lot for the quick response [@Eduardo Alvarenga](/t5/user/viewprofilepage/user-id/4365410)  

The solution helped.


author: Eduardo Alvarenga
body: No worries. Make sure to accept the answer so others can benefit.


author: Hemant Sharma
body: Hi [@Eduardo Alvarenga](/t5/user/viewprofilepage/user-id/4365410)   

Bamboo version 9.2  

**Script configuaration task**   
Interpreter - /bin/sh or cmd.exe

script location Inline

FILE_NAME=variables.properties

...

# some code that generates value for below two variables.

...  
echo "RELEASECANDIDATE=$RELEASE_CANDIDATE" \>\> $FILE_NAME  
echo "ENVTYPE=$ENV_TYPE" \>\> $FILE_NAME

echo "\*\*\*\* SCRIPT COMPLETED \*\*\*\*"  

<br />

Inject Bamboo variables configuration {#toc-hId--414439121}
-----------------------------------------------------------

Path to properties file - variables.properties

Namespace: - abcd  

Maven 3.x configuration {#toc-hId-2073073712}
---------------------------------------------

-settings ./settings.xml clean deploy -P${bamboo.ENVTYPE} -Denv=${bamboo.ENVTYPE} -Drevision=${bamboo.TAG_FOR_RELEASE}.${bamboo.RUNNING_NUMBER}-${bamboo.RELEASECANDIDATE}  

the values ENVTYPE and RELEASECANDIDATE are not resolved.