如何给常春藤模式的文件夹的URL

时间:2014-08-27 07:39:36

标签: java ant ivy

在ivyconf.xml中,我有pattern='${ivy.settings.dir}/../../lib/Google Guava/[artifact].[ext]' />。如您所见,我在模式中写了Google Guava。但是,我有多个jar文件存储在Google Guava文件夹的同一级别的另一个文件夹中。

我已经尝试**代替Google Guava,但我认为ivyconf.xml不支持它。我应该写什么而不是Google Guava,以便它搜索所有文件夹以解决依赖关系?

ivyconf.xml

    <resolvers>
        <filesystem name="local">
            <artifact   
                    pattern='${ivy.settings.dir}/../../lib/Google Guava/[artifact].[ext]' />
        </filesystem>
    </resolvers>
    <modules>
        <module organisation='FS' resolver='local' />
    </modules>

项目结构

project
  | - - - src
          ...
  | - - - lib
           | - - Google Guava
                     | - - guava.jar
           | - - Folee
                     | - - folee-1.4.0.jar

1 个答案:

答案 0 :(得分:1)

我找到了解决方法。

首先,我更改了ivy.xml;

<dependencies>
    <dependency org="Google Guava"  name="guava"    rev="17.0"  
                conf="compile->default"/>       
    <dependency org="Folee" name="folee-1.4.0"  rev="1.4.0" 
                conf="compile->default"/>       
</dependencies>

然后,我更改了ivyconf.xml,如;

<conf   defaultresolver="local"/>
<resolvers>
        <filesystem name="local">
            <artifact   
                pattern="${ivy.settings.dir}/../../lib/[organisation]/[artifact].[ext]" />
        </filesystem>
</resolvers>
<modules>
    <module resolver="local" />
</modules>

如您所见,我没有使用organisation="FS"在自己的文件系统中解决它们。然后,我使用organisation变量作为存储文件夹名称的容器。

最后,我得到的是干净的项目层次结构。