【问题标题】:Access internal maven repo from IVY从 IVY 访问内部 Maven 存储库
【发布时间】:2011-03-10 18:01:57
【问题描述】:

在这里,我们使用 Sonatype Maven 存储库。这对我们的 maven 项目来说非常好,但是我们有一个使用 Ant+IVY 进行依赖管理的遗留应用程序,现在需要一个来自 Maven 的 dep。

我的 IVY 设置文件如下所示:

<ivysettings>
    <property name="dsnexus-root" value="http://internal-url/" override="false"/>

    <credentials host="hostname" username="username" passwd="XXXX"/>

    <!-- ... -->

    <resolvers>
        <chain name="shared">
            <url name="shared-default">
                <!-- ... -->
            </url>
            <url name="dsnexus-public" m2compatible="true">
                <artifact pattern="${dsnexus-root}/[organisation]/[module]/[revision]/[artifact]-[revision].[ext]"/>
            </url>
        </chain>
    </resolvers>

    <modules>
        <module organisation=".*" name=".*" resolver="shared"/>
    </modules>

    <!-- ... -->
</ivysettings>

但是当我尝试解决我的部门时,它没有从内部回购中找到任何东西

例如

module not found: xerces#xercesImpl;2.9.1
==== shared-default: tried
...
==== dsnexus-public: tried
-- artifact xerces#xercesImpl;2.9.1!xercesImpl.jar:
http://internal-url/xerces/xercesImpl/2.9.1/xercesImpl-2.9.1.jar

当然,该 url 上确实存在 dep。

我也试过

<ibiblio name="dsnexus-public" 
    root="${dsnexus-root}" 
    m2compatible="true" 
    namespace="maven2"/>

得到了同样的结果。

我的猜测是我弄错了凭据。

【问题讨论】:

    标签: maven-2 ivy


    【解决方案1】:

    在与 nexus 交谈时,我通常使用 ibiblio 解析器。

    <ibiblio name="reponame" m2compatible="true" root="http://nexus-url/reponame"/>
    

    【讨论】:

    • 您是否位于代理服务器后面?纯属我个人猜测。我试图确定为什么 ivy 无法通过您的网络浏览器检索存在的 URL。尝试在详细模式下运行 ANT,您将获得更多可能有助于了解故障的详细信息。
    【解决方案2】:

    您还应该使用您的凭据指定领域,如下所示:

    <credentials host="hostname" realm="Sonatype Nexus Repository Manager" username="username" passwd="xxx"/>
    

    【讨论】:

    • 嗯,我会试试这个。我将如何发现我想知道的领域的实际名称?
    【解决方案3】:

    在这里,试试这个:

    <ivysettings>
      <settings defaultResolver="nexus" 
                checkUpToDate="true" />
    
      <credentials host="localhost" 
               realm="Sonatype Nexus Repository Manager" 
               username="admin"
               passwd="admin123"/>
      <resolvers>
        <ibiblio name="nexus" m2compatible="true" 
                 root="http://localhost:8081/nexus/content/groups/public/"/>
        <url name="releases" m2compatible="true">
            <artifact pattern="http://localhost:8081/nexus/content/repositories/releases/[organization]/[module]/[revision]/[artifact]-[revision].[ext]"/>
            <ivy pattern="http://localhost:8081/nexus/content/repositories/releases/[organization]/[module]/[revision]/ivy-[revision].xml"/>
        </url> 
      </resolvers>
    </ivysettings>
    

    Nexus 1.7.1 非常适合我。如果您有任何问题,请告诉我。

    【讨论】:

      猜你喜欢
      • 2015-07-24
      • 1970-01-01
      • 1970-01-01
      • 2011-07-12
      • 2013-05-10
      • 2017-04-17
      • 2011-01-27
      • 1970-01-01
      相关资源
      最近更新 更多