1

Apache Ivyを使用して、Javaのプロジェクト内のいくつかの依存関係(インポート)を解決したいと思います。NetBeans 7.1.2(Java EEバージョン)を使用しています。IvyBeansプラグイン(バージョン1.2)をインストールしました。次に、プロジェクトをビルドし、Ivyがプロジェクトフォルダー内にIvyFilesフォルダーとIvyLibrariesフォルダーを作成しました(どちらも空です)。問題は、ライブラリが解決されないことです。ビルダーから次のメッセージを受け取ります。

[PATH_TO_PROJECT]\nbproject\ivy-impl.xml:92: settings file does not exist: [PATH_TO_PROJECT]\${ivy.settings.location}

これはivy-resolveの出力です:

Resolving COMPILE scope ...
:: loading settings :: url = jar:file:/C:/Users/jakub/.netbeans/7.1.2/modules/ext/ivy-2.1.0.jar!/org/apache/ivy/core/settings/ivysettings.xml
:: resolving dependencies :: IvyThriftApp#IvyThriftApp;1.0
    confs: [compile]
:: resolution report :: resolve 6ms :: artifacts dl 0ms
    ---------------------------------------------------------------------
    |                  |            modules            ||   artifacts   |
    |       conf       | number| search|dwnlded|evicted|| number|dwnlded|
    ---------------------------------------------------------------------
    |      compile     |   0   |   0   |   0   |   0   ||   0   |   0   |
    ---------------------------------------------------------------------
Resolving PROCESSOR scope ...
:: loading settings :: url = jar:file:/C:/Users/jakub/.netbeans/7.1.2/modules/ext/ivy-2.1.0.jar!/org/apache/ivy/core/settings/ivysettings.xml
:: resolving dependencies :: IvyThriftApp#IvyThriftApp;1.0
    confs: [compile]
:: resolution report :: resolve 3ms :: artifacts dl 0ms
    ---------------------------------------------------------------------
    |                  |            modules            ||   artifacts   |
    |       conf       | number| search|dwnlded|evicted|| number|dwnlded|
    ---------------------------------------------------------------------
    |      compile     |   0   |   0   |   0   |   0   ||   0   |   0   |
    ---------------------------------------------------------------------
Resolving RUNTIME scope ...
:: loading settings :: url = jar:file:/C:/Users/jakub/.netbeans/7.1.2/modules/ext/ivy-2.1.0.jar!/org/apache/ivy/core/settings/ivysettings.xml
:: resolving dependencies :: IvyThriftApp#IvyThriftApp;1.0
    confs: [compile, runtime]
:: resolution report :: resolve 3ms :: artifacts dl 0ms
    ---------------------------------------------------------------------
    |                  |            modules            ||   artifacts   |
    |       conf       | number| search|dwnlded|evicted|| number|dwnlded|
    ---------------------------------------------------------------------
    |      compile     |   0   |   0   |   0   |   0   ||   0   |   0   |
    |      runtime     |   0   |   0   |   0   |   0   ||   0   |   0   |
    ---------------------------------------------------------------------
Resolving COMPILE_TEST scope ...
:: loading settings :: url = jar:file:/C:/Users/jakub/.netbeans/7.1.2/modules/ext/ivy-2.1.0.jar!/org/apache/ivy/core/settings/ivysettings.xml
:: resolving dependencies :: IvyThriftApp#IvyThriftApp;1.0
    confs: [compile, compile-test]
:: resolution report :: resolve 4ms :: artifacts dl 0ms
    ---------------------------------------------------------------------
    |                  |            modules            ||   artifacts   |
    |       conf       | number| search|dwnlded|evicted|| number|dwnlded|
    ---------------------------------------------------------------------
    |      compile     |   0   |   0   |   0   |   0   ||   0   |   0   |
    |   compile-test   |   0   |   0   |   0   |   0   ||   0   |   0   |
    ---------------------------------------------------------------------
Resolving RUNTIME_TEST scope ...
:: loading settings :: url = jar:file:/C:/Users/jakub/.netbeans/7.1.2/modules/ext/ivy-2.1.0.jar!/org/apache/ivy/core/settings/ivysettings.xml
:: resolving dependencies :: IvyThriftApp#IvyThriftApp;1.0
    confs: [compile, compile-test, runtime, runtime-test]
:: resolution report :: resolve 4ms :: artifacts dl 0ms
    ---------------------------------------------------------------------
    |                  |            modules            ||   artifacts   |
    |       conf       | number| search|dwnlded|evicted|| number|dwnlded|
    ---------------------------------------------------------------------
    |      compile     |   0   |   0   |   0   |   0   ||   0   |   0   |
    |   compile-test   |   0   |   0   |   0   |   0   ||   0   |   0   |
    |      runtime     |   0   |   0   |   0   |   0   ||   0   |   0   |
    |   runtime-test   |   0   |   0   |   0   |   0   ||   0   |   0   |
    ---------------------------------------------------------------------

Apache IvyがNetBeansの下でどのように機能するか、またはまったく誤解されているのでしょうか。私のビジョンは、プロジェクト内でいくつかの依存関係を使用することでした。次に、それをビルドすると、Ivyはインターネットから依存関係を自動的に取得し、プロジェクトにすべての外部ライブラリを追加する必要はありません。

この問題を解決する方法について何か提案はありますか?

ヘルプや推奨事項をありがとうございました:)

4

1 に答える 1

1

ツタの解決は正常に機能しているようです。ビルドファイル内で、解決されたjarを使用してANTプロジェクトのクラスパスにデータを入力する方法を教えてください。

一般的なオプションの1つは、ivyの取得タスクを呼び出してローカルのlibディレクトリにデータを入力することです。

   <ivy:retrieve/>
   <path id="build.path">
      <fileset dir="lib" includes="**/*.jar"/>
   </path>

私の好みと推奨事項は、ivyのキャッシュパスタスクを使用することです

   <ivy:cachepath pathid="build.path"/>

より完全な例(ツタの構成を使用)を次に示します。

クラスパスの複数のバージョンから選択するAntスクリプト

于 2012-06-05T18:24:54.440 に答える