我在使用Apache Ivy和Eclipse(IvyDE)並試圖解決以下問題。 我有兩個項目,IvyParent和IvyChild,孩子依賴父母。我爲Eclipse Ivy Classpath Container選擇了「解決工作區中的依賴關係」的選項。在構建期間使用Eclipse工作區解決Apache Ivy的依賴關係
Eclipse autobuilder工作得很好 - 我得到了我所有的常春藤依賴下載和包括。 我打開了父項目和子項目,我可以對父項目進行實時編輯,並查看子項目中的編輯更改。
問題是當我嘗試使用Ant將子項目構建到jar中時。我的問題是,如何在顯式Ant構建期間利用Workspace解析器?
我已經看過Ivy文件系統解析器,但是我想避免的是必須在Ant構建子項之前顯式重建父項目。
我得到的錯誤是:
[ivy:retrieve] :: problems summary ::
[ivy:retrieve] :::: WARNINGS
[ivy:retrieve] module not found: org.example#ParentModule;latest.integration
[ivy:retrieve] ==== local: tried
[ivy:retrieve] ...
[ivy:retrieve] ==== shared: tried
[ivy:retrieve] ...
[ivy:retrieve] ==== public: tried
[ivy:retrieve] ...
[ivy:retrieve] ::::::::::::::::::::::::::::::::::::::::::::::
[ivy:retrieve] :: UNRESOLVED DEPENDENCIES ::
[ivy:retrieve] ::::::::::::::::::::::::::::::::::::::::::::::
[ivy:retrieve] :: org.example#ParentModule;latest.integration: not found
[ivy:retrieve] ::::::::::::::::::::::::::::::::::::::::::::::
BUILD FAILED
C:\Users\user\workspace\IvyExampleChild\build.xml:15: impossible to resolve dependencies:
resolve failed - see output for details
這裏是父項目的ivy.xml:
<?xml version="1.0" encoding="ISO-8859-1"?>
<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="org.example" module="ParentModule" status="integration" />
<dependencies>
<dependency org="commons-lang" name="commons-lang" rev="2.6"/>
</dependencies>
</ivy-module>
這裏是孩子項目的ivy.xml:
<?xml version="1.0" encoding="ISO-8859-1"?>
<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="org.example" module="ChildModule" status="integration" />
<dependencies>
<dependency org="org.example" name="ParentModule" rev="latest.integration"/>
</dependencies>
</ivy-module>
以下是child build.xml:
<project xmlns:ivy="antlib:org.apache.ivy.ant" name="ChildModule" default="release">
<property name="build.dir" value="build" />
<property name="build.dir.classes" value="${build.dir}/classes" />
<property name="src.dir" value="src" />
<property name="output.jar" value="${build.dir}/${ant.project.name}.jar" />
<target name="clean">
<delete includeemptydirs="true" quiet="true">
<fileset dir="${build.dir}" />
</delete>
</target>
<target name="apache-ivy" depends="clean">
<ivy:retrieve />
<ivy:cachepath pathid="ivy.build.path" conf="default" />
</target>
<target name="release" depends="apache-ivy">
<echo message="compiling ${src.dir}..." />
<mkdir dir="${build.dir}" />
<mkdir dir="${build.dir.classes}" />
<javac srcdir="${src.dir}" destdir="${build.dir.classes}" classpathref="ivy.build.path"/>
<jar destfile="${output.jar}" basedir="${build.dir}"/>
</target>
</project>