Apache-ivy-install

提供:Dev Guides
移動先:案内検索

Apache IVY-インストールタスク

インストールタスクは、モジュールとその依存関係をリゾルバーにインストールするために使用されます。 パブリックアーティファクトをダウンロードしてプライベートリポジトリで使用する場合に使用します。 デフォルトでは、ユーザーローカルリポジトリはユーザーのプライベートリポジトリであり、$ \ {ivy.default.ivy.user.dir}/localにあります。

link:/apache_ivy/ivy_resolve [IVY-解決タスク]の章で説明されているように、Tester.java、build.xml、ivy.xmlを作成してみましょう。

ivyインストールタスクを使用するようにbuild.xmlを更新します。

*_build.xml_*
<project name="test" default="resolve" xmlns:ivy="antlib:org.apache.ivy.ant">
   <target name="resolve" description="resolve dependencies">
      <ivy:resolve/>
   </target>
   <target name="install" description="install dependencies">
      <ivy:install organisation="commons-lang" module="commons-lang"
         revision="2.6" transitive="true" overwrite="false"
         from="public" to="local"/>
   </target>
</project>

以下は重要な用語です。

  • 組織-組織の名前。
  • module -プロジェクトのモジュール名。
  • リビジョン-プロジェクトのバージョン。
  • from -リポジトリタイプから。
  • to -リポジトリタイプに。

プロジェクトを構築する

すべてのファイルの準備ができたので。 コンソールに行くだけです。 E:> ivy フォルダーに移動し、antコマンドを実行します。

E:\ivy > ant install

Ivyが動作し、依存関係を解決すると、次の結果が表示されます。

E:\ivy > ant install
Buildfile: E:\ivy\build.xml

install:
[ivy:install] :: Apache Ivy 2.5.0 - 20191020104435 :: https://ant.apache.org/ivy
/::
[ivy:install] :: loading settings :: url = jar:file:/E:/Apache/apache-ant-1.9.14
/lib/ivy-2.5.0.jar!/org/apache/ivy/core/settings/ivysettings.xml
[ivy:install] :: installing commons-lang#commons-lang;2.6 ::
[ivy:install] :: resolving dependencies ::
[ivy:install]   found commons-lang#commons-lang;2.6 in public
[ivy:install]   found junit#junit;3.8.1 in public
[ivy:install] :: downloading artifacts to cache ::
[ivy:install] :: installing in local ::
[ivy:install]   published commons-lang to C:\Users\Acer\.ivy2\local\commons-lang
\commons-lang\2.6.part\sources\commons-lang.jar
[ivy:install]   published commons-lang to C:\Users\Acer\.ivy2\local\commons-lang
\commons-lang\2.6.part\jars\commons-lang.jar
[ivy:install]   published commons-lang to C:\Users\Acer\.ivy2\local\commons-lang
\commons-lang\2.6.part\javadocs\commons-lang.jar
[ivy:install]   published ivy to C:\Users\Acer\.ivy2\local\commons-lang\commons-
lang\2.6.part\ivys\ivy.xml
[ivy:install]   publish committed: moved C:\Users\Acer\.ivy2\local\commons-lang\
commons-lang\2.6.part
[ivy:install]           to C:\Users\Acer\.ivy2\local\commons-lang\commons-lang\2
.6
[ivy:install]   published junit to C:\Users\Acer\.ivy2\local\junit\junit\3.8.1.p
art\jars\junit.jar
[ivy:install]   published ivy to C:\Users\Acer\.ivy2\local\junit\junit\3.8.1.par
t\ivys\ivy.xml
[ivy:install]   publish committed: moved C:\Users\Acer\.ivy2\local\junit\junit\3
.8.1.part
[ivy:install]           to C:\Users\Acer\.ivy2\local\junit\junit\3.8.1
[ivy:install] :: install resolution report ::
[ivy:install] :: resolution report :: resolve 0ms :: artifacts dl 21ms
      ---------------------------------------------------------------------
      |                  |            modules            ||   artifacts   |
      |       conf       | number| search|dwnlded|evicted|| number|dwnlded|
      ---------------------------------------------------------------------
      |      default     |   2   |   0   |   0   |   0   ||   4   |   0   |
      ---------------------------------------------------------------------

BUILD SUCCESSFUL
Total time: 43 seconds

ダウンロードしたファイルは、ivyキャッシュのデフォルトのローカルリポジトリの場所 $ \ {ivy.default.ivy.user.dir}> .ivy2> local ディレクトリで確認できます。