2016-04-24 121 views
0

我目前正在苦苦掙扎與Apache ivy的conf設置。也許我會解釋 什麼我首先要做到:常春藤conf奮鬥

  1. 我想兩種配置:編譯,運行
  2. 我要爲常春藤做出決議每個配置中,所有罐包括傳遞依賴

這裏的東西我想:

<configurations> 
    <conf name="compile" visibility="public"/> 
    <conf name="runtime" visibility="public" extends="compile"/> 
</configurations> 
<dependencies> 
    <dependency org="org.apache.ivy" name="ivy" rev="2.4.0" conf="runtime->runtime, compile->compile"/> 
</dependencies> 

但它甚至不能被解析: ivy文件「... \的ivy.xml」合作uld不會被解析:

可以請別人告訴我如何正確地聲明conf設置,以便我可以使用編譯或運行時解析並獲取所有jar包括傳遞依賴項(在示例中只有常春藤罐子)。

更新

好,感謝的鏈接。這使得它更清晰一些,但我仍然陷入困境。

我改變了依賴聲明,以便它解決的範圍「默認」常春藤罐子: (我離開了「編譯期>默認」聲明,因爲它似乎有一個在 解析常春藤Eclipse插件的一個bug )

<dependency org="org.apache.ivy" name="ivy" rev="2.4.0" conf="runtime->default"/> 

和檢索與設置 confs='*' and types='*'罐子(使用常春藤Eclipse插件)。

我得到的只是一個ivy-2.4.0.jar。我期望所有的運行時依賴。我不能確切地告訴他們的,我不明白,像常春藤的XML文件的聲明(整個XML文件後附):

<dependency org="org.apache.ant" name="ant" rev="1.7.1" force="true" conf="optional->compile(*),master(*)"/> 

這就是我所理解的CONF =「runtime- >默認的」聲明:

  • 常春藤依賴被分配到(當地)的conf‘運行’
  • 常春藤依賴被分配到偏遠的conf‘默認’
  • 每當我解決(或檢索)的conf'runtime'的依賴關係我 讓所有的遠程依賴性包括的conf「默認」的傳遞依賴 的,爲「默認」的conf聲明爲

    「遠程模塊的神器和所有它的運行時間傳遞依賴」 link

這裏是我的ivy.xml:

<?xml version="1.0" encoding="ISO-8859-1"?> 
<ivy-module version="2.0" 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xsi:noNamespaceSchemaLocation="http://ant.apache.org/ivy/schemas/ivy.xsd"> 
    <info organisation="My Name" module="jaculon.ivy" status="integration"> 
    </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="public" 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> 
    <dependencies> 
     <!-- Need ivy to resolve the jars. --> 
     <dependency org="org.apache.ivy" name="ivy" rev="2.4.0" conf="runtime->default"/> 
    </dependencies> 

</ivy-module> 

這裏的內容常春藤2.4.0.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.ivy" 
     module="ivy" 
     revision="2.4.0" 
     status="release" 
     publication="20141222174010" 
    > 
     <description homepage="http://ant.apache.org/ivy/" /> 
     <m:properties__project.build.sourceEncoding>UTF-8</m:properties__project.build.sourceEncoding> 
     <m:properties__organization.logo>http://www.apache.org/images/asf_logo_wide.gif</m:properties__organization.logo> 
     <m:properties__distMgmtSnapshotsName>Apache Development Snapshot Repository</m:properties__distMgmtSnapshotsName> 
     <m:properties__distMgmtSnapshotsUrl>https://repository.apache.org/content/repositories/snapshots</m:properties__distMgmtSnapshotsUrl> 
     <m:maven.plugins>org.apache.maven.plugins__maven-remote-resources-plugin__null|org.apache.maven.plugins__maven-remote-resources-plugin__null</m:maven.plugins> 
     <m:properties__sourceReleaseAssemblyDescriptor>source-release</m:properties__sourceReleaseAssemblyDescriptor> 
    </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> 
     <artifact name="ivy" type="jar" ext="jar" conf="master"/> 
     <artifact name="ivy" type="source" ext="jar" conf="sources" m:classifier="sources"/> 
     <artifact name="ivy" type="javadoc" ext="jar" conf="javadoc" m:classifier="javadoc"/> 
    </publications> 
    <dependencies> 
     <dependency org="org.apache.ant" name="ant" rev="1.7.1" force="true" conf="optional->compile(*),master(*)"/> 
     <dependency org="org.apache.ant" name="ant-nodeps" rev="1.7.1" force="true" conf="optional->compile(*),master(*)"/> 
     <dependency org="org.apache.ant" name="ant-trax" rev="1.7.1" force="true" conf="optional->compile(*),master(*)"/> 
     <dependency org="commons-httpclient" name="commons-httpclient" rev="3.0" force="true" conf="optional->compile(*),master(*)"/> 
     <dependency org="oro" name="oro" rev="2.0.8" force="true" conf="optional->compile(*),master(*)"/> 
     <dependency org="commons-vfs" name="commons-vfs" rev="1.0" force="true" conf="optional->compile(*),master(*)"/> 
     <dependency org="com.jcraft" name="jsch" rev="0.1.50" force="true" conf="optional->compile(*),master(*)"/> 
     <dependency org="com.jcraft" name="jsch.agentproxy" rev="0.0.6" force="true" conf="optional->compile(*),master(*)"/> 
     <dependency org="com.jcraft" name="jsch.agentproxy.connector-factory" rev="0.0.6" force="true" conf="optional->compile(*),master(*)"/> 
     <dependency org="com.jcraft" name="jsch.agentproxy.jsch" rev="0.0.6" force="true" conf="optional->compile(*),master(*)"/> 
     <dependency org="org.bouncycastle" name="bcpg-jdk14" rev="1.45" force="true" conf="optional->compile(*),master(*)"/> 
     <dependency org="org.bouncycastle" name="bcprov-jdk14" rev="1.45" force="true" conf="optional->compile(*),master(*)"/> 
     <dependency org="junit" name="junit" rev="3.8.2" force="true" conf="test->runtime(*),master(*)"/> 
     <dependency org="commons-lang" name="commons-lang" rev="2.6" force="true" conf="test->runtime(*),master(*)"/> 
     <dependency org="org.apache.ant" name="ant-testutil" rev="1.7.0" force="true" conf="test->runtime(*),master(*)"> 
      <exclude org="*" module="*" name="*" type="*" ext="*" conf="" matcher="exact"/> 
     </dependency> 
     <dependency org="ant" name="ant-launcher" rev="1.6.2" force="true" conf="test->runtime(*),master(*)"> 
      <exclude org="*" module="*" name="*" type="*" ext="*" conf="" matcher="exact"/> 
     </dependency> 
     <dependency org="ant-contrib" name="ant-contrib" rev="1.0b3" force="true" conf="test->runtime(*),master(*)"> 
      <exclude org="*" module="*" name="*" type="*" ext="*" conf="" matcher="exact"/> 
     </dependency> 
     <dependency org="xerces" name="xercesImpl" rev="2.6.2" force="true" conf="test->runtime(*),master(*)"/> 
     <dependency org="xerces" name="xmlParserAPIs" rev="2.6.2" force="true" conf="test->runtime(*),master(*)"/> 
    </dependencies> 
</ivy-module> 
+0

能否請您發表你的整個ivy.xml? – cantSleepNow

回答