ivy: prevent downloading sources and .txt files

萝らか妹 提交于 2019-12-20 07:18:03

问题


How to tell IVY to not download source and .txt files. I have a dependency and it downloads license.txt files with it, when i use soemthing like this

<ivy:cachepath pathid="ivy-src-classpath" conf="compile"/>

it put the .txt files in the classpath which errors out while using java task

Unable to obtain resource from /home/muthiah/Work/ivy/cache/org.apache.commons/com.springsource.org.apache.commons.logging/licenses/license-1.1.1.txt: java.util.zip.ZipException: error in opening zip file

回答1:


In your ivy.xml file add a configuration mapping to the other module's "default" configuration:

<dependency org="commons-lang" name="commons-lang" rev="2.5" conf="compile->default"/>

Without this mapping you're retrieving both the default and optional dependencies of the remote module.

Another good mapping (for Maven modules) to use is:

conf="compile->master"

This will retrieve the remote artifact without it's transient dependencies.




回答2:


I had the same issue with multiple java.util.zip.ZipException: error in opening zip file in my ANT output logs, because there were licence .txt files in the classpath. The solution for me was to update the ivy:cachepath entry by adding type="jar":

<ivy:cachepath pathid="ivy-src-classpath" conf="compile" type="jar"/>

This will restrict only jar files to be added to the classpath.



来源:https://stackoverflow.com/questions/3654498/ivy-prevent-downloading-sources-and-txt-files

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