Zombie mvn: Maven uninstall troubles - maven

I am currently struggling with an uninstalled maven 3.3.9 on my Ubuntu 16.04, which I uninstalled using the command
sudo apt-get remove --auto-remove maven
I have installed maven 3.6.1 in my local directory,
and command which mvn points exactly to the executable,
but when I'm trying to execute the command mvn --version it shows File not found (at the old /usr/bin path of the uninstalled 3.3.9 version)
bash: /usr/bin/mvn: File not found
So, obviously, there is some symbolic link or something else, but trying to find the broken link with the command
find . -type l | xargs file | grep broken from /
does not come up with any mvn link.
That's rather annoying, can please someone give me an idea how to get rid of the zombie mvn?

Related

Apache Ant Installation In Mac

I installed ant using home brew.
Now the ant -version gives me the installed version, but how do i find out where ant is installed on my mac?
Kindly help?
brew is going to put a symlink in /usr/local/bin/that points to the installation in /usr/local/Cellar/ant/
To find the complete path:
ls -l $(which ant)

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.

Couldn't get maven version

I'm using Ubuntu and new to maven i started to install maven 3 with
wget http://archive.apache.org/dist/maven/maven-3/
3.1.0/binaries/apache-maven-3.1.0-bin.tar.gz
i need to install this version to be convenient with JDK6 after that i extracted this in /opt
then edited in .bashrc
export MVN_HOME="/tmp/apache-maven-3.1.0"
export PATH="$PATH:$MVN_HOME/bin"
i tested mvn -version but got
The program 'mvn' can be found in the following packages:
* maven
* maven2
Try: sudo apt-get install <selected package>
Have you checked which directories are already in $PATH and contain a mvn ?
Change your export statement to
export PATH="$MVN_HOME/bin:$PATH"
in order to make sure that your mvn comes first. Besides that you might want to scan for variants of mvn that are already on your system:
find / -name mvn

How to find out what version of maven I am using

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

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