我试图给一个常春藤项目添加一个依赖项。maven中的依赖关系如下:
<dependency>
<groupId>org.glassfish.jersey.ext</groupId>
<artifactId>jersey-spring3</artifactId>
<version>2.7</version>
</dependency>
我已将其添加到常春藤.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
::::::::::::::::::::::::::::::::::::::::::::::
这是jersey-spring3 pom文件。我认为问题是因为pom文件中的父标记。这是因为hk2.version是在jar的父pom中定义的。
Ivy在pom文件中不支持此功能吗?有什么方法可以解决此问题,而无需将传递依赖项添加到主ivy.xml?谢谢。
无法重现您的问题。下载了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-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>
<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>