---
title: "ivy中文参考文档(19)-ant任务(7)-cachepath"
author: "skydream"
date: "2009-09-01T21:21:00Z"
tags: []
slug: "ivy-19-ant-7-cachepath"
draft: false
lastmod: "2009-09-03T23:12:08Z"
id: 461049
url: "https://skydream.iteye.com/blog/461049"
---

1\) cachepath

    为解析过的模块配置构建一个由在ivy 缓存(或者取决于useOrigin 设置的原始位置)中的制品组成的ant path.

    这是一个后解析任务，有所有后解析任务共有的所有行为和属性。

    如果你想让你的构建更少的依赖ivy，你可以考虑使用retrieve 任务。一旦制品被正确的获得，你可以使用标准ant path，这使得ivy不再必不可少。

    构建path在ant中通过使用给定的id注册，从而可以像其他任务ant 路径一样通过使用refid来使用。

    2) 属性

属性 描述 必要 pathid 用于引用构建好的路径的id  
是  
conf 逗号分隔的配置列表  
不。默认是最后一次解析调用时解析的配置，或者\*如果没有显式调用resolve type 逗号分隔的可被接受从而加到路径中的制品类型列表, * 所有都加入(从1.2起)  
不，默认是 *  
settingsRef (从2.0起) 必须被这个任务使用的ivy设置的引用  
不，默认使用'ivy.instance'

    3) 举例

&lt; cachepath  pathid ="default.classpath"  conf ="default"   /&gt;

    构建一个由所有制品组成的ant path， 这些制品是默认配置的一部分，通过最后一次resolve调用获得。

&lt; cachepath  pathid ="default.classpath"  conf ="default"  useOrigin ="true"   /&gt;

    和前面相同但是将为本地制品使用原始位置，而为其他制品使用缓存位置。

&lt; ivy:cachepath  organisation ="emma"  module ="emma"  revision ="2.0.4217"  inline ="true"  conf ="ant"  pathid ="emma.classpath" /&gt;  
&lt; taskdef  resource ="emma\_ant.properties"  classpathref ="emma.classpath"   /&gt;

    解析版本为2.0.4217的模块emma，用对应的制品构建一个ant 路径，然后使用这个路径定义emma任务.