KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > fr > jayasoft > ivy > ant > IvyRetrieve


1 /*
2  * This file is subject to the license found in LICENCE.TXT in the root directory of the project.
3  *
4  * #SNAPSHOT#
5  */

6 package fr.jayasoft.ivy.ant;
7
8 import org.apache.tools.ant.BuildException;
9
10 import fr.jayasoft.ivy.filter.Filter;
11
12 /**
13  * This task allow to retrieve dependencies from the cache to a local directory like a lib dir.
14  *
15  * @author Xavier Hanin
16  *
17  */

18 public class IvyRetrieve extends IvyPostResolveTask {
19     private String JavaDoc _pattern;
20     private String JavaDoc _ivypattern = null;
21     private boolean _sync = false;
22     
23     public String JavaDoc getPattern() {
24         return _pattern;
25     }
26     public void setPattern(String JavaDoc pattern) {
27         _pattern = pattern;
28     }
29     
30     public void execute() throws BuildException {
31         prepareAndCheck();
32
33         _pattern = getProperty(_pattern, getIvyInstance(), "ivy.retrieve.pattern");
34         try {
35             Filter artifactFilter = getArtifactFilter();
36             int targetsCopied = getIvyInstance().retrieve(getResolvedModuleId(), splitConfs(getConf()), getCache(), _pattern, _ivypattern, artifactFilter, _sync, isUseOrigin());
37             boolean haveTargetsBeenCopied = targetsCopied > 0;
38             getProject().setProperty("ivy.nb.targets.copied", String.valueOf(targetsCopied));
39             getProject().setProperty("ivy.targets.copied", String.valueOf(haveTargetsBeenCopied));
40         } catch (Exception JavaDoc ex) {
41             throw new BuildException("impossible to ivy retrieve: "+ex, ex);
42         }
43     }
44     public String JavaDoc getIvypattern() {
45         return _ivypattern;
46     }
47     public void setIvypattern(String JavaDoc ivypattern) {
48         _ivypattern = ivypattern;
49     }
50     public boolean isSync() {
51         return _sync;
52     }
53     public void setSync(boolean sync) {
54         _sync = sync;
55     }
56     
57 }
58
Popular Tags