Ubuntu QuickTip: sudo ant doesn’t work!

Today I picked up latest sources of Maven3 from its svn repo and started building it on Ubuntu. As part of the build, you need to run “ant” command which at the end tries to copy stuff to /usr/ directory for which it didn’t have access. So I tried running “sudo ant” and it started giving me exceptions like “JAVA_HOME is not defined correctly” which to my knowledge I exported correctly in my $HOME/.bashrc. After some research I found that while working with “sudo” you need to pass environment variables along with command itself. Something like this:

sudo env JAVA_HOME=$JAVA_HOME ant

Tagged with: ,
Posted in QuickTip, Ubuntu, Uncategorized
2 comments on “Ubuntu QuickTip: sudo ant doesn’t work!
  1. Alexander says:

    Thanks, this is usfull

Leave a Reply

Your email address will not be published. Required fields are marked *

*

CommentLuv badge

Welcome to Sampreshan
Technology Strategist, Speaker, Scrum/XP/Agile Trainer Coach and Trainer
Your interest areas
Follow

Get every new post on this blog delivered to your Inbox.

Join other followers: