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 错误,未经授权的 URL。我的 GrapeConfig 可能在语法上有问题吗?

4

2 回答 2

3

尝试如下设置安全领域:

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

有关常春藤的工作示例,请参见:

补充说明:

您的 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"/>
于 2014-04-01T17:50:37.990 回答
3

由于您无论如何都在使用 http auth,因此只需将您的 URL 更改为此。(密码以明文形式发送。)

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

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

于 2014-04-01T18:00:32.320 回答