如何配置 spark-submit(或 DataProc)从 GitHub 包下载 Maven 依赖项(jars)?

How can I configure spark-submit (or DataProc) to download maven dependencies (jars) from GitHub packages?

我正在尝试让 spark-submit(通过 GCP DataProc)从 GitHub 包存储库下载 Maven 依赖项。

spark.jars.repositories=https://myuser:mytoken@maven.pkg.github.com/myorg/my-maven-packages-repo/ 添加到 spark-submit 命令没有帮助...

访问了正确的 url,但未下载文件 (https://maven.pkg.github.com/myorg/my-maven-packages.repo/myorg/mylibrary/1.0.0/library-1.0.0.jar)。

我怎样才能让它工作? (不使用 uber-jars!)

而不是添加:

spark.jars.repositories=https://myuser:mytoken@maven.pkg.github.com/myorg/my-maven-packages-repo/spark-submit 命令

添加:

--files=gs://my-bucket/github-ivysettings.xml

spark.jars.ivySettings=github-ivysettings.xml

将以下文件 (github-ivysettings.xml) 上传到存储桶:

<ivysettings>  

  <settings defaultResolver="default"/>

  <include url="${ivy.default.settings.dir}/ivysettings-public.xml"/>
  <include url="${ivy.default.settings.dir}/ivysettings-shared.xml"/>
  <include url="${ivy.default.settings.dir}/ivysettings-local.xml"/>
  <include url="${ivy.default.settings.dir}/ivysettings-main-chain.xml"/>
  <include url="${ivy.default.settings.dir}/ivysettings-default-chain.xml"/>

  <credentials
      host="maven.pkg.github.com" realm="GitHub Package Registry"
      username="myuser" passwd="mytoken"
      />
  <resolvers>
      <ibiblio
          name="private-github"
          m2compatible="true" useMavenMetadata="true" usepoms="true"
          root="https://maven.pkg.github.com/myorg/my-maven-packages-repo/"
          pattern="[organisation]/[module]/[revision]/[artifact]-[revision](-[classifier]).[ext]"
      />
    <chain name="default" returnFirst="true" checkmodified="true">
      <resolver ref="local" />
      <resolver ref="shared" />
      <resolver ref="public" />
      <resolver ref="private-github" />
    </chain>
  </resolvers>
</ivysettings>

这将保留当前搜索顺序(本地、共享、public),然后在您的私人存储库中搜索。

请注意领域很重要,因此如果您将其用于不同的私有存储库,请更改主机、根目录和领域。