maven:bash mvn权限被拒绝

wsxa1bj1  于 2023-02-18  发布在  Maven
关注(0)|答案(4)|浏览(446)

这就是我看到的

mvn
bash: /usr/local/apache-maven/apache-maven-3.1.1/bin/mvn: Permission denied

我的bash文件:

if [ -f /etc/bashrc ]; then
    . /etc/bashrc
fi

# User specific aliases and functions

JAVA_HOME=/usr/java/default
export JAVA_HOME

HADOOP_HOME=/usr/share/491s14/hadoop
export HADOOP_HOME

PATH=$PATH:$HOME/bin:$HADOOP_HOME/bin   
export PATH

export M2_HOME=/usr/local/apache-maven/apache-maven-3.1.1
export M2=$M2_HOME/bin
PATH=$M2:$PATH

ls命令:

ls -l /usr/local/apache-maven/apache-maven-3.1.1/bin/mvn
-rw-r--r--. 1 root root 5806 Feb 21 11:33 /usr/local/apache-maven/apache-maven-3.1.1/bin/mvn

文件命令:

file /usr/local/apache-maven/apache-maven-3.1.1/bin/mvn
/usr/local/apache-maven/apache-maven-3.1.1/bin/mvn: POSIX shell script text executable
zkure5ic

zkure5ic1#

您的权限显示您无法执行该文件。请修改该文件的权限。如果希望计算机中的所有用户都能够执行该文件,请执行以下操作:

chmod a+x /usr/local/apache-maven/apache-maven-3.1.1/bin/mvn
bmvo0sr5

bmvo0sr52#

/usr/local/apache-maven/apache-maven-3.1.1/bin/mvn没有执行权限。这应该可以修复它:

chmod a+x /usr/local/apache-maven/apache-maven-3.1.1/bin/mvn
fafcakar

fafcakar3#

sudo chmod 777 <mvn location>修复了它。伙计,我在linux上很烂:P

hfwmuf9z

hfwmuf9z4#

你可以试试chmod +x <your-mvnw-file>。它确实有效。

相关问题