在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
最佳答案
我已经找到解决方法了。
首先,我更改了 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>
如您所见,我没有使用 organization="FS"
在自己的文件系统中解析它们。然后,我使用 organization
变量作为存储文件夹名称的容器。
最后,我得到的是干净的项目层次结构。
关于java - 如何将文件夹的 url 提供给 ivy 模式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25521458/