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
Alexander says
Thanks, this is usfull
eizt says
Thanks1!!!