diff options
-rwxr-xr-x | src/java/net/sf/antcontrib/net/URLImportTask.java | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/src/java/net/sf/antcontrib/net/URLImportTask.java b/src/java/net/sf/antcontrib/net/URLImportTask.java index 4d4663e..030c494 100755 --- a/src/java/net/sf/antcontrib/net/URLImportTask.java +++ b/src/java/net/sf/antcontrib/net/URLImportTask.java @@ -16,6 +16,9 @@ package net.sf.antcontrib.net;
import java.io.File;
+import java.io.IOException;
+import java.net.URL;
+import java.text.ParseException;
import java.util.Date;
import org.apache.tools.ant.BuildException;
@@ -55,6 +58,8 @@ public class URLImportTask private String type = "jar";
private String repositoryUrl;
private String repositoryDir;
+ private URL ivyConfUrl;
+ private File ivyConfFile;
private String artifactPattern = "/[org]/[module]/[ext]s/[module]-[revision].[ext]";
private String ivyPattern = "/[org]/[module]/ivy-[revision].xml";
@@ -70,6 +75,14 @@ public class URLImportTask this.rev = rev;
}
+ public void setIvyConfFile(File ivyConfFile) {
+ this.ivyConfFile = ivyConfFile;
+ }
+
+ public void setIvyConfUrl(URL ivyConfUrl) {
+ this.ivyConfUrl = ivyConfUrl;
+ }
+
public void execute()
throws BuildException {
@@ -96,6 +109,28 @@ public class URLImportTask repositoryDir + "/" + ivyPattern
);
}
+ else if (ivyConfUrl != null) {
+ try {
+ ivy.configure(ivyConfUrl);
+ }
+ catch (IOException e) {
+ throw new BuildException(e);
+ }
+ catch (ParseException e) {
+ throw new BuildException(e);
+ }
+ }
+ else if (ivyConfFile != null) {
+ try {
+ ivy.configure(ivyConfFile);
+ }
+ catch (IOException e) {
+ throw new BuildException(e);
+ }
+ catch (ParseException e) {
+ throw new BuildException(e);
+ }
+ }
else {
resolver = new IvyRepResolver();
}
|