How to find out what version of maven I am using - maven

The following command in my terminal is not working (mac user)
mvn --version
I want to find out what version of maven I have. I know that I have maven because I use it all the time but I am wondering my this command is not working.

For mac user follow the below link:
http://coolestguidesontheplanet.com/installing-homebrew-os-x-yosemite-10-10-package-manager-unix-apps/
then after you follow those directions enter
brew install maven

Related

install maven 3.6.0 on Mac

I am trying to install a specific version of man.brew install maven#3.6.0 is not working due to lack of 3.6 version (there is 3.5, 3.2, 3.3). installation with this guide https://maven.apache.org/install.html also not.
zsh: man not found
Any ideas?
You can use Maven Version Manager to manage multiple versions of maven. You can have a folder-specific maven version.
Steps
If you already installed the maven brew formula uninstall it brew remove --force maven
Install mvnvm. brew install mvnvm
To set the global maven version add an environment variable named DEFAULT_MVN_VERSION with the maven version you want as default as the value.
To set a Maven version for a specific folder create a file named mvnvm.properties in that folder and have the following content.
mvn_version=<maven version for the folder>
You can get the 3.6.3 binaries from here
https://dlcdn.apache.org/maven/maven-3/3.6.3/
Just saw and struggled for a bit before getting to the wget command

Why does homebrew link to ../Cellar and not /usr/local/Cellar?

I have:
MacOS 10.12.2
homebrew 1.1.5
maven 2.0.8
I am trying to install maven 3
before running brew, which mvn reports /usr/local/apache-maven-2.0.8/bin/mvn as we would expect.
after running brew install maven without errors which mvn now reports ../Cellar/maven/3.3.9/bin/mvn and mvn -v still reports 2.0.8.
I'm new to brew. brew doctor does not report any errors. What am I doing wrong?
Because users might install Homebrew in a different path (e.g. ~/.homebrew). In order to support any install path Homebrew uses relative paths when symlinking binaries and other files.
after running brew install maven without errors which mvn now reports ../Cellar/maven/3.3.9/bin/mvn and mvn -v still reports 2.0.8.
This is a different issue; this time due to your shell which checks the full path of an executable only the first time you use it. That is, the first time you typed mvn -v it did the equivalent of which mvn and remembered that path. The second time you typed mvn -v it used that path instead of re-checking it. Type hash -r to reset its memory or start a new shell.

Can't find maven in OS X Yosemite 10.10.4

Nothing when I type:
$ whereis mvn
but I guess it is somewhere because from Eclipse I can select a pom.xml file and run it as maven build
As pointed out in the comments, Eclipse brings its own bundled Maven. If you want to use Maven on the shell, I suggest you install Homebrew and then install Maven like this:
brew install maven
After that you should be able to use mvn on the command line.
By the way, to find out where mvn is, use:
which mvn

Grails Mac OSX Install via Brew Restarting terminal

I've been trying to get past step one of installing grails, which is bad i know. But the issue im having is getting grails to work via the OSX terminal. similar to node using brew I type the command
brew install grails
this retrieves grails and installs it, simple. to see if its installed correctly you type grails -version
However when i do that it's as though my terminal restarts. Its a hard thing to describe so here is a link to a youtube video that shows you what happens. I have JAVA installed and working. Anyone have an idea?
https://www.youtube.com/watch?v=ButLwGfBTZo
As this is the first excursion I have had into any Java related development. I made a rookie mistake and was unaware of vital piece of information. You do not need Java to run Grails you need the Java Development Kit (JDK). Which is a different thing completely apparently.
Available here
http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
Once installed run this command in the terminal /usr/libexec/java_home -V This will show you all of the current Java Virtual Machines installed. In my case
Matching Java Virtual Machines (1):
1.8.0_11, x86_64: "Java SE 8" /Library/Java/JavaVirtualMachines/jdk1.8.0_11.jdk/Contents/Home
You then need to set your JAVA_HOME Environment variable to point to your JVM. Like so export JAVA_HOME=$(/usr/libexec/java_home) use /usr/libexec/java_home rather than the true location as this will specifi the version set in Java Preferences for the current user. The source for that nice little trick is here http://www.mkyong.com/java/how-to-set-java_home-environment-variable-on-mac-os-x/
Once you've done that you can type the command brew install grails or gvm install grails which is what i should probably use rather than brew as "SurrealAnalysis" rightly pointed out in one of the answers.
moment of truth grails -version and i got a response Grails version: 2.4.3... sweet.
Thank you all for the replies and help.
Following previous post, GVM it is not available in Homebrew, because of this.
GDK is also now officially SDKMAN!.
So, the steps would be:
curl -s "https://get.sdkman.io" | bash
source "/Users/{YOUR_USER_NAME}/.sdkman/bin/sdkman-init.sh"
sdk install groovy
Hope it helps! :)

Upgrading Maven on Mac

Tried to upgrade maven. Followed this tutorial. Now I am getting this
How does a file exist and not exist?
To upgrade to the latest version (if you have one already installed but need to update the version) do the following:
1. brew update
2. brew unlink maven
3. brew install maven
if you then execute the mvn --version command you should see that your version of maven has been upgraded.
EDIT:
If you have an issue with the update (command 1) that goes along the lines of
error: The following untracked working tree files would be overwritten by merge:
Library/Formula/... try this answer from another issue
You created a symbolic link from your Downloads directory with a directory that may not exist anymore (or with an incorrect path). The directory /usr/bin/mvn obviously exists but the link is incorrect to the target which leads to the "No such file or directory" error when typing mvm --version.
Go through the tutorial again (which seems ok) but if you fail you could always try using Homebrew with the following commands :
brew update
brew install maven
if you installed maven in your mac, i use the next command...
>brew upgrade maven
screenshot
I will be fixed if you run below commands
brew update
brew install maven
Still issue is exist check your M2_HOME path.
It should set to
M2_HOME=/usr/local/bin/mvn

Resources