ショートanwerはツタ構成を使用することである。
http://ant.apache.org/ivy/history/latest-milestone/tutorial/conf.html
アイビー構成が異なる目的のためにグループの依存関係を使用することができます。複数のivyファイルは必要ありません。
例
は、ここに私の決意目標です:
その後、クラスパス
<!-- Compiling code -->
<javac srcdir="${src.dir}"... classpathref="compile.path"/>
<!-- Testing code -->
<junit haltonfailure="yes" fork="true">
<classpath>
<path refid="test.path"/>
<pathelement path="${classes.dir}"/>
<pathelement path="${test.classes.dir}"/>
</classpath>
..
</junit>
<!-- 3rd party ANT tasks -->
<taskdef uri="antlib:org.jacoco.ant" resource="org/jacoco/ant/antlib.xml" classpathref="build.path"/>
<taskdef uri="antlib:org.sonar.ant" resource="org/sonar/ant/antlib.xml" classpathref="build.path"/>
..
個人的に私だけに検索タスクを使用する必要が私のさまざまなタスクに直接使用することができ
<target name="resolve" description="Download dependencies and setup classpaths">
<ivy:resolve/>
<ivy:report todir='${reports.dir}/ivy' graph='false' xml='false'/>
<ivy:cachepath pathid="compile.path" conf="compile"/>
<ivy:cachepath pathid="test.path" conf="test"/>
<ivy:cachepath pathid="build.path" conf="build"/>
</target>
アーカイブを構築する。希望の構成は先頭で宣言されている
<ivy:retrieve pattern="${build.dir}/libs/[artifact].[ext]" conf="runtime"/>
<war destfile="${war.file}" webxml="${resources.dir}/web.xml">
<fileset dir="${resources.dir}" excludes="web.xml"/>
<classes dir="${build.dir}/classes"/>
<lib dir="${build.dir}/libs"/>
</war>
IVYファイル
<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"/>
<conf name="build" description="ANT task dependencies"/>
</configurations>
<dependencies>
<!-- compile dependencies -->
<dependency org="org.slf4j" name="slf4j-api" rev="1.7.5" conf="compile->default"/>
<!-- runtime dependencies -->
<dependency org="org.slf4j" name="slf4j-log4j12" rev="1.7.5" conf="runtime->default"/>
<!-- test dependencies -->
<dependency org="junit" name="junit" rev="4.11" conf="test->default"/>
<!-- Build dependencies -->
<dependency org="org.codehaus.sonar-plugins" name="sonar-ant-task" rev="2.1" conf="build->default"/>
<dependency org="org.jacoco" name="org.jacoco.ant" rev="0.6.3.201306030806" conf="build->default"/>
</dependencies>
</ivy-module>
:ここでも欲しい商品が瓶制御するために、コンフィギュレーションを使用しています。どのように設定された操作に注意してください。たとえば、 "コンパイル"依存関係は自動的に "ランタイム"と "テスト"の一部です。
第二の構成マッピングされている重要:
- myconf->デフォルト:推移的依存関係が含まれています
- myconf->マスター:ちょうどモジュールのjar依存関係
Upvoted:ようなものが含まれています。しかし、私は異なる構成を採用する可能性を認識していました。あなたのソリューションで、あなたがする視覚的に検査しているのに対し、私は、特に私が好きなように複数のプロジェクトで同じ「ANTタスクの依存関係」を持っている別のIVYファイルを尋ねると、別IVYファイルを持つことは容易では(差分あるいはシンボリックリンクを使用して)チェックすることになりました"ANTタスクの依存関係"が本当に同じであることを自分自身で満足させるためのファイル(もちろんあなたにとって重要です)。私はそれを達成したと信じていますが、私自身の回答を投稿するまでは素晴らしい答えであるので、私はあなたの答えを受け入れてうれしく思います。 –
ちなみに、実際にインクルードされるjarファイルは少し不透明なので、 'ivy:cachepath'を使うのは嫌です。私は 'ツタを使用します。私は、ファイルシステム上のディレクトリを調べることができるようとして持って来られたすべてのjarファイルを見ることが好きなようにしても「ANTタスクの依存関係」をretrieve''ツタ:。cachepath'は限りそのようなvisibillityを提供していません私は承知しています。 –
@MarcusJuniusBrutus私の "解決"ターゲットがivyの "report"タスクを使って、各設定のjarの詳細レポートを生成する方法に注目してください。 –