-bash: /usr/bin/mvn: Too many levels of symbolic links

问题背景:

root 用户安装了maven,切换到jenkins 用户可以正常执行mvn 命令,但是jenkins job 构建任务却无法执行mvn命令,报错如下:/bin/sh: 1: mvn: not found

1、root用户安装maven

root# mvn -v
Apache Maven 3.5.2 (138edd61fd100ec658bfa2d307c43b76940a5d7d; 2017-10-18T07:58:13Z)
Maven home: /usr/share/maven
Java version: 1.8.0_151, vendor: Oracle Corporation
Java home: /usr/java/jdk1.8.0_151/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "3.13.0-135-generic", arch: "amd64", family: "unix"

2、root用户配置/etc/profile 文件,并source 使配置生效

export M2_HOME=/usr/share/maven
export PATH=$PATH:${M2_HOME}/bin 

3、切换到ubuntu用户执行mvn命令,报错

[email protected]$ whereis mvn
mvn: /usr/bin/mvn /usr/bin/X11/mvn /usr/share/man/man1/mvn.1.gz
[email protected]$ /usr/bin/mvn -v
-bash: /usr/bin/mvn: Too many levels of symbolic links

4、root用户下查看/usr/bin/mvn 软连接信息

[email protected]# whereis mvn
mvn: /usr/bin/mvn /usr/bin/X11/mvn /usr/share/man/man1/mvn.1.gz
[email protected]# ll /usr/bin/mvn
lrwxrwxrwx 1 root root 3 Dec  8 13:44 /usr/bin/mvn -> mvn

5、更改软连接方式

[email protected]# rm -f /usr/bin/mvn
[email protected]# ln -s /usr/share/maven/bin/mvn /usr/bin/mvn
[email protected]# ll /usr/bin/mvn
lrwxrwxrwx 1 root root 24 Dec  8 13:47 /usr/bin/mvn -> /usr/share/maven/bin/mvn*

6、ubuntu用户下再次验证

[email protected]$ mvn -v
Apache Maven 3.5.2 (138edd61fd100ec658bfa2d307c43b76940a5d7d; 2017-10-18T07:58:13Z)
Maven home: /usr/share/maven
Java version: 1.8.0_151, vendor: Oracle Corporation
Java home: /usr/java/jdk1.8.0_151/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "3.13.0-135-generic", arch: "amd64", family: "unix"

总结:

建立软连接的时候,尽量采用绝对路径,避免采用相对路径建立软链接。

时间: 2024-10-08 01:57:36

-bash: /usr/bin/mvn: Too many levels of symbolic links的相关文章

bash: /usr/bin/npm: No such file or directory

一个整得很烂了的Ubuntu服务器, 各种问题乱出. npm老是升不到最新版(一直显示1.4),于是我干脆删了, 结果再去装却装不上了, 如果用apt-get install npm安装, 就得到如下错误: The following packages have unmet dependencies: npm : Depends: nodejs but it is not going to be installed Depends: nodejs-dev Depends: node-reques

在centos7中安装python时,输入yum出现 -bash: /usr/bin/yum: No such file or directory

第一次真正认真的玩起linux,装了一个虚拟机,一看python版本是2.7的,想弄个3.7的,于是,百度上找到了这篇文章https://www.cnblogs.com/JahanGu/p/7452527.html . 结果执行到这一步"mv python python.bak"的时候悲剧了,因为我的电脑没有安装wget,这步命令让我的python变成了python.bak,而yum好像是基于python的,所以即便是执行yum -y install wget也没有用了,会出现-bas

-bash: /usr/bin/yum: /usr/bin/python: bad interpreter: No such file or directory

报错:-bash: /usr/bin/yum: /usr/bin/python: bad interpreter: No such file or directory python多版本造成额问题 找不到python的路径 所以保持 -查找python#whereis pythonpython: /usr/bin/python /usr/bin/python2.4 /usr/lib/python2.4 /usr/local/bin/python2.7 /usr/local/bin/python

Too many levels of symbolic links 问题

Too many levels of symbolic links 问题 Posted on 2011-11-30 20:33 张贺 阅读(5826) 评论(0) 编辑 收藏 今天弄了个ZendStudio,放在了user下的某个文件夹下,想把执行程序ZendStudio做个链接到/usr/sbin目录下.于是使用命令: ln -s ./ZendStudio /usr/sbin 可是当执行ZendStudio的时候提示“Too many levels of symbolic links”这个错误

软链接ln -s以及如何解决其产生“Too many levels of symbolic links ”的错误?

[[email protected] script]$ ls /etc/init.d/hadoop.sh  ls: cannot access /etc/init.d/hadoop.sh: Too many levels of symbolic links [[email protected] script]$ ls /home/hadoop/script/hadoop.sh  /etc/init.d/hadoop.sh  ls: cannot access /etc/init.d/hadoop

yum报错-bash: /usr/bin/yum: /usr/bin/python2.7: bad

1.创建目录python和yum用以存放rpm包: mkdir /usr/local/src/python mkdir /usr/local/src/yum 2.使用wget分别下载python以及yum的rpm包(注意:一定要和系统的版本号对应)地址:http://vault.centos.org (1)下载python的rpm包: cd /usr/local/src/python wget http://vault.centos.org/7.2.1511/os/x86_64/Packages

bash: /usr/bin/ls: 参数或环境列表太长

事件触发 检查主机空间使用情况发现/var/spool/mail/***使用空间达到了100%,也就是说*** 用户邮件满了,当然这并不影响业务正常运行[业务有独立空间存放],查看/var/spool/mail/***内容是,发现了如下报错: 经过网上收集先关资料并测试找到原因如下: 原因:经测试,文件目录中符合条件的文件数量不超过800时可以正常列出来,超过800,就会报参数列表太长错误. 所以要注意以后在shell中`ls ***`获取列表时一定要考虑会不会时间长了有这样的问题发生.

-bash: ./****.py: /usr/bin/python^M: bad interpreter: No such file or directory

在windows系统下写的python脚本,在linux下赋予权限chmod +x xxx.py 以后,执行./xxx.py运行提示:bash: /usr/bin/autocrorder: /usr/bin/python^M: bad interpreter: No such file or directory 更多文章请点击我 分析: 这是不同系统编码格式引起的:在windows系统中编辑的.sh .py文件可能有不可见字符,所以在Linux系统下执行会报以上异常信息.一般是因为windows

ambari安装问题-looped symbolic links found while resolving %s" % /usr/hdp/current/ranger-tagsync/conf

一.启动服务时,出现若干循环符号链接错误,比如下面是启动ranger时发生的其中一个错误信息: setup_tagsync(upgrade_type=upgrade_type) File "/var/lib/ambari-agent/cache/stacks/HDP/3.0/services/RANGER/package/scripts/setup_ranger_xml.py", line 515, in setup_tagsync create_parents = True File