保护Nexus仓库的Grape配置

3

我的公司使用Nexus作为内部存储库,我正在尝试编写一个Groovy脚本来从中提取依赖项。问题是这个存储库受到密码保护。要让它工作,我的GrapeConfig.xml文件应该是什么样子的?以下是我目前的配置。

<ivysettings>
  <settings defaultResolver="downloadGrapes"/>
    <credentials host="http://prdRepo:18900" 
           realm="prdRepo" 
           username="n"
           passwd="n"
  />

  <resolvers>
    <chain name="downloadGrapes">
      <filesystem name="cachedGrapes">
        <ivy pattern="${user.home}/.groovy/grapes/[organisation]/[module]/ivy-[revision].xml"/>
        <artifact pattern="${user.home}/.groovy/grapes/[organisation]/[module]/[type]s/[artifact]-[revision].[ext]"/>
      </filesystem>
      <ibiblio name="blahblah" root="http://http://prdRepo:18900/nexus/foo/bar/blahblah m2compatible="true"/>
    </chain>
  </resolvers>
</ivysettings>

当我尝试通过命令行安装时,使用以下命令:

grape -d install com.microsoft msutil 2000

在那个仓库中,我遇到了401错误,即未经授权的网址。我的GrapeConfig语法上可能有问题吗?

2个回答

3

既然您已经在使用http auth,只需将URL更改为以下内容即可。(密码以明文发送。)

http://user:password@prdRepo:18900/nexus/foo/bar/blahblah

删除上面的用户名/密码。


有人尝试过吗?我们可以不使用grapeConfig来使用它吗? - user124

3

尝试按以下步骤设置安全域:

<credentials host="prdRepo" realm="Sonatype Nexus Repository Manager" username="????" passwd="????"/>

以下是一个可行的ivy示例,

额外说明:

您的ibiblio解析器格式不正确,URL无效:

<ibiblio name="blahblah" root="http://http://prdRepo:18900/nexus/foo/bar/blahblah m2compatible="true"/>

尝试:

<ibiblio name="blahblah" root="http://prdRepo:18900/nexus/foo/bar/blahblah" m2compatible="true"/>

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接