【问题标题】:Ivy maven compatibility issueIvy maven 兼容性问题
【发布时间】:2014-09-10 05:02:10
【问题描述】:

我正在尝试向 Ivy 项目添加依赖项。 maven中的依赖是这样的:

<dependency>
    <groupId>org.glassfish.jersey.ext</groupId>
    <artifactId>jersey-spring3</artifactId>
    <version>2.7</version>
</dependency>

我已将此添加到 ivy.xml 文件中:

但是在运行解析任务时,它给了我这样的错误: ::::::::::::::::::::::::::::::::::::::::::::::

    ::          UNRESOLVED DEPENDENCIES         ::

    ::::::::::::::::::::::::::::::::::::::::::::::

    :: org.glassfish.hk2#hk2;${hk2.version}: not found

    :: org.glassfish.hk2#spring-bridge;${hk2.version}: not found

    :: javax.ws.rs#javax.ws.rs-api;working@comp: not found

    ::::::::::::::::::::::::::::::::::::::::::::::

Here 是 jersey-spring3 pom 文件。我认为问题是因为 pom 文件中的父标签。这是因为 hk2.version 是在 jar 的父 pom 中定义的。

Ivy 在 pom 文件中不支持此功能吗? 有什么方法可以在不向主 ivy.xml 添加传递依赖项的情况下解决这个问题? 谢谢。

【问题讨论】:

    标签: maven pom.xml ivy


    【解决方案1】:

    无法重现您的问题。 40个文件下载没有任何问题。我在下面包含了我的常春藤示例供参考。

    [ivy:resolve] :: resolution report :: resolve 54551ms :: artifacts dl 25244ms
        ---------------------------------------------------------------------
        |                  |            modules            ||   artifacts   |
        |       conf       | number| search|dwnlded|evicted|| number|dwnlded|
        ---------------------------------------------------------------------
        |      compile     |   40  |   40  |   40  |   0   ||   40  |   40  |
        |      runtime     |   40  |   40  |   40  |   0   ||   39  |   39  |
        |       test       |   40  |   40  |   40  |   0   ||   39  |   39  |
        ---------------------------------------------------------------------
    

    示例

    ivy.xml

    <ivy-module version="2.0">
        <info organisation="com.myspotontheweb" module="demo"/>
    
        <configurations>
            <conf name="compile" description="Required to compile application"/>
            <conf name="runtime" description="Additional run-time dependencies" extends="compile"/>
            <conf name="test"    description="Required for test only" extends="runtime"/>
        </configurations>
    
        <dependencies>
            <!-- compile dependencies -->
            <dependency org="org.glassfish.jersey.ext" name="jersey-spring3" rev="2.7" conf="compile->default"/>
    
            <!-- runtime dependencies -->
    
            <!-- test dependencies -->
        </dependencies>
    
    </ivy-module>
    

    build.xml

    <project name="demo" default="resolve" xmlns:ivy="antlib:org.apache.ivy.ant">
    
        <!--
        ================
        Build properties
        ================
        -->
        <property name="build.dir" location="build"/>
    
        <available classname="org.apache.ivy.Main" property="ivy.installed"/> 
    
        <!--
        ===========
        Build targets
        ===========
        -->
        <target name="install-ivy" description="Install ivy" unless="ivy.installed">
            <mkdir dir="${user.home}/.ant/lib"/>
            <get dest="${user.home}/.ant/lib/ivy.jar" src="http://search.maven.org/remotecontent?filepath=org/apache/ivy/ivy/2.3.0/ivy-2.3.0.jar"/>
            <fail message="Ivy has been installed. Run the build again"/>
        </target>
    
        <target name="resolve" depends="install-ivy" description="Use ivy to resolve classpaths">
            <ivy:resolve/>
    
            <ivy:report todir='${build.dir}/ivy' graph='false' xml='false'/>
    
            <ivy:cachepath pathid="compile.path" conf="compile"/>
            <ivy:cachepath pathid="test.path"    conf="test"/>
        </target>
    
        <target name="clean" description="Cleanup build files">
            <delete dir="${build.dir}"/>
        </target>
    
        <target name="clean-all" depends="clean" description="Additionally purge ivy cache">
            <ivy:cleancache/>
        </target>
    
    </project>
    

    【讨论】:

      猜你喜欢
      • 2021-01-16
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-08-28
      • 2014-02-12
      • 2011-10-04
      相关资源
      最近更新 更多