![Maven 安装:更新替代方案:错误](https://linux22.com/image/1069468/Maven%20%E5%AE%89%E8%A3%85%EF%BC%9A%E6%9B%B4%E6%96%B0%E6%9B%BF%E4%BB%A3%E6%96%B9%E6%A1%88%EF%BC%9A%E9%94%99%E8%AF%AF.png)
在 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
有效