【问题标题】:Apache Ivy inside NetBeans to resolve importsNetBeans 中的 Apache Ivy 解决导入问题
【发布时间】:2012-06-08 23:12:10
【问题描述】:

我想使用 Apache Ivy 来解决我的 Java 项目中的一些依赖项(导入)。我正在使用 NetBeans 7.1.2(Java EE 版本)。我已经安装了 IvyBeans 插件(1.2 版)。然后我构建了我的项目,Ivy 在我的项目文件夹中创建了 IvyFiles 和 IvyLibraries 文件夹(它们都是空的)。 问题是没有解决任何库。我从 builder 获得以下消息:

[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 会自动从 Internet 获取依赖项,我不必关心将所有外部库添加到我的项目中。

任何建议如何解决这个问题?

非常感谢您的帮助或任何建议:)

【问题讨论】:

    标签: java apache netbeans dependencies ivy


    【解决方案1】:

    看起来你的常春藤决心工作正常。在您的构建文件中,如何使用已解析的 jar 来填充您的 ANT 项目的类路径?

    一种流行的选择是调用 ivy retrieve 任务来填充本地 lib 目录:

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

    我的偏好和建议是使用ivy的cachepath任务:

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

    这里给出了一个更完整的示例(使用 ivy 配置):

    Ant script to choose between multiple version of classpaths

    【讨论】:

      猜你喜欢
      • 2011-11-13
      • 2019-05-27
      • 2010-10-28
      • 1970-01-01
      • 2017-12-15
      • 2019-06-05
      • 2015-05-27
      • 1970-01-01
      • 2023-03-13
      相关资源
      最近更新 更多