resolving javadoc files with Ant and Ivy

坚强是说给别人听的谎言 提交于 2019-12-05 06:38:34

The problem is the pattern you are using in the ivy retrieve task. It needs to include the optional "classifier" attribute to ensure the file name is unique:

<ivy:retrieve pattern="lib/[conf]/[artifact](-[classifier]).[ext]"/>

Classifier is a Maven thing, is used to identify additional artefacts associated with a Maven module.

Additional observation

No need for complicated ivy settings. Configuration mappings control which artefacts are downloaded from other modules.

Remove the ivysettings.xml file and try the following in your ivy.xml:

<dependency org="log4j" name="log4j" rev="1.2.16" conf="default->master,javadoc"/>

This results in the following files being downloaded:

  • log4j-1.2.16.jar
  • log4j-1.2.16-javadoc.jar

How does it work?

For Maven modules ivy creates a configuration matching each of the standard Maven scopes:

  • master : Main jar only
  • compile : main jar, plus jars used for compile (This is also the "default" scope)
  • runtime : Main jar, plus jars used for compile, runtime
  • test : Main jar, plus jars used for compile, runtime, test

and additionally creates a configuration for each additional artefact (or classifier) published by the module:

  • sources
  • javadoc

This enables you to mix and match.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!