0

I've never used maven before but recently I was need to start use it. When I run

mvn

from terminal I get

-bash: mvn: command not found

Then I decided that maven not installed and run:

brew install maven

I get the following exeption:

Error: maven-3.2.1 already installed To install this version, first `brew unlink maven'

When I run

brew info maven

I get the following:

maven: stable 3.2.5 http://maven.apache.org/ /usr/local/Cellar/maven/3.2.1 (65 files, 7.8M) * Built from source From: https://github.com/Homebrew/homebrew/blob/master/Library/Formula/maven.rb

When I go to this folder and run

./mvn -version

I got the following:

Apache Maven 3.2.1 (ea8b2b07643dbb1b84b6d16e1f08391b666bc1e9; 2014-02-14T19:37:52+02:00) Maven home: /usr/local/Cellar/maven/3.2.1/libexec Java version: 1.6.0_65, vendor: Apple Inc. Java home: /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home Default locale: en_US, platform encoding: MacRoman OS name: "mac os x", version: "10.10.3", arch: "x86_64", family: "mac"

Now the question what was wrong with my maven installation? Is it enough manually write alias to it environment variables to get it work. If yes, how to do it right? If not, what do I need to do to get it work?

Thank you very much in advance.

UPDATE:

I've added /usr/local/Cellar/maven/3.2.1/bin/ to /etc/paths and it seems to work now. But I still don't know is it right fix.

Anatoly
  • 5,056
  • 9
  • 62
  • 136
  • What does `echo $MAVEN:_HOME` say? – whirlwin May 15 '15 at 23:50
  • `:_HOME`, only this text is shown – Anatoly May 15 '15 at 23:51
  • I don't have access to my Mac running Yosemite at the moment, so I won't be able to verify, but I think `MAVEN_HOME` should point to your Maven installation path. – whirlwin May 15 '15 at 23:53
  • I think it should be M2_HOME http://stackoverflow.com/questions/17136324/what-is-the-difference-between-m2-home-and-maven-home, but what difference between setting these environmental variables and by solution which I found? Add path to **maven** in `/etc/paths`? – Anatoly May 16 '15 at 00:01
  • As far as I know `/etc/paths` is Mac specific and not something that is common for most Unix-like operating systems. Adding these variables to your shell rc file, e.g. `.bashrc` on the other hand is the way I see everyone else do it. – whirlwin May 16 '15 at 00:04
  • If I understand correctly `M2_HOME` vs `/etc/paths` is a matter of convention. As long as I use maven from terminal it's ok, but if any other tool will need its dependency and will looking it by `M2_HOME` it won't find it, am I right? – Anatoly May 16 '15 at 00:07
  • I think you are right. You would figure it out pretty fast if it didn't work. :-) – whirlwin May 16 '15 at 00:33

0 Answers0