我一直在使用常春藤,但我似乎还有很多东西要学。常春藤解决不与动态神器合作
我有两个项目。一个是Web应用程序,另一个是Web应用程序依赖的库。设置是将库项目编译为jar文件并使用Ivy发布到项目中的目录。在Web应用程序构建文件中,我有一个调用Ivy解析ant任务的蚂蚁目标。
我想要做的是让Web应用程序在开发过程中(在开发人员的本地机器上)使用动态解析模式,并为测试和生产构建提供默认解析模式。之前,我在库存档文件中附加了一个时间戳记,以便Ivy在Web应用程序尝试解析其依赖关系时会注意到文件中的更改。在Eclipse中这很麻烦,因为在Web应用程序中,必须刷新项目并在每次发布新库jar时调整构建路径。我想,每次发布一个类似命名的jar文件只会要求开发人员刷新该项目。
问题是Web应用程序无法检索动态jar文件。
我得到的输出看起来是这样的:
resolve:
[ivy:configure] :: Ivy 2.1.0 - 20090925235825 :: http://ant.apache.org/ivy/ ::
[ivy:configure] :: loading settings :: file = /Users/richard/workspace/webapp/web/WEB-INF/config/ivy/ivysettings.xml
[ivy:resolve] :: resolving dependencies :: com.webapp#webapp;[email protected]
[ivy:resolve] confs: [default]
[ivy:resolve] found com.webapp#library;latest.integration in local
[ivy:resolve] :: resolution report :: resolve 142ms :: artifacts dl 0ms
---------------------------------------------------------------------
| | modules || artifacts |
| conf | number| search|dwnlded|evicted|| number|dwnlded|
---------------------------------------------------------------------
| default | 1 | 0 | 0 | 0 || 0 | 0 |
---------------------------------------------------------------------
[ivy:resolve]
[ivy:resolve] :: problems summary ::
[ivy:resolve] :::: WARNINGS
[ivy:resolve] ::::::::::::::::::::::::::::::::::::::::::::::
[ivy:resolve] :: UNRESOLVED DEPENDENCIES ::
[ivy:resolve] ::::::::::::::::::::::::::::::::::::::::::::::
[ivy:resolve] :: com.webapp#library;latest.integration: impossible to resolve dynamic revision
[ivy:resolve] ::::::::::::::::::::::::::::::::::::::::::::::
[ivy:resolve] :::: ERRORS
[ivy:resolve] impossible to resolve dynamic revision for com.webapp#library;latest.integration: check your configuration and make sure revision is part of your pattern
[ivy:resolve]
[ivy:resolve] :: USE VERBOSE OR DEBUG MESSAGE LEVEL FOR MORE DETAILS
BUILD FAILED
/Users/richard/workspace/webapp/build.xml:71: impossible to resolve dependencies:
resolve failed - see output for details
的Web应用程序解析目标看起来是这样的:
<target name="resolve" depends="load-ivy">
<ivy:configure file="${ivy.dir}/ivysettings.xml" />
<ivy:resolve
file="${ivy.dir}/ivy.xml"
resolveMode="${ivy.resolve.mode}"/>
<ivy:retrieve pattern="${lib.dir}/[artifact]-[revision].[ext]" type="jar" sync="true" />
</target>
在这种情况下,ivy.resolve.mode具有值“动态'(不含引号)。
Web应用程序的常青藤文件很简单。它看起来像这样:
<ivy-module version="2.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://ant.apache.org/ivy/schemas/ivy.xsd">
<info organisation="com.webapp" module="webapp"/>
<dependencies>
<dependency name="library" rev="${ivy.revision.default}" revConstraint="${ivy.revision.dynamic}" />
</dependencies>
</ivy-module>
在开发过程中,ivy.revision.dynamic的值为'latest.integration'。而在生产或测试期间,'ivy.revision.default'的值为'1.0'。
任何想法?请让我知道是否有任何更多信息需要提供。
谢谢!
谢谢,马克,但这仍然不能解决我的问题。我已经按照你的指示更改了依赖关系,在'default'和'dynamic'之间改变了webapp的解析目标中resolveMode的值,并且完全删除了它,并且仍然不会通过webapp“拾取”库jar的最新发布。做一些更多的研究使我想到: http://ant.apache.org/ivy/history/latest-milestone/concept.html#change 但是,在本地解析器上使用checkmodified也不起作用。我仍然不能正确理解某些东西。 – richever 2010-05-04 04:57:42
我也尝试添加changingPattern无效: 库jar被命名为libra-dev.jar。 –
richever
2010-05-04 06:40:24
你能用新的ivy输出更新你的文章吗?你也可以请包括你的ivysettings文件(如果你使用的话) – 2010-05-27 19:55:42