当前位置: 代码迷 >> java >> GCP数据存储模拟器不会安装在OpenJDK 10上
  详细解决方案

GCP数据存储模拟器不会安装在OpenJDK 10上

热度:67   发布时间:2023-07-27 09:43:03.0

我有一个Ubuntu主机,在该主机上已经使用APT安装了OpenJDK 10和Gloud SDK。 当我尝试安装“ google-cloud-sdk-datastore-emulator”时,出现以下错误。 我在GCP GitHub上找到了一个讨论此问题的线程,但该线程已关闭。 此处-https:

还有谁有相同的问题吗?

错误-

# apt install google-cloud-sdk-datastore-emulator
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 google-cloud-sdk-datastore-emulator : Depends: openjdk-8-jdk but it is not installable
E: Unable to correct problems, you have held broken packages.

我的环境-

作业系统-

DISTRIB_RELEASE=18.04
DISTRIB_CODENAME=bionic
DISTRIB_DESCRIPTION="Ubuntu 18.04.2 LTS"
NAME="Ubuntu"
VERSION="18.04.2 LTS (Bionic Beaver)"

OpenJDK-

#java -version
openjdk version "10.0.2" 2018-07-17
OpenJDK Runtime Environment (build 10.0.2+13-Ubuntu-1ubuntu0.18.04.4)
OpenJDK 64-Bit Server VM (build 10.0.2+13-Ubuntu-1ubuntu0.18.04.4, mixed mode)
#javac -version
javac 10.0.2
#which java
/usr/bin/java

Gcloud SDK-

# gcloud -v
Google Cloud SDK 234.0.0
alpha 2019.02.08
beta 2019.02.08
bq 2.0.41
core 2019.02.08
gsutil 4.36
kubectl 2019.02.08

我们的debian软件包依赖性配置存在一些问题。 尽管如果您通过gcloud命令安装模拟器,它应该可以工作:

gcloud components install cloud-datastore-emulator

( )

请注意,如果从其他程序包管理器中安装了sdk,则组件管理器将无法正常工作。 在这种情况下,您可以将其删除并按照以下建议进行安装:stackoverflow.com/questions/42697026

如果由于某些其他原因您必须通过apt-get安装,则应该会有所帮助,基本上可以通过以下方式避免安装openjdk:

apt-get install google-cloud-sdk-datastore-emulator openjdk-8-jdk-

请注意,openjdk-8-jdk后面有一个“-”

或者,您可以按照同一线程中的步骤更新包依赖关系。

我的解决方案涉及使用equivs创建伪造的openjdk-8-jdk软件包(当然,您需要确保您拥有另一个JDK)。

apt-get install equivs
equivs-control openjdk-8-jdk
vim openjdk-8-jdk # especially change the package name, but I also used 11.0.0 as a version (although it's probably not needed)
equivs-build openjdk-8-jdk
dpkg -i openjdk-8-jdk*.deb