我通过典型方式安装了 gradle:
sudo apt install gradle
Reading package lists... Done
Building dependency tree
Reading state information... Done
gradle is already the newest version (3.5-0ubuntu1).
0 to upgrade, 0 to newly install, 0 to remove and 8 not to upgrade.
接下来我想使用这个程序:
$ gradle
The program 'gradle' is currently not installed. You can install it by typing:
sudo apt install gradle
我试图删除 java,清除 gradle,从任何地方删除它并重新安装。没有任何帮助......最令人困惑的是,这个包几天前可以正常工作,没有任何问题。
下面是一些调试:
$ which gradle
$ whereis gradle
gradle:
$ apt-cache policy gradle
gradle:
Installed: 3.5-0ubuntu1
Candidate: 3.5-0ubuntu1
Version table:
*** 3.5-0ubuntu1 500
500 http://ppa.launchpad.net/cwchien/gradle/ubuntu xenial/main amd64 Packages
500 http://ppa.launchpad.net/cwchien/gradle/ubuntu xenial/main i386 Packages
100 /var/lib/dpkg/status
2.10-1 500
500 http://archive.ubuntu.com/ubuntu xenial/universe amd64 Packages
500 http://archive.ubuntu.com/ubuntu xenial/universe i386 Packages
1.4-2ubuntu1 500
500 http://us.archive.ubuntu.com/ubuntu trusty/universe amd64 Packages
500 http://us.archive.ubuntu.com/ubuntu trusty/universe i386 Packages
当正确检测到这个包时,如何将系统恢复到状态?
更新
我找到了命令:
sudo apt-get clean
现在我得到:
sudo apt install gradle
Reading package lists... Done
Building dependency tree
Reading state information... Done
gradle is already the newest version (3.5-0ubuntu1).
0 to upgrade, 0 to newly install, 0 to remove and 8 not to upgrade.
W: Target Packages (main/binary-amd64/Packages) is configured multiple times in /etc/apt/sources.list:7 and /etc/apt/sources.list.d/docker.list:1
W: Target Packages (main/binary-all/Packages) is configured multiple times in /etc/apt/sources.list:7 and /etc/apt/sources.list.d/docker.list:1
W: Target Translations (main/i18n/Translation-en_GB) is configured multiple times in /etc/apt/sources.list:7 and /etc/apt/sources.list.d/docker.list:1
W: Target Translations (main/i18n/Translation-en) is configured multiple times in /etc/apt/sources.list:7 and /etc/apt/sources.list.d/docker.list:1
W: Target Translations (main/i18n/Translation-pl) is configured multiple times in /etc/apt/sources.list:7 and /etc/apt/sources.list.d/docker.list:1
W: Target DEP-11 (main/dep11/Components-amd64.yml) is configured multiple times in /etc/apt/sources.list:7 and /etc/apt/sources.list.d/docker.list:1
W: Target DEP-11-icons (main/dep11/icons-64x64.tar) is configured multiple times in /etc/apt/sources.list:7 and /etc/apt/sources.list.d/docker.list:1
更新2
dpkg -L gradle
/.
/usr
/usr/share
/usr/share/doc
/usr/share/doc/gradle
/usr/share/doc/gradle/changelog.Debian.gz
/usr/share/doc/gradle/copyright
namei -lx /usr/bin/gradle
f: /usr/bin/gradle
Drwxr-xr-x root root /
drwxr-xr-x root root usr
drwxr-xr-x root root bin
gradle - No such file or directory
最后感谢@muru 的评论,我完成了以下步骤:
我删除了
ppa:cwchien/gradle
:我从官方仓库安装了旧的 gradle:
然后正确安装了所有依赖项。然后我再次追加
cwchien-ubuntu-gradle-xenial
并再次安装:最后在网站https://gradle.org/install我找到了命令:
这终于解决了我的问题,现在:
更新
现在我通过sdkman.io通过这些命令安装 gradle:
安装 sdkman
安装 gradle