Pipe output of Maven task to file

I would like to do

mvn versions:display-dependency-updates > mvn-versions-dependency-updates.txt

 

I cannot do this via Maven3.x-task. When adding "> mvn-versions-dependency-updates.txt" to the goals, I am getting

Unknown lifecycle phase

 

Well, "> mvn-versions-dependency-updates.txt" is not a goal, so the error is fine - but

 

How can I pipe maven output to file via Maven3.x-task?

1 answer

1 accepted

1 vote

You can't pass non Maven settings to Maven task. If you need to achieve this goal you have to use script task, use Maven3.x capability there and pass whatever argument you want

https://confluence.atlassian.com/display/BAMBOO/Bamboo+variables#Bamboovariables-Usingcapabilities

In your case it will be something like this

${bamboo_capability_system_builder_mvn3_Maven_3}/bin/mvn -v > maven.version

As good reference of environment variables available during the build, see Job log tab, there you can find correct name of capability you can use in script task

Beginning to execute external process for build 'Test project - Test plan - Default Job #4 (TP-TP-JOB1-4)'
 ... running command line: 
.../projects/bamboo/bamboo-homes/funk-9087_hsqldb_514/temp/TP-TP-JOB1-4-ScriptBuildTask-3521333488667538048.sh
 ... in: .../projects/bamboo/bamboo-homes/funk-9087_hsqldb_514/xml-data/build-dir/TP-TP-JOB1
 ... using extra environment variables: 
bamboo_resultsUrl=http://127.0.0.1:9087/bamboo/browse/TP-TP-JOB1-4
bamboo_dependenciesDisabled=false
bamboo_capability_system_jdk_JDK_1_8_0_77=/Library/Java/JavaVirtualMachines/jdk1.8.0_77.jdk/Contents/Home
bamboo_build_working_directory=.../projects/bamboo/bamboo-homes/funk-9087_hsqldb_514/xml-data/build-dir/TP-TP-JOB1
bamboo_buildKey=TP-TP-JOB1
bamboo_capability_system_docker_executable=/usr/local/bin/docker
bamboo_shortPlanName=Test plan
bamboo_agentWorkingDirectory=.../projects/bamboo/bamboo-homes/funk-9087_hsqldb_514/xml-data/build-dir
bamboo_capability_system_git_executable=/usr/bin/git
bamboo_buildNumber=4
bamboo_shortJobName=Default Job
bamboo_buildResultsUrl=http://127.0.0.1:9087/bamboo/browse/TP-TP-JOB1-4
bamboo_capability_system_jdk_JDK=/Library/Java/JavaVirtualMachines/jdk1.8.0_77.jdk/Contents/Home
bamboo_agentId=163841
bamboo_planName=Test project - Test plan
bamboo_shortPlanKey=TP
bamboo_ManualBuildTriggerReason_userName=admin
bamboo_shortJobKey=JOB1
bamboo_buildTimeStamp=2016-10-28T13:02:16.781+02:00
bamboo_capability_system_builder_mvn3_Maven_3=.../tools/apache-maven-3.2.5
bamboo_working_directory=.../projects/bamboo/bamboo-homes/funk-9087_hsqldb_514/xml-data/build-dir/TP-TP-JOB1
bamboo_planKey=TP-TP
bamboo_capability_system_jdk_JDK_1_8=/Library/Java/JavaVirtualMachines/jdk1.8.0_77.jdk/Contents/Home
bamboo_buildResultKey=TP-TP-JOB1-4
bamboo_buildPlanName=Test project - Test plan - Default Job
bamboo_capability_system_hg_executable=/usr/local/bin/hg

Not beautiful, but good enough. Thanks a lot!

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published May 18, 2017 in Bamboo

FAQ: How to Upgrade Bamboo Server

Bamboo 5.9 will no longer be supported after June 12, 2017. What does this mean? As part of our End of Life policy, Atlassian supports major versions for two years after the first major iteratio...

1,568 views 0 6
Read article

Atlassian User Groups

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

Find a group

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

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you