为什么常春藤不下载源代码?

时间:2013-02-26 23:21:44

标签: ivy

我按照here的指示行事。我没有找到我能找到的源代码。

的ivy.xml:

<ivy-module version="2.0">
<info organisation="com.example" module="test"/>
<dependencies defaultconfmapping="*->default,sources">
  <dependency org="org.apache.hadoop" name="hadoop-core" rev="1.0.3"/>      
</dependencies>
</ivy-module>

输出:

$ ivy
:: loading settings :: url = jar:file:/usr/local/Cellar/ivy/2.3.0-rc1/libexec/ivy-2.3.0-rc1.jar!/org/apache/ivy/core/settings/ivysettings.xml
:: resolving dependencies :: com.example#test;working@foo.local
    confs: [default]
    found org.apache.hadoop#hadoop-core;1.0.3 in public
    found commons-cli#commons-cli;1.2 in public
    found xmlenc#xmlenc;0.52 in public
    found commons-httpclient#commons-httpclient;3.0.1 in public
    found junit#junit;3.8.1 in public
    found commons-logging#commons-logging;1.0.3 in public
    found commons-codec#commons-codec;1.4 in public
    found org.apache.commons#commons-math;2.1 in public
    found commons-configuration#commons-configuration;1.6 in public
    found commons-collections#commons-collections;3.2.1 in public
    found commons-lang#commons-lang;2.4 in public
    found commons-logging#commons-logging;1.1.1 in public
    found commons-digester#commons-digester;1.8 in public
    found commons-beanutils#commons-beanutils;1.7.0 in public
    found commons-beanutils#commons-beanutils-core;1.8.0 in public
    found commons-net#commons-net;1.4.1 in public
    found oro#oro;2.0.8 in public
    found org.mortbay.jetty#jetty;6.1.26 in public
    found org.mortbay.jetty#jetty-util;6.1.26 in public
    found org.mortbay.jetty#servlet-api;2.5-20081211 in public
    found tomcat#jasper-runtime;5.5.12 in public
    found tomcat#jasper-compiler;5.5.12 in public
    found org.mortbay.jetty#jsp-api-2.1;6.1.14 in public
    found org.mortbay.jetty#servlet-api-2.5;6.1.14 in public
    found org.mortbay.jetty#jsp-2.1;6.1.14 in public
    found org.eclipse.jdt#core;3.1.1 in public
    found ant#ant;1.6.5 in public
    found commons-el#commons-el;1.0 in public
    found net.java.dev.jets3t#jets3t;0.7.1 in public
    found net.sf.kosmosfs#kfs;0.3 in public
    found hsqldb#hsqldb;1.8.0.10 in public
    found org.codehaus.jackson#jackson-mapper-asl;1.0.1 in public
    found org.codehaus.jackson#jackson-core-asl;1.0.1 in public
downloading http://repo1.maven.org/maven2/commons-codec/commons-codec/1.4/commons-codec-1.4.jar ...
.................. (56kB)
.. (0kB)
    [SUCCESSFUL ] commons-codec#commons-codec;1.4!commons-codec.jar (70ms)
downloading http://repo1.maven.org/maven2/org/codehaus/jackson/jackson-mapper-asl/1.0.1/jackson-mapper-asl-1.0.1.jar ...
.................................................................................................. (264kB)
.. (0kB)
    [SUCCESSFUL ] org.codehaus.jackson#jackson-mapper-asl;1.0.1!jackson-mapper-asl.jar (466ms)
downloading http://repo1.maven.org/maven2/junit/junit/3.8.1/junit-3.8.1.jar ...
.......................................................... (118kB)
.. (0kB)
    [SUCCESSFUL ] junit#junit;3.8.1!junit.jar (130ms)
downloading http://repo1.maven.org/maven2/commons-lang/commons-lang/2.4/commons-lang-2.4.jar ...
...................................................................................................................................... (255kB)
.. (0kB)
    [SUCCESSFUL ] commons-lang#commons-lang;2.4!commons-lang.jar (302ms)
downloading http://repo1.maven.org/maven2/org/codehaus/jackson/jackson-core-asl/1.0.1/jackson-core-asl-1.0.1.jar ...
...................................................................... (132kB)
.. (0kB)
    [SUCCESSFUL ] org.codehaus.jackson#jackson-core-asl;1.0.1!jackson-core-asl.jar (110ms)
:: resolution report :: resolve 1647ms :: artifacts dl 1135ms
    :: evicted modules:
    commons-logging#commons-logging;1.0.3 by [commons-logging#commons-logging;1.1.1] in [default]
    commons-codec#commons-codec;1.2 by [commons-codec#commons-codec;1.4] in [default]
    commons-logging#commons-logging;1.1 by [commons-logging#commons-logging;1.1.1] in [default]
    commons-codec#commons-codec;1.3 by [commons-codec#commons-codec;1.4] in [default]
    commons-httpclient#commons-httpclient;3.1 by [commons-httpclient#commons-httpclient;3.0.1] in [default]

This blog post说要检查配置是否有来源。这个配置似乎表明来源是可能的,虽然我很难说:

$ cat ~/.ivy2/cache/org.apache.commons/commons-parent/ivy-11.xml
<?xml version="1.0" encoding="UTF-8"?>
<ivy-module version="2.0" xmlns:m="http://ant.apache.org/ivy/maven">
    <info organisation="org.apache.commons"
        module="commons-parent"
        revision="11"
        status="release"
        publication="20080721065829"
    >
        <description homepage="http://commons.apache.org/" />
        <m:properties__commons.binary.suffix>-bin</m:properties__commons.binary.suffix>
        <m:properties__organization.logo>http://www.apache.org/images/asf_logo_wide.gif</m:properties__organization.logo>
        <m:properties__commons.osgi.symbolicName>org.apache.commons.${commons.componentid}</m:properties__commons.osgi.symbolicName>
        <m:properties__commons.rc.version>RC1</m:properties__commons.rc.version>
        <m:properties__commons.docEncoding>${commons.encoding}</m:properties__commons.docEncoding>
        <m:properties__commons.osgi.export>org.apache.commons.*;version=${pom.version}</m:properties__commons.osgi.export>
        <m:properties__commons.componentid>${project.artifactId}</m:properties__commons.componentid>
        <m:properties__maven.compile.target>1.3</m:properties__maven.compile.target>
        <m:properties__commons.deployment.protocol>scp</m:properties__commons.deployment.protocol>
        <m:properties__maven.compile.source>1.3</m:properties__maven.compile.source>
        <m:properties__commons.encoding>iso-8859-1</m:properties__commons.encoding>
        <m:properties__commons.osgi.import>*</m:properties__commons.osgi.import>
        <m:properties__commons.release.name>${project.artifactId}-${commons.release.version}</m:properties__commons.release.name>
        <m:maven.plugins>null__maven-compiler-plugin__null|null__maven-jar-plugin__null|org.apache.felix__maven-bundle-plugin__null|null__maven-idea-plugin__null|org.apache.maven.plugins__maven-antrun-plugin__null|org.apache.commons__commons-build-plugin__null</m:maven.plugins>
        <m:properties__commons.manifestfile>target/osgi/MANIFEST.MF</m:properties__commons.manifestfile>
    </info>
    <configurations>
        <conf name="default" visibility="public" description="runtime dependencies and master artifact can be used with this conf" extends="runtime,master"/>
        <conf name="master" visibility="public" description="contains only the artifact published by this module itself, with no transitive dependencies"/>
        <conf name="compile" visibility="public" description="this is the default scope, used if none is specified. Compile dependencies are available in all classpaths."/>
        <conf name="provided" visibility="public" description="this is much like compile, but indicates you expect the JDK or a container to provide it. It is only available on the compilation classpath, and is not transitive."/>
        <conf name="runtime" visibility="public" description="this scope indicates that the dependency is not required for compilation, but is for execution. It is in the runtime and test classpaths, but not the compile classpath." extends="compile"/>
        <conf name="test" visibility="private" description="this scope indicates that the dependency is not required for normal use of the application, and is only available for the test compilation and execution phases." extends="runtime"/>
        <conf name="system" visibility="public" description="this scope is similar to provided except that you have to provide the JAR which contains it explicitly. The artifact is always available and is not looked up in a repository."/>
        <conf name="sources" visibility="public" description="this configuration contains the source artifact of this module, if any."/>
        <conf name="javadoc" visibility="public" description="this configuration contains the javadoc artifact of this module, if any."/>
        <conf name="optional" visibility="public" description="contains all optional dependencies"/>
    </configurations>
    <publications>
    </publications>
</ivy-module>

1 个答案:

答案 0 :(得分:3)

该版本的Hadoop在Maven Central中没有源工件:

无法下载不存在的内容: - )

实施例

为了将来自己看到这个,我建议在常春藤和生成和常春藤依赖管理报告中使用configuraitons。

与此示例相关联的报告显示作为“sources”配置的一部分下载的零工件。

的build.xml

<project name="demo" default="retrieve" xmlns:ivy="antlib:org.apache.ivy.ant">

    <target name="resolve">
        <ivy:resolve/>
        <ivy:report todir="build/ivy"/>
    </target>

    <target name="retrieve" depends="resolve">
        <ivy:retrieve pattern="build/lib/[conf]/[artifact].[ext]"/>
    </target>

</project>

注意:

  • 报告任务将为常春藤文件中创建的每个配置生成HTML报告
  • 检索任务用于将文件放在项目结构中的某个位置。

的ivy.xml

<ivy-module version="2.0">
    <info organisation="com.myspotontheweb" module="demo"/>

    <configurations>
        <conf name="compile" description="Required to compile application"/>
        <conf name="sources" description="Source code"/>
    </configurations>

    <dependencies>
        <dependency org="org.apache.hadoop" name="hadoop-core" rev="1.0.3" conf="compile->default;sources"/>      
    </dependencies>

</ivy-module>

注意:

  • 这里我宣布了两种配置(或罐子的逻辑组)
  • 两个映射:“compile” - &gt;“default”和“sources” - &gt;“sources”
  • 常春藤“检索”任务是配置意识,这意味着您可以将工件放在不同的目录中