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

This widget could not be displayed.

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
Atlassian Summit 2018

Meet the community IRL

Atlassian Summit is an excellent opportunity for in-person support, training, and networking.

Learn more
Community showcase
Posted Wednesday in New to Jira

Are you planning to trial, or are currently trialling Jira Software? - We want to talk to you!

Hello! I'm Rayen, a product manager at Atlassian. My team and I are working hard to improve the trial experience for Jira Software Cloud. We are interested in   talking to 20 people planning t...

124 views 2 0
Join discussion

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