遵循https://dzone.com/articles/installing-maven
中提到的步骤SandeepanNath:~ sandeepan.nath$ echo $PATH
/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
SandeepanNath:~ sandeepan.nath$ export PATH=/opt/apache-maven-3.6.0/bin:$PATH
SandeepanNath:~ sandeepan.nath$ echo $PATH
/opt/apache-maven-3.6.0/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
SandeepanNath:~ sandeepan.nath$ mvn -v
-bash: mvn: command not found
SandeepanNath:~ sandeepan.nath$
/ opt / apache-maven路径是我提取二进制文件的位置-
total 48
-rw-r--r-- 1 sandeepan.nath 1974079253 2.5K Oct 25 2018 README.txt
-rw-r--r-- 1 sandeepan.nath 1974079253 182B Oct 25 2018 NOTICE
-rw-r--r-- 1 sandeepan.nath 1974079253 13K Oct 25 2018 LICENSE
drwx------ 8 sandeepan.nath 1974079253 256B May 29 17:40 bin
drwx------ 5 sandeepan.nath 1974079253 160B May 29 17:40 conf
drwx------ 3 sandeepan.nath 1974079253 96B May 29 17:40 boot
drwx------ 58 sandeepan.nath 1974079253 1.8K May 29 17:40 lib
即使我打开一个新的终端,对于mvc -v也会得到相同的结果。但是,如果尝试回显$ PATH,则无法再看到添加的Maven路径。也尝试在root模式下执行此操作。