Maven 安装:更新替代方案:错误

Maven 安装:更新替代方案:错误

在 Ubuntu 18.04 中使用命令安装 maven 时

sudo apt install maven

我收到类似错误

update-alternatives: error: alternative link /usr/bin/mvn is already managed by maven
dpkg: error processing package maven (--configure):
 installed maven package post-installation script subprocess returned error exit status 2
Errors were encountered while processing:
 maven
E: Sub-process /usr/bin/dpkg returned an error code (1)

我尝试了第二种选择,按照此链接中的步骤操作https://www.javahelps.com/2017/10/install-apache-maven-on-linux.html

in step 5
sudo update-alternatives --install "/usr/bin/mvn" "mvn" "/opt/apache-maven-3.6.3/bin/mvn" 0
sudo update-alternatives --set mvn /opt/apache-maven-3.6.3/bin/mvn

遇到了同样的错误。

答案1

我试过update-alternatives --remove mvn /usr/bin/mvn update-alternatives --remove-all mvn 有效

相关内容