无法从受密码保护的私有nexus下载spark-shell中的软件包

问题描述 投票:0回答:1

我试图使用私有密码保护的nexus下载并添加私有jar工件到spark-shell类路径,但它无法下载它。 spark文档(https://spark.apache.org/docs/latest/submitting-applications.html)提到-repositories参数与uri看起来像https://user:password@host/应该工作,但我的spark-shell仍然无法下载工件。 spark-shell打印出一个尝试失败的网址,但是当我点击它时,我可以在浏览器中打开它就好了。

这是我的示例命令

./spark-shell --packages com.danish:spark-lib:1.0.0 --repositories https://username:[email protected]/repository/public

如果我错过了什么,请告诉我。如果有其他方法,比如使用连接到nexus的mvn或ivy,我也很乐意听到。

谢谢

apache-spark dependency-management spark-submit
1个回答
-1
投票

我能够通过使用常春藤依赖管理和管理ivysetting.xml中的nexus存储库和凭据来使其工作我创建了ivysettings.xml文件,其中包含所有nexus的详细信息。见下面的例子。运行spark shell时,我们将spark.jars.ivySettings指向ivysettings.xml路径。例如

./spark-shell.sh --conf spark.jars.ivySettings=/User/me/ivysettings.xml --packages com.danish:spark-lib:1.0.0

ivysetting.xml示例

<ivysettings>
 <settings defaultResolver="nexus"/>
<credentials host="nexus.host.com" realm="Sonatype Nexus Repository Manager" username="username" passwd="mypassword"/>
<property name="nexus-public" value="https://nexus.host.com/repository/public"/>
<property name="nexus-releases" value="https://nexus.host.com/repository/releases"/>
<property name="nexus-snapshots" value="https://nexus.host.com/repository/snapshots"/>
<resolvers>
  <ibiblio name="nexus" m2compatible="true" root="${nexus-public}"/>
  <ibiblio name="nexus-snapshots" m2compatible="true" root="${nexus-snapshots}"/>
  <ibiblio name="nexus-releases" m2compatible="true" root="${nexus-releases}"/>
</resolvers>

此ivysettings.xml具有纯文本凭据。我没有考虑加密凭据或在常春藤中使用不同的凭证管理器。

© www.soinside.com 2019 - 2024. All rights reserved.