【问题标题】:Skip Ivy resolve and download dependencies manually instead跳过 Ivy 解析并手动下载依赖项
【发布时间】:2016-10-02 10:06:44
【问题描述】:

我正在尝试安装 cassandra,但在解决某些依赖项时遇到了困难。有没有办法直接下载jar文件并跳过常春藤解析选项。

我不熟悉 Apache Ant 或 Apache Ivy。

这里描述了 Apache Ivy 设置:https://gist.github.com/nipunarora/5fa2c22770f575d81a0698644c5eeb02

Apache Ivy 在这里: https://gist.github.com/nipunarora/d24f15768ff13470c5eb55a4f356650a

cloudera 的一些依赖项无法解决。我可以从网上下载 jar 文件,所以我想跳过解析依赖项并手动下载它们。

【问题讨论】:

    标签: ant cassandra ivy


    【解决方案1】:

    手动管理依赖并不好玩……我不推荐它……

    您的问题似乎是 cloudera 已更改其存储库 URL。我发现了第二个问题,即缺少 hadoop 流式处理工件。我改为从 hadoop 项目中提取 jar。

    常春藤设置文件

    我建议使用另一种更简单的设置:

    <ivysettings>
      <settings defaultResolver="central"/>
      <resolvers>
        <ibiblio name="central" m2compatible="true" />
        <ibiblio name="cloudera" root="https://repository.cloudera.com/cloudera/repo" m2compatible="true" />
      </resolvers>
      <modules>
        <module organisation="com.cloudera.hadoop" resolver="cloudera" />
      </modules>
    </ivysettings>
    

    基本配置 ivy 以从 cloudera 存储库下载 cloudera 工件,以及从 Maven central 下载其他所有内容

    缺少 hadoop 流工件

    对 cloudera 存储库的搜索无法找到您想要的依赖项:

    我建议以下常春藤文件:

    <ivy-module version="2.0">
      <info organisation="apache-cassandra" module="cassandra"/>
    
      <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"/>
      </configurations>
    
      <dependencies>
        <!-- FIXME: paranamer can be dropped after we're depending on avro                                                        
        (since it depends on them). -->
        <dependency org="com.thoughtworks.paranamer" name="paranamer-ant" rev="2.1" conf="compile->default"/>
        <dependency org="junit" name="junit" rev="4.6"  conf="compile->default"/>
        <dependency org="commons-logging" name="commons-logging" rev="1.1.1" conf="compile->default"/>
        <dependency org="org.apache.rat" name="apache-rat" rev="0.6"  conf="compile->default"/>
        <dependency org="net.sf.jopt-simple" name="jopt-simple" rev="3.2" conf="compile->default"/>
        <dependency org="net.java.dev.jna" name="jna" rev="3.2.7" conf="compile->default"/>
    
        <dependency org="com.cloudera.hadoop" name="hadoop-core" rev="0.20.2-320" conf="compile->default"/>
        <dependency org="org.apache.hadoop" name="hadoop-streaming" rev="2.7.2" conf="compile->default"/>
      </dependencies>
    </ivy-module>
    

    注意:

    • 我包含了一个配置映射,以提供对依赖项的更多控制(良好的 ivy 习惯,类似于 Maven 中作用域的工作方式)。

    【讨论】:

    • 感谢您的详细回答。这对我帮助很大......几乎不需要自己弄清楚任何事情:)
    猜你喜欢
    • 2023-03-30
    • 2015-11-05
    • 2013-03-31
    • 2011-05-14
    • 2011-02-18
    • 2013-04-16
    • 2020-10-04
    • 2022-06-21
    • 2013-12-17
    相关资源
    最近更新 更多