【问题标题】:ivy (2.3.0 or 2.4) not resolving SNAPSHOT maven dependency with a classifierivy(2.3.0 或 2.4)不使用分类器解析 SNAPSHOT maven 依赖项
【发布时间】:2014-10-26 20:01:38
【问题描述】:

我无法使用 ivy-2.3.0 和 nexus / maven 2 repo 解决 SNAPSHOT 依赖项。

我尝试了几件事,但仍然失败,

部分已修复:请在评论部分查看我的评论。

我得到的最新输出是 maven:classifier 不是 与元素相关联。为此,我需要填写命名空间 映射,不知道这应该如何寻找 maven 和 ivy 分类器部分。

我的关系正在使用时间戳。

我的项目文件

<project 
name="test" 
xmlns:ivy="antlib:org.apache.ivy.ant"
>

<ivy:settings file="ivysettings.xml" />

<ivy:retrieve pattern="[organisation]/[module]/[revision]/[artifact]-[revision](-[classifier]).[ext]" />

.....

我的 ivysettings 文件:

<?xml version="1.0" encoding="UTF-8"?>
<ivysettings>

     <!-- what should I put here for maven and ivy to use classifier? -->
     <namespace name="test">
      <rule>
        <fromsystem>
          <src org="systemorg"/>
          <dest org="A"/>
        </fromsystem>
        <tosystem>
          <src org="A"/>
          <dest org="systemorg"/>
        </tosystem>
      </rule>
    </namespace>


    <credentials host="nexus"
                         realm="Sonatype Nexus Repository Manager"
                         username="xyz" passwd="xyz"/>

    <property name="libs_snapshot"
                     value="http://nexus.host.com/nexus/content/repositories/libs_snapshot"/>

    <property 
        name="version_pattern"
        value="[organisation]/[module]/[revision]/[artifact]-[revision](-[classifier]).[ext]"
    />

    <settings defaultResolver="repos" />
    <resolvers>
        <chain name="repos">


            <ibiblio name="central" m2compatible="true"/>  
            <ibiblio 
                name="libs_snapshot"
                m2compatible="true" 
                pattern="${version_pattern}"
                root="${libs_snapshot}"
            />


        </chain>
    </resolvers>

</ivysettings>

我的 ivy.xml 文件:

<ivy-module version='2.0' xmlns:m="http://ant.apache.org/ivy/maven">
    <info 
        organisation="com.xyz" 
        module="chained-resolvers"
    />

    <dependencies>
        <dependency 
            org="com.xyz" 
            name="cache_store"
            rev="1.1-SNAPSHOT"
            changing="true"
         >
         <artifact name="cache_store" 
                m:classifier="mobile" 
                type="jar" ext="jar"/>
        </dependency>
    </dependencies>

</ivy-module>

【问题讨论】:

  • 我设法解决了常春藤抱怨的部分。 maven:classifier 不与元素关联。添加 xmlns:m="ant.apache.org/ivy/maven" 到常春藤模块。所以行:ant.apache.org/ivy/maven">
  • 我不清楚这个问题。以下是如何使用 Maven 分类器检索快照工件的示例:stackoverflow.com/questions/7804253/…

标签: maven ivy nexus


【解决方案1】:

虽然我收到错误消息说 ivy 无法解决依赖关系, 实际上有 http 401 错误说我未经授权。

通过运行带有参数“-debug”的ant任务揭示了真正的原因。

HTTP response status: 401 url=
CLIENT ERROR: Unauthorized url=

我添加了安全凭证,但似乎存在问题 我的条目:

这个没用,解决了我的问题:

<credentials 
    host="server"
    realm="Sonatype Nexus Repository Manager"
    username="username" passwd="password"
/>

这个成功了:

<credentials 
    host="server.xyz.com"
    realm="Sonatype Nexus Repository Manager"
    username="username" passwd="password"
/>

【讨论】:

    猜你喜欢
    • 2014-05-03
    • 2013-04-16
    • 2019-08-23
    • 2015-09-01
    • 2013-03-31
    • 2011-01-24
    • 2011-05-14
    • 2011-12-09
    • 2020-01-25
    相关资源
    最近更新 更多