
Property changes on: .
___________________________________________________________________
Name: svn:ignore
   - 
build
lib
bin

   + build
lib
bin
distrib


Index: test/java/org/apache/ivy/ant/IvyTaskTest.java
===================================================================
--- test/java/org/apache/ivy/ant/IvyTaskTest.java	(revision 0)
+++ test/java/org/apache/ivy/ant/IvyTaskTest.java	(revision 0)
@@ -0,0 +1,65 @@
+package org.apache.ivy.ant;
+
+import java.io.File;
+import java.net.MalformedURLException;
+
+import org.apache.ivy.Ivy;
+import org.apache.ivy.core.settings.IvySettings;
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.types.Reference;
+
+import junit.framework.TestCase;
+
+public class IvyTaskTest extends TestCase {
+
+	public void testDefaultSettings() throws MalformedURLException {
+		Project p = new Project();
+		p.setBasedir("test/repositories");
+		//p.setProperty("ivy.settings.file" , "ivysettings.xml");
+		p.setProperty("myproperty", "myvalue");
+		IvyTask task = new IvyTask();
+		task.setProject(p);
+		
+        Ivy ivy = task.getIvyInstance();
+        assertNotNull(ivy);
+		IvySettings settings = ivy.getSettings();
+        assertNotNull(settings);
+        
+        assertEquals(new File("build/cache"), settings.getDefaultCache());
+        //The next test doesn't always works on windows (mix C: and c: drive)
+        //assertEquals(new File("test/repositories/ivysettings.xml").getAbsolutePath(), new File((String)settings.getVariables().get("ivy.settings.file")).getAbsolutePath());
+        assertEquals(new File("test/repositories/ivysettings.xml").toURL().toExternalForm(), settings.getVariables().get("ivy.settings.url"));
+        assertEquals(new File("test/repositories").getAbsolutePath(), settings.getVariables().get("ivy.settings.dir"));
+        assertEquals("myvalue", settings.getVariables().get("myproperty"));
+	}
+
+	public void testReferencedSettings() throws MalformedURLException {
+		Project p = new Project();
+		//p.setBasedir("test/repositories");
+		//p.setProperty("ivy.settings.file" , "ivysettings.xml");
+		p.setProperty("myproperty", "myvalue");
+		
+        IvyAntSettings antSettings = new IvyAntSettings();
+        antSettings.setProject(p);
+        antSettings.setId("mySettings");
+        antSettings.setFile(new File("test/repositories/ivysettings.xml"));
+        antSettings.execute();
+        
+		IvyTask task = new IvyTask();
+		task.setProject(p);
+		task.setSettingsRef(new Reference(p,"mySettings"));
+        Ivy ivy = task.getIvyInstance();
+        assertNotNull(ivy);
+		IvySettings settings = ivy.getSettings();
+        assertNotNull(settings);
+        
+        assertEquals(new File("build/cache"), settings.getDefaultCache());
+        assertEquals(new File("test/repositories/ivysettings.xml").getAbsolutePath(), settings.getVariables().get("ivy.settings.file"));
+        assertEquals(new File("test/repositories/ivysettings.xml").toURL().toExternalForm(), settings.getVariables().get("ivy.settings.url"));
+        assertEquals(new File("test/repositories").getAbsolutePath(), settings.getVariables().get("ivy.settings.dir"));
+        assertEquals("myvalue", settings.getVariables().get("myproperty"));
+
+	}
+
+
+}

Property changes on: test\java\org\apache\ivy\ant\IvyTaskTest.java
___________________________________________________________________
Name: svn:keywords
   + "Author Date Id Revision"
Name: svn:eol-style
   + native

Index: test/java/org/apache/ivy/ant/IvyConfigureTest.java
===================================================================
--- test/java/org/apache/ivy/ant/IvyConfigureTest.java	(revision 522893)
+++ test/java/org/apache/ivy/ant/IvyConfigureTest.java	(working copy)
@@ -25,9 +25,11 @@
 import org.apache.ivy.core.settings.IvySettings;
 import org.apache.tools.ant.Project;
 
-
+/**
+ * Test the deprecated IvyConfigureTest and the underlying implementation 
+ * AntIvySettings.  When IvyConfigure will be removed, this class should be renamed AntIvySettingsTest
+ */
 public class IvyConfigureTest extends TestCase {
-    private File _cache;
     private IvyConfigure _configure;
     
     protected void setUp() throws Exception {
@@ -43,7 +45,7 @@
         
         _configure.execute();
         
-        Ivy ivy = getIvyInstance();
+        Ivy ivy = _configure.getIvyInstance();
         assertNotNull(ivy);
 		IvySettings settings = ivy.getSettings();
         assertNotNull(settings);
@@ -65,7 +67,7 @@
         
         _configure.execute();
         
-        IvySettings settings = getIvyInstance().getSettings();
+        IvySettings settings = _configure.getIvyInstance().getSettings();
         
         assertEquals(new File("build/cache"), settings.getDefaultCache());
         assertEquals(confUrl, settings.getVariables().get("ivy.settings.url"));
@@ -79,7 +81,7 @@
         
         _configure.execute();
         
-        IvySettings settings = getIvyInstance().getSettings();
+        IvySettings settings = _configure.getIvyInstance().getSettings();
         assertNotNull(settings);
         
         assertEquals("myvalue", settings.getVariables().get("myproperty"));
@@ -92,14 +94,10 @@
         
         _configure.execute();
         
-        IvySettings settings = getIvyInstance().getSettings();
+        IvySettings settings = _configure.getIvyInstance().getSettings();
         assertNotNull(settings);
         
         assertEquals("lib/test/[artifact]-[revision].[ext]", settings.getVariables().get("ivy.retrieve.pattern"));
     }
 
-    private Ivy getIvyInstance() {
-        return (Ivy)_configure.getProject().getReference("ivy.instance");
-    }
-
 }
Index: src/java/org/apache/ivy/ant/IvyAntVariableContainer.java
===================================================================
--- src/java/org/apache/ivy/ant/IvyAntVariableContainer.java	(revision 0)
+++ src/java/org/apache/ivy/ant/IvyAntVariableContainer.java	(revision 0)
@@ -0,0 +1,51 @@
+/**
+ * 
+ */
+package org.apache.ivy.ant;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.ivy.core.settings.IvyVariableContainer;
+import org.apache.ivy.core.settings.IvyVariableContainerImpl;
+import org.apache.ivy.util.Message;
+import org.apache.tools.ant.Project;
+
+class IvyAntVariableContainer extends IvyVariableContainerImpl implements IvyVariableContainer{
+
+	protected Map _overwrittenProperties = new HashMap();
+	protected Project _project;
+
+	
+	public IvyAntVariableContainer(Project project) {
+		this._project = project;
+	}
+
+	
+	public String getVariable(String name) {
+		String r = (String) _overwrittenProperties.get(name);
+		if (r==null) {
+			r=_project.getProperty(name);
+		}
+		if (r==null) {
+			r = super.getVariable(name);
+		}
+		return r;
+	}
+
+	public Map getVariables() {
+		Map r = new HashMap(super.getVariables());
+		r.putAll(_project.getProperties());
+		r.putAll(_overwrittenProperties);
+		return r;
+	}
+	
+	public void setVariable(String varName, String value, boolean overwrite) {
+		if (overwrite) {
+			Message.debug("setting '"+varName+"' to '"+value+"'");
+			_overwrittenProperties.put(varName, value);
+		} else {
+			super.setVariable(varName, value, overwrite);
+		}
+	}
+}
\ No newline at end of file

Property changes on: src\java\org\apache\ivy\ant\IvyAntVariableContainer.java
___________________________________________________________________
Name: svn:keywords
   + "Author Date Id Revision"
Name: svn:eol-style
   + native

Index: src/java/org/apache/ivy/ant/antlib.xml
===================================================================
--- src/java/org/apache/ivy/ant/antlib.xml	(revision 522893)
+++ src/java/org/apache/ivy/ant/antlib.xml	(working copy)
@@ -18,6 +18,7 @@
    under the License.    
 -->
 <antlib xmlns:current="ant:current">
+	<typedef name="settings" classname="org.apache.ivy.ant.IvyAntSettings"/>
 	<taskdef name="configure" classname="org.apache.ivy.ant.IvyConfigure"/>
 	<taskdef name="resolve" classname="org.apache.ivy.ant.IvyResolve"/>
 	<taskdef name="retrieve" classname="org.apache.ivy.ant.IvyRetrieve"/>
Index: src/java/org/apache/ivy/ant/IvyTask.java
===================================================================
--- src/java/org/apache/ivy/ant/IvyTask.java	(revision 522893)
+++ src/java/org/apache/ivy/ant/IvyTask.java	(working copy)
@@ -21,9 +21,7 @@
 import java.text.SimpleDateFormat;
 import java.util.Arrays;
 import java.util.Date;
-import java.util.HashMap;
 import java.util.HashSet;
-import java.util.Map;
 
 import org.apache.ivy.Ivy;
 import org.apache.ivy.core.IvyContext;
@@ -35,6 +33,7 @@
 import org.apache.tools.ant.BuildException;
 import org.apache.tools.ant.Project;
 import org.apache.tools.ant.Task;
+import org.apache.tools.ant.types.Reference;
 
 
 /**
@@ -45,8 +44,10 @@
  */
 public class IvyTask extends Task {
     public static final String ANT_PROJECT_CONTEXT_KEY = "ant-project";
-	private Boolean _validate = null; 
+	private Boolean _validate = null;
+	private Reference _antIvyEngineRef = null; 
 
+	
     protected boolean doValidate(IvySettings ivy) {
         if (_validate != null) {
             return _validate.booleanValue();
@@ -60,28 +61,42 @@
         _validate = Boolean.valueOf(validate);
     }
     
+    
+    public void setSettingsRef(Reference ref) {
+    	_antIvyEngineRef = ref;
+    }
+    
+    public Reference getSettingsRef() {
+    	return _antIvyEngineRef;
+    }
+    
     protected IvySettings getSettings() {
     	return getIvyInstance().getSettings();
     }
     
     protected Ivy getIvyInstance() {
-        ensureMessageInitialised();
-        Object ref = getProject().getReference("ivy.instances");
-        if (ref != null && !(ref instanceof Map)) {
-            throw new BuildException("ivy problem with ant: ivy.instances reference is not a Map. Please do not sett ivy.instances reference in your ant project. current reference: "+ref+" class="+ref.getClass()+" classloader="+ref.getClass().getClassLoader());
-        }
-        Map instances = (Map) ref;
-        if (instances == null || !instances.containsKey(Ivy.class)) {
-            Message.verbose("no ivy instance found: auto configuring ivy");
-            IvyConfigure configure = new IvyConfigure();
-            configure.setProject(getProject());
-            configure.execute();
-            instances = (Map) getProject().getReference("ivy.instances");
-            if (instances == null || !instances.containsKey(Ivy.class)) {
-                throw new BuildException("ivy internal problem: impossible to get ivy instance after configure... maybe a classloader problem");
-            }
-        } 
-        return (Ivy)instances.get(Ivy.class);
+    	ensureMessageInitialised();
+    	Object antIvyEngine;
+    	if (_antIvyEngineRef!=null) {
+    		antIvyEngine = _antIvyEngineRef.getReferencedObject();
+    		if (! antIvyEngine.getClass().getName().equals(IvyAntSettings.class.getName())) {
+    			throw new BuildException(_antIvyEngineRef.getRefId() + " doesn't reference an ivy:settings" , getLocation());
+    		}
+    		if (! (antIvyEngine instanceof IvyAntSettings)) {
+    			throw new BuildException(_antIvyEngineRef.getRefId() + " has been defined in a different classloader.  Please use the same loader when defining your task, or redeclare your ivy:settings in this classloader" , getLocation());
+    		}
+    	} else {
+    		antIvyEngine = getProject().getReference("ivy.instance");
+	        if (antIvyEngine==null) {
+	        	antIvyEngine = new IvyAntSettings();
+	        	((IvyAntSettings)antIvyEngine).setProject(getProject());
+	        	((IvyAntSettings)antIvyEngine).execute();
+	        }
+			if (! (antIvyEngine instanceof IvyAntSettings)) {
+				throw new BuildException("ivy.instance doesn't reference an ivy:settings, please don't use this id." , getLocation());
+			}
+    	}
+    	return ((IvyAntSettings)antIvyEngine).getConfiguredIvyInstance();
     }
 
     /** 
@@ -93,23 +108,7 @@
         if (!Message.isInitialised()) { 
             Message.init(new AntMessageImpl(this));
         }
-
     }
-    protected void setIvyInstance(Ivy ivy) {
-    	// this reference is not used anymore, what is used is the instances map below
-        getProject().addReference("ivy.instance", ivy);
-        
-        if (ivy != null) {
-        	Message.debug("setting ivy.instance on "+getProject()+": "+ivy+" class="+ivy.getClass().getName()+" classloader="+ivy.getClass().getClassLoader());
-        	// we keep a map of ivy instances per Ivy class, in case of multiple classloaders
-        	Map instances = (Map) getProject().getReference("ivy.instances");
-        	if (instances == null) {
-        		instances = new HashMap();
-        		getProject().addReference("ivy.instances", instances);
-        	}
-        	instances.put(ivy.getClass(), ivy);
-        }
-    }
     
     protected void setResolved(ResolveReport report, boolean keep) {
     	ModuleDescriptor md = report.getModuleDescriptor();
@@ -254,6 +253,7 @@
 		Message.verbose("no resolved descriptor found: launching default resolve");
 		IvyResolve resolve = new IvyResolve();
 		resolve.setProject(getProject());
+		resolve.setSettingsRef(getSettingsRef());
 		resolve.setHaltonfailure(haltOnFailure);
 		resolve.setUseOrigin(useOrigin);
 		if (_validate != null) {
Index: src/java/org/apache/ivy/ant/IvyAntSettings.java
===================================================================
--- src/java/org/apache/ivy/ant/IvyAntSettings.java	(revision 0)
+++ src/java/org/apache/ivy/ant/IvyAntSettings.java	(revision 0)
@@ -0,0 +1,264 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ */
+package org.apache.ivy.ant;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.text.ParseException;
+import java.util.Properties;
+
+import org.apache.ivy.Ivy;
+import org.apache.ivy.core.settings.IvySettings;
+import org.apache.ivy.core.settings.IvyVariableContainer;
+import org.apache.ivy.util.Message;
+import org.apache.ivy.util.url.CredentialsStore;
+import org.apache.ivy.util.url.URLHandler;
+import org.apache.ivy.util.url.URLHandlerDispatcher;
+import org.apache.ivy.util.url.URLHandlerRegistry;
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Project;
+
+
+public class IvyAntSettings extends IvyTask {
+	
+    public static class Credentials {
+    	private String _realm;
+    	private String _host;
+    	private String _username;
+    	private String _passwd;
+    	
+        public String getPasswd() {
+            return _passwd;
+        }
+        public void setPasswd(String passwd) {
+            _passwd = passwd;
+        }
+        public String getRealm() {
+            return _realm;
+        }
+        public void setRealm(String realm) {
+            _realm = format(realm);
+        }
+        public String getHost() {
+            return _host;
+        }
+        public void setHost(String host) {
+            _host = format(host);
+        }
+        public String getUsername() {
+            return _username;
+        }
+        public void setUsername(String userName) {
+            _username = format(userName);
+        }
+	}
+
+	private File _file = null; 
+    private URL _url = null;
+    private String _realm = null;
+    private String _host = null;
+    private String _userName = null;
+    private String _passwd = null;
+    private String id = null;
+
+    public File getFile() {
+        return _file;
+    }
+    public URL getUrl() {
+        return _url;
+    }    
+    public String getPasswd() {
+        return _passwd;
+    }
+    public void setPasswd(String passwd) {
+        _passwd = passwd;
+    }
+    public String getRealm() {
+        return _realm;
+    }
+    public void setRealm(String realm) {
+        _realm = format(realm);
+    }
+    public String getHost() {
+        return _host;
+    }
+    public void setHost(String host) {
+        _host = format(host);
+    }
+    public String getUsername() {
+        return _userName;
+    }
+    public void setUsername(String userName) {
+        _userName = format(userName);
+    }
+    public String getId() {
+		return id;
+	}
+	public void setId(String id) {
+		this.id = id;
+	}
+	private static String format(String str) {
+        return str == null ? str : (str.trim().length() == 0 ? null : str.trim());
+    }
+    
+    public void addConfiguredCredentials(Credentials  c) {
+    	CredentialsStore.INSTANCE.addCredentials(c.getRealm(), c.getHost(), c.getUsername(), c.getPasswd());
+    }
+
+	private Ivy _ivyEngine = null;
+
+	public void setFile(File file) {
+		this._file = file;
+	}
+
+
+	public void setUrl(String confUrl) throws MalformedURLException {
+		this._url = new URL(confUrl);
+	}
+
+	
+	
+	
+	
+    public void execute() throws BuildException {
+    	ensureMessageInitialised();
+    	if (getId()==null) {
+    		log("No id specified for the ivy:settings, use default value 'ivy.instance'", Project.MSG_INFO);
+    		setId("ivy.instance");
+    	}
+    	getProject().addReference(id, this);
+    }
+
+	
+	/**  
+	 * @return
+	 */
+	public Ivy getConfiguredIvyInstance() {
+		if (_ivyEngine==null) {
+			_ivyEngine = createIvyEngine();
+		}
+		return _ivyEngine;
+	}
+
+
+	private Ivy createIvyEngine() {
+		IvyAntVariableContainer ivyAntVariableContainer = new IvyAntVariableContainer(getProject());
+        
+		IvySettings settings = new IvySettings(ivyAntVariableContainer);
+        //NB: It is alrady done in the ivy.configure, but it is required for defineDefaultSettingFile (that should be done before the ivy.configure
+		settings.addAllVariables(getDefaultProperties(), false);
+
+		Ivy ivy = Ivy.newInstance(settings);
+
+        if (_file == null && _url == null) {
+        	defineDefaultSettingFile(ivyAntVariableContainer);
+        }
+        
+        try {
+            configureURLHandler();
+            if (_file != null) {
+                if (!_file.exists()) {
+                    throw new BuildException("settings file does not exist: "+_file);
+                } 
+                ivy.configure(_file);
+            } else {
+            	if (_url==null) {
+            		throw new AssertionError("ivy setting should have either a file, either an url, and if not defineDefaultSettingFile must set it.");
+            	}
+                ivy.configure(_url);
+            }
+        } catch (ParseException e) {
+            throw new BuildException("impossible to configure ivy:settings with given "+(_file != null ? "file: "+_file : "url :"+_url)+" :"+e, e);
+		} catch (IOException e) {
+            throw new BuildException("impossible to configure ivy:settings with given "+(_file != null ? "file: "+_file : "url :"+_url)+" :"+e, e);
+		}
+		return ivy;
+	}
+	
+
+	protected Properties getDefaultProperties() {
+		URL url = IvySettings.getDefaultPropertiesURL();
+        // this is copy of loadURL code from ant Property task  (not available in 1.5.1)
+        Properties props = new Properties();
+        Message.verbose("Loading " + url);
+        try {
+            InputStream is = url.openStream();
+            try {
+                props.load(is);
+            } finally {
+                if (is != null) {
+                    is.close();
+                }
+            }
+        } catch (IOException ex) {
+            throw new BuildException(ex, getLocation());
+        }
+		return props;
+	}
+
+	
+	/** Set _file or _url to its default value 
+	 * @param variableContainer */
+	private void defineDefaultSettingFile(IvyVariableContainer variableContainer) {
+		String settingsFileName = variableContainer.getVariable("ivy.conf.file");
+		if (settingsFileName != null) {
+			Message.deprecated("'ivy.conf.file' is deprecated, use 'ivy.settings.file' instead");
+		} else {
+			settingsFileName = variableContainer.getVariable("ivy.settings.file");
+		}
+		File[] settingsLocations = new File[] {
+				new File(getProject().getBaseDir(), settingsFileName),
+				new File(getProject().getBaseDir(), "ivyconf.xml"),
+				new File(settingsFileName),
+				new File("ivyconf.xml"),
+		};
+		for (int i = 0; i < settingsLocations.length; i++) {
+			_file = settingsLocations[i];
+			Message.verbose("searching settings file: trying "+_file);
+		    if (_file.exists()) {
+		    	break;
+		    }
+		}
+		if (!_file.exists()) {
+		    Message.info("no settings file found, using default...");
+		    _file = null;
+		    _url = IvySettings.getDefaultSettingsURL();
+		}
+	}
+
+	
+	
+		
+    
+    private void configureURLHandler() {
+    	//TODO : the credentialStore should also be scoped
+    	CredentialsStore.INSTANCE.addCredentials(getRealm(), getHost(), getUsername(), getPasswd());
+
+    	URLHandlerDispatcher dispatcher = new URLHandlerDispatcher();
+        URLHandler httpHandler = URLHandlerRegistry.getHttp();
+        dispatcher.setDownloader("http", httpHandler);
+        dispatcher.setDownloader("https", httpHandler);
+        URLHandlerRegistry.setDefault(dispatcher);
+    }
+
+	
+
+}

Property changes on: src\java\org\apache\ivy\ant\IvyAntSettings.java
___________________________________________________________________
Name: svn:keywords
   + "Author Date Id Revision"
Name: svn:eol-style
   + native

Index: src/java/org/apache/ivy/ant/IvyConfigure.java
===================================================================
--- src/java/org/apache/ivy/ant/IvyConfigure.java	(revision 522893)
+++ src/java/org/apache/ivy/ant/IvyConfigure.java	(working copy)
@@ -17,21 +17,10 @@
  */
 package org.apache.ivy.ant;
 
-import java.io.File;
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.MalformedURLException;
-import java.net.URL;
 import java.util.Properties;
 
-import org.apache.ivy.Ivy;
-import org.apache.ivy.core.settings.IvySettings;
-import org.apache.ivy.util.Message;
-import org.apache.ivy.util.url.CredentialsStore;
-import org.apache.ivy.util.url.URLHandler;
-import org.apache.ivy.util.url.URLHandlerDispatcher;
-import org.apache.ivy.util.url.URLHandlerRegistry;
 import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Project;
 import org.apache.tools.ant.taskdefs.Property;
 
 
@@ -39,178 +28,35 @@
  * Configure Ivy with an ivysettings.xml file
  * 
  * @author Xavier Hanin
- *
+ * @deprecated Use the IvyAntSettings instead.
  */
-public class IvyConfigure extends IvyTask {
-    public static class Credentials {
-    	private String _realm;
-    	private String _host;
-    	private String _username;
-    	private String _passwd;
-    	
-        public String getPasswd() {
-            return _passwd;
-        }
-        public void setPasswd(String passwd) {
-            _passwd = passwd;
-        }
-        public String getRealm() {
-            return _realm;
-        }
-        public void setRealm(String realm) {
-            _realm = format(realm);
-        }
-        public String getHost() {
-            return _host;
-        }
-        public void setHost(String host) {
-            _host = format(host);
-        }
-        public String getUsername() {
-            return _username;
-        }
-        public void setUsername(String userName) {
-            _username = format(userName);
-        }
-	}
+public class IvyConfigure extends IvyAntSettings {
 
-	private File _file = null; 
-    private URL _url = null;
-    private String _realm = null;
-    private String _host = null;
-    private String _userName = null;
-    private String _passwd = null;
 
-    public File getFile() {
-        return _file;
-    }
-    public void setFile(File conf) {
-        _file = conf;
-    }
-    public URL getUrl() {
-        return _url;
-    }    
-    public void setUrl(String url) throws MalformedURLException {
-        _url = new URL(url);
-    }
-    public String getPasswd() {
-        return _passwd;
-    }
-    public void setPasswd(String passwd) {
-        _passwd = passwd;
-    }
-    public String getRealm() {
-        return _realm;
-    }
-    public void setRealm(String realm) {
-        _realm = format(realm);
-    }
-    public String getHost() {
-        return _host;
-    }
-    public void setHost(String host) {
-        _host = format(host);
-    }
-    public String getUsername() {
-        return _userName;
-    }
-    public void setUsername(String userName) {
-        _userName = format(userName);
-    }
-    private static String format(String str) {
-        return str == null ? str : (str.trim().length() == 0 ? null : str.trim());
-    }
-    
-    public void addConfiguredCredentials(Credentials  c) {
-    	CredentialsStore.INSTANCE.addCredentials(c.getRealm(), c.getHost(), c.getUsername(), c.getPasswd());
-    }
-
     public void execute() throws BuildException {
-        try {
+    	ensureMessageInitialised();
+    	log("ivy:configure is deprecated, please use the data type ivy:settings instead", Project.MSG_WARN);
+    	//ivyConfigure used to export properties in the ant script.  ivy:settings doesn't.
+    	try {
 	        loadDefaultProperties();
         } catch (Exception ex) {
             throw new BuildException("impossible to load ivy default properties file: "+ex, ex);
         }
-        ensureMessageInitialised();
-        Ivy ivy = Ivy.newInstance();
-        try {
-            configureURLHandler();
-            IvySettings settings = ivy.getSettings();
-			settings.addAllVariables(getProject().getProperties());
-            if (_file == null && _url == null) {
-            	String settingsFileName = getProject().getProperty("ivy.conf.file");
-            	if (settingsFileName != null) {
-            		Message.deprecated("'ivy.conf.file' is deprecated, use 'ivy.settings.file' instead");
-            	} else {
-            		settingsFileName = getProject().getProperty("ivy.settings.file");
-            	}
-            	File[] settingsLocations = new File[] {
-            			new File(getProject().getBaseDir(), settingsFileName),
-            			new File(getProject().getBaseDir(), "ivyconf.xml"),
-            			new File(settingsFileName),
-            			new File("ivyconf.xml"),
-            	};
-            	for (int i = 0; i < settingsLocations.length; i++) {
-					_file = settingsLocations[i];
-					Message.verbose("searching settings file: trying "+_file);
-	                if (_file.exists()) {
-	                	break;
-	                }
-				}
-                if (!_file.exists()) {
-                    Message.info("no settings file found, using default...");
-                    _file = null;
-                    _url = IvySettings.getDefaultSettingsURL();
-                }
-            } 
-            if (_file != null) {
-                if (!_file.exists()) {
-                    throw new BuildException("settings file does not exist: "+_file);
-                } else {
-                    ivy.configure(_file);
-                }
-            } else {
-                ivy.configure(_url);
-            }
-            setIvyInstance(ivy);
-        } catch (Exception ex) {
-            throw new BuildException("impossible to configure ivy with given "+(_file != null ? "file: "+_file : "url :"+_url)+" :"+ex, ex);
-        }
+    	super.execute();
     }
 
+
+
+    
     private void loadDefaultProperties() {
         Property prop = new Property() {
             public void execute() throws BuildException {
-                URL url = IvySettings.getDefaultPropertiesURL();
-                // this is copy of loadURL code from ant Property task  (not available in 1.5.1)
-                Properties props = new Properties();
-                Message.verbose("Loading " + url);
-                try {
-                    InputStream is = url.openStream();
-                    try {
-                        props.load(is);
-                    } finally {
-                        if (is != null) {
-                            is.close();
-                        }
-                    }
-                    addProperties(props);
-                } catch (IOException ex) {
-                    throw new BuildException(ex, getLocation());
-                }
+                Properties props = getDefaultProperties();
+                addProperties(props);
             }
         };
         prop.setProject(getProject());
         prop.execute();
     }
-    
-    private void configureURLHandler() {
-    	CredentialsStore.INSTANCE.addCredentials(getRealm(), getHost(), getUsername(), getPasswd());
 
-    	URLHandlerDispatcher dispatcher = new URLHandlerDispatcher();
-        URLHandler httpHandler = URLHandlerRegistry.getHttp();
-        dispatcher.setDownloader("http", httpHandler);
-        dispatcher.setDownloader("https", httpHandler);
-        URLHandlerRegistry.setDefault(dispatcher);
-    }
 }
Index: src/java/org/apache/ivy/ant/IvyPublish.java
===================================================================
--- src/java/org/apache/ivy/ant/IvyPublish.java	(revision 522893)
+++ src/java/org/apache/ivy/ant/IvyPublish.java	(working copy)
@@ -227,6 +227,7 @@
             }
             if (_publishivy && (!ivyFile.exists() || _forcedeliver)) {
                 IvyDeliver deliver = new IvyDeliver();
+                deliver.setSettingsRef(getSettingsRef());
                 deliver.setProject(getProject());
                 deliver.setCache(getCache());
                 deliver.setDeliverpattern(getSrcivypattern());
Index: src/java/org/apache/ivy/Ivy.java
===================================================================
--- src/java/org/apache/ivy/Ivy.java	(revision 522893)
+++ src/java/org/apache/ivy/Ivy.java	(working copy)
@@ -88,6 +88,13 @@
 		return ivy;
 	}
 
+	public static Ivy newInstance(IvySettings settings) {
+		Ivy ivy = new Ivy();
+		ivy.setSettings(settings);
+		ivy.bind();
+		return ivy;
+	}
+	
 	/**
 	 * True if the current processing has been requested to be interrupted,
 	 * false otherwise
Index: src/java/org/apache/ivy/core/settings/IvyVariableContainer.java
===================================================================
--- src/java/org/apache/ivy/core/settings/IvyVariableContainer.java	(revision 0)
+++ src/java/org/apache/ivy/core/settings/IvyVariableContainer.java	(revision 0)
@@ -0,0 +1,36 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ */
+package org.apache.ivy.core.settings;
+
+import java.util.Map;
+
+/**
+ * Store and provide access to the ivy variables.
+ * @author gscokart
+ */
+public interface IvyVariableContainer extends Cloneable{
+
+	public abstract void setVariable(String varName, String value,
+			boolean overwrite);
+
+	public abstract Map getVariables();
+
+	public abstract String getVariable(String name);
+
+	public Object clone();
+}
\ No newline at end of file

Property changes on: src\java\org\apache\ivy\core\settings\IvyVariableContainer.java
___________________________________________________________________
Name: svn:keywords
   + "Author Date Id Revision"
Name: svn:eol-style
   + native

Index: src/java/org/apache/ivy/core/settings/IvyVariableContainerImpl.java
===================================================================
--- src/java/org/apache/ivy/core/settings/IvyVariableContainerImpl.java	(revision 0)
+++ src/java/org/apache/ivy/core/settings/IvyVariableContainerImpl.java	(revision 0)
@@ -0,0 +1,73 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ */
+package org.apache.ivy.core.settings;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.ivy.core.IvyPatternHelper;
+import org.apache.ivy.util.Message;
+
+public class IvyVariableContainerImpl implements IvyVariableContainer {
+
+	
+	private HashMap _variables = new HashMap();
+
+	/* (non-Javadoc)
+	 * @see org.apache.ivy.core.settings.IvyVariableContainer#setVariable(java.lang.String, java.lang.String, boolean)
+	 */
+	public void setVariable(String varName, String value, boolean overwrite) {
+        if (overwrite || !_variables.containsKey(varName)) {
+            Message.debug("setting '"+varName+"' to '"+value+"'");
+            _variables.put(varName, substitute(value));
+        } else {
+            Message.debug("'"+varName+"' already set: discarding '"+value+"'");
+        }
+
+	}
+
+	private String substitute(String value) {
+		return IvyPatternHelper.substituteVariables(value, getVariables());
+	}
+
+	/* (non-Javadoc)
+	 * @see org.apache.ivy.core.settings.IvyVariableContainer#getVariables()
+	 */
+	public Map getVariables() {
+		return _variables;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.apache.ivy.core.settings.IvyVariableContainer#getVariable(java.lang.String)
+	 */
+	public String getVariable(String name) {
+		String val = (String)_variables.get(name);
+        return val==null?val:substitute(val);
+	}
+	
+	public Object clone() {
+		IvyVariableContainerImpl clone;
+		try {
+			clone = (IvyVariableContainerImpl) super.clone();
+		} catch (CloneNotSupportedException e) {
+			throw new RuntimeException("unable to clone a " + this.getClass());
+		}
+		clone._variables = (HashMap) _variables.clone();
+		return clone;
+	}
+}

Property changes on: src\java\org\apache\ivy\core\settings\IvyVariableContainerImpl.java
___________________________________________________________________
Name: svn:keywords
   + "Author Date Id Revision"
Name: svn:eol-style
   + native

Index: src/java/org/apache/ivy/core/settings/IvySettings.java
===================================================================
--- src/java/org/apache/ivy/core/settings/IvySettings.java	(revision 522893)
+++ src/java/org/apache/ivy/core/settings/IvySettings.java	(working copy)
@@ -107,7 +107,7 @@
     private Map _circularDependencyStrategies = new HashMap(); // Map (String name -> CircularDependencyStrategy)
     private List _triggers = new ArrayList(); // List (Trigger)
     
-    private Map _variables = new HashMap();
+    private IvyVariableContainer _variableContainer = new IvyVariableContainerImpl();
 
     private String _cacheIvyPattern = DEFAULT_CACHE_IVY_PATTERN;
     private String _cacheResolvedIvyPattern = DEFAULT_CACHE_RESOLVED_IVY_PATTERN;
@@ -140,7 +140,13 @@
 	private VersionMatcher _versionMatcher;
 	private StatusManager _statusManager;
 	
+	
 	public IvySettings() {
+		this(new IvyVariableContainerImpl());
+	}
+	
+	public IvySettings(IvyVariableContainer variableContainer) {
+		setVariableContainer(variableContainer);
         setVariable("ivy.default.settings.dir", getDefaultSettingsDir(), true);
         setDeprecatedVariable("ivy.default.conf.dir", "ivy.default.settings.dir");
         
@@ -425,13 +431,9 @@
         setVariable(varName, value, true);
     }
     
+    
     public void setVariable(String varName, String value, boolean overwrite) {
-        if (overwrite || !_variables.containsKey(varName)) {
-            Message.debug("setting '"+varName+"' to '"+value+"'");
-            _variables.put(varName, substitute(value));
-        } else {
-            Message.debug("'"+varName+"' already set: discarding '"+value+"'");
-        }
+    	_variableContainer.setVariable(varName , value, overwrite);
     }
     
     public void addAllVariables(Map variables) {
@@ -464,7 +466,7 @@
      * @return
      */
     public Map getVariables() {
-        return _variables;
+        return _variableContainer.getVariables();
     }
 
     public Class typeDef(String name, String className) {
@@ -908,8 +910,7 @@
     }
 
     public String getVariable(String name) {
-        String val = (String)_variables.get(name);
-        return val==null?val:substitute(val);
+        return _variableContainer.getVariable(name);
     }
 
     public ConflictManager getDefaultConflictManager() {
@@ -958,19 +959,6 @@
         _useRemoteConfig = useRemoteConfig;
     }
 
-    /** 
-     * WARNING: Replace all current ivy variables by the given Map.
-     * Should be used only when restoring variables.
-     * 
-     *  Thr given Map is not copied, but stored by reference.
-     * @param variables
-     */
-    public void setVariables(Map variables) {
-        if (variables == null) {
-            throw new NullPointerException("variables shouldn't be null");
-        }
-        _variables = variables;
-    }
     public boolean logModulesInUse() {
         String var = getVariable("ivy.log.modules.in.use");
         return var == null || Boolean.valueOf(var).booleanValue();
@@ -1061,4 +1049,16 @@
 		return _matchers.keySet();
 	}
 
+	public IvyVariableContainer getVariableContainer() {
+		return _variableContainer;
+	}
+
+	/** 
+	 * Use a different variable container.
+	 * @param variables
+	 */
+	public void setVariableContainer(IvyVariableContainer variables) {
+		_variableContainer = variables;
+	}
+
 }
Index: src/java/org/apache/ivy/core/settings/XmlSettingsParser.java
===================================================================
--- src/java/org/apache/ivy/core/settings/XmlSettingsParser.java	(revision 522893)
+++ src/java/org/apache/ivy/core/settings/XmlSettingsParser.java	(working copy)
@@ -205,7 +205,7 @@
                     }
                 }
             } else if ("include".equals(qName)) {
-                Map variables = new HashMap(_ivy.getVariables());
+                IvyVariableContainer variables = (IvyVariableContainer) _ivy.getVariableContainer().clone();
                 try {
                     String propFilePath = _ivy.substitute((String)attributes.get("file"));
                     URL settingsURL = null; 
@@ -232,7 +232,7 @@
                     }
                     new XmlSettingsParser(_ivy).parse(_configurator, settingsURL);
                 } finally {
-                    _ivy.setVariables(variables);
+                    _ivy.setVariableContainer(variables);
                 }
             } else if ("settings".equals(qName) || "conf".equals(qName)) {
             	if ("conf".equals(qName)) {
Index: src/example/build-a-ivy-repository/build.xml
===================================================================
--- src/example/build-a-ivy-repository/build.xml	(revision 522893)
+++ src/example/build-a-ivy-repository/build.xml	(working copy)
@@ -33,90 +33,61 @@
 	<property name="ivy.cache.dir" value="${basedir}/cache" />
 	<property name="dest.repo.dir" value="${basedir}/ivy-local-repository" />
 
+   	<ivy:settings id="basic.settings"    file="${configuration-dir}/ivysettings-basic.xml"/>
+   	<ivy:settings id="maven1.settings"   file="${configuration-dir}/ivysettings-maven1.xml"/>
+   	<ivy:settings id="maven2.settings"   file="${configuration-dir}/ivysettings-maven2.xml"/>
+   	<ivy:settings id="advanced.settings" file="${configuration-dir}/ivysettings-advanced.xml"/>
+
+	
     <!-- ================================= 
           target: basic
          ================================= -->
-    <target name="basic" depends="init-basic"
-    		description="--> retrieve files from well formatted ivy repositories">
-    	<ivy:install organisation="apache" module="commons-lang" revision="1.0" from="${from-resolver}" to="${to-resolver}" />
+    <target name="basic" description="--> retrieve files from well formatted ivy repositories">
+    	<ivy:install settingsRef="basic.settings" organisation="apache" module="commons-lang" revision="1.0" from="${from-resolver}" to="${to-resolver}" />
     </target>
 
     <!-- ================================= 
           target: basic-deps
          ================================= -->
-    <target name="basic-deps" depends="init-basic" 
-    		description="--> retrieve files from well formatted ivy repositories with dependencies">
-    	<ivy:install organisation="hibernate" module="hibernate" revision="2.1.8" from="${from-resolver}" to="${to-resolver}" transitive="true" />
+    <target name="basic-deps" description="--> retrieve files from well formatted ivy repositories with dependencies">
+    	<ivy:install settingsRef="basic.settings" organisation="hibernate" module="hibernate" revision="2.1.8" from="${from-resolver}" to="${to-resolver}" transitive="true" />
     </target>
 
     <!-- ================================= 
           target: commons-lang-1-0-ibiblio-no-namespace
          ================================= -->
-    <target name="commons-lang-1-0-ibiblio-no-namespace" depends="init-advanced" 
-    		description="--> retrieve commons-lang 1.0 from ibiblio maven using no namespaces">
-    	<ivy:install organisation="commons-lang" module="commons-lang" revision="1.0" from="ibiblio-maven2-nonamespace" to="${to-resolver}" transitive="true" />
+    <target name="commons-lang-1-0-ibiblio-no-namespace" description="--> retrieve commons-lang 1.0 from ibiblio maven using no namespaces">
+    	<ivy:install settingsRef="advanced.settings" organisation="commons-lang" module="commons-lang" revision="1.0" from="ibiblio-maven2-nonamespace" to="${to-resolver}" transitive="true" />
     </target>
 
     <!-- ================================= 
           target: commons-lang-1-0-ibiblio-with-namespace
          ================================= -->
-    <target name="commons-lang-1-0-ibiblio-with-namespace" depends="init-advanced" 
-    		description="--> retrieve commons-lang 1.0 from ibiblio maven using namespaces">
-    	<ivy:install organisation="apache" module="commons-lang" revision="1.0" from="ibiblio-maven2" to="${to-resolver}" transitive="true" />
+    <target name="commons-lang-1-0-ibiblio-with-namespace" description="--> retrieve commons-lang 1.0 from ibiblio maven using namespaces">
+    	<ivy:install settingsRef="advanced.settings" organisation="apache" module="commons-lang" revision="1.0" from="ibiblio-maven2" to="${to-resolver}" transitive="true" />
     </target>
 
     <!-- ================================= 
           target: advanced
          ================================= -->
-    <target name="advanced" depends="init-advanced" 
-    		description="--> retrieve files from public repositories (ivyrep, ibiblio, ...) using namespaces">
-    	<ivy:install organisation="hibernate" module="hibernate" revision="3.0" from="${from-resolver}" to="${to-resolver}" transitive="true" />
+    <target name="advanced" description="--> retrieve files from public repositories (ivyrep, ibiblio, ...) using namespaces">
+    	<ivy:install settingsRef="advanced.settings" organisation="hibernate" module="hibernate" revision="3.0" from="${from-resolver}" to="${to-resolver}" transitive="true" />
     </target>
 
 	<!-- ================================= 
           target: maven1
          ================================= -->
-    <target name="maven1" depends="init-maven1" 
-    		description="--> retrieve commons-lang 1.0 from maven1 repo using namespaces">
-    	<ivy:install organisation="apache" module="commons-lang" revision="1.0" from="ibiblio-maven" to="${to-resolver}" transitive="true" />
+    <target name="maven1" description="--> retrieve commons-lang 1.0 from maven1 repo using namespaces">
+    	<ivy:install settingsRef="maven1.settings" organisation="apache" module="commons-lang" revision="1.0" from="ibiblio-maven" to="${to-resolver}" transitive="true" />
     </target>
 
     <!-- ================================= 
           target: maven2
          ================================= -->
-    <target name="maven2" depends="init-maven2" 
-    	description="--> retrieve files from maven2 repo using namespaces">
-    	<ivy:install organisation="hibernate" module="hibernate" revision="3.0" from="ibiblio-maven2" to="${to-resolver}" transitive="true" />
+    <target name="maven2" description="--> retrieve files from maven2 repo using namespaces">
+    	<ivy:install settingsRef="maven2.settings" organisation="hibernate" module="hibernate" revision="3.0" from="ibiblio-maven2" to="${to-resolver}" transitive="true" />
     </target>
 
-   	<!-- - - - - - - - - - - - - - - - - - 
-          target: init-advanced
-         - - - - - - - - - - - - - - - - - -->
-    <target name="init-advanced">
-    	<ivy:configure file="${configuration-dir}/ivysettings-advanced.xml"/>
-    </target>
-	
-	<!-- - - - - - - - - - - - - - - - - - 
-          target: init-maven1
-         - - - - - - - - - - - - - - - - - -->
-    <target name="init-maven1">
-    	<ivy:configure file="${configuration-dir}/ivysettings-maven1.xml"/>
-    </target>
-
-	<!-- - - - - - - - - - - - - - - - - - 
-          target: init-maven2
-         - - - - - - - - - - - - - - - - - -->
-    <target name="init-maven2">
-    	<ivy:configure file="${configuration-dir}/ivysettings-maven2.xml"/>
-    </target>
-
-	<!-- - - - - - - - - - - - - - - - - - 
-          target: init-basic
-         - - - - - - - - - - - - - - - - - -->
-    <target name="init-basic">
-    	<ivy:configure file="${configuration-dir}/ivysettings-basic.xml"/>
-    </target>
-
 	<!-- ================================= 
           target: clean-cache
          ================================= -->
Index: src/example/dual/project/build.xml
===================================================================
--- src/example/dual/project/build.xml	(revision 522893)
+++ src/example/dual/project/build.xml	(working copy)
@@ -34,18 +34,12 @@
         <path location="${build.dir}" />
     </path>
     
-    <!-- - - - - - - - - - - - - - - - - - 
-          target: configure 
-          configures ivy with the appropriate ivysettings.xml file                     
-         - - - - - - - - - - - - - - - - - -->
-    <target name="configure">
-        <ivy:configure file="${ivy.settings.dir}/ivysettings.xml" />
-    </target>
+    <ivy:settings file="${ivy.settings.dir}/ivysettings.xml" />
     
     <!-- ================================= 
           target: resolve              
          ================================= -->
-    <target name="resolve" depends="configure" description="--> retrieve dependencies with ivy">
+    <target name="resolve" description="--> retrieve dependencies with ivy">
         <ivy:retrieve />
     </target>
     
Index: src/example/dependence/config/ivysettings.xml
===================================================================
--- src/example/dependence/config/ivysettings.xml	(revision 522893)
+++ src/example/dependence/config/ivysettings.xml	(working copy)
@@ -27,6 +27,6 @@
 		<ivyrep name="libraries" />
 	</resolvers>
 	<modules>
-		<module organisation="apache" name=".*" resolver="projects"/>
+		<module organisation="apache" name="standalone" resolver="projects"/>
 	</modules>
 </ivysettings>
Index: src/example/dependence/standalone/build.xml
===================================================================
--- src/example/dependence/standalone/build.xml	(revision 522893)
+++ src/example/dependence/standalone/build.xml	(working copy)
@@ -36,17 +36,12 @@
         <path location="${classes.dir}" />
     </path>
     
-    <!-- - - - - - - - - - - - - - - - - - 
-          target: configure                      
-         - - - - - - - - - - - - - - - - - -->
-    <target name="configure">
-        <ivy:configure file="${ivy.settings.dir}/ivysettings.xml" />
-    </target>
+    <ivy:settings id="ivy.instance" file="${ivy.settings.dir}/ivysettings.xml" />
     
     <!-- ================================= 
           target: resolve              
          ================================= -->
-    <target name="resolve" depends="configure" description="--> retreive dependencies with ivy">
+    <target name="resolve" description="--> retreive dependencies with ivy">
         <ivy:retrieve />
     </target>
         
Index: src/example/dependence/depending/build.xml
===================================================================
--- src/example/dependence/depending/build.xml	(revision 522893)
+++ src/example/dependence/depending/build.xml	(working copy)
@@ -35,17 +35,13 @@
         <path refid="lib.path.id" />
         <path location="${classes.dir}" />
     </path>
-    <!-- - - - - - - - - - - - - - - - - - 
-          target: configure                      
-         - - - - - - - - - - - - - - - - - -->
-    <target name="configure">
-        <ivy:configure file="${ivy.settings.dir}/ivysettings.xml" />
-    </target>
+
+    <ivy:settings file="${ivy.settings.dir}/ivysettings.xml" />
     
     <!-- ================================= 
           target: resolve              
          ================================= -->
-    <target name="resolve" depends="configure" description="--> retreive dependencies with ivy">
+    <target name="resolve" description="--> retreive dependencies with ivy">
         <ivy:retrieve />
     </target>
     
Index: src/example/chained-resolvers/chainedresolvers-project/build.xml
===================================================================
--- src/example/chained-resolvers/chainedresolvers-project/build.xml	(revision 522893)
+++ src/example/chained-resolvers/chainedresolvers-project/build.xml	(working copy)
@@ -34,18 +34,13 @@
         <path location="${build.dir}" />
     </path>
     
-    <!-- - - - - - - - - - - - - - - - - - 
-          target: configure                      
-         - - - - - - - - - - - - - - - - - -->
-    <target name="configure">
-        <ivy:configure file="${ivy.settings.dir}/ivysettings.xml" />
-    </target>
+    <ivy:settings file="${ivy.settings.dir}/ivysettings.xml" />
     
     <!-- ================================= 
           target: resolve              
          ================================= -->
-    <target name="resolve" depends="configure" description="--> retreive dependencies with ivy">
-        <ivy:retrieve />
+    <target name="resolve" description="--> retreive dependencies with ivy">
+        <ivy:retrieve/>
     </target>
     
     <!-- ================================= 
Index: src/example/multi-project/common/common.xml
===================================================================
--- src/example/multi-project/common/common.xml	(revision 522893)
+++ src/example/multi-project/common/common.xml	(working copy)
@@ -21,7 +21,6 @@
 	<!-- a sample common build.xml file, used for ivy multi-project tutorial
 	     feel free to copy and adapt it to your own needs
 	     Note that the only targets specific to ivy are:
-	        configure
 	     	resolve
 	     	report
 	     	publish
@@ -41,20 +40,20 @@
         <path location="${classes.dir}" />
     </path>
 
-    <target name="configure">
-    	<!-- setup ivy default configuration with some custom info -->
-    	<property name="ivy.local.default.root" value="${repository.dir}/local"/>
-    	<property name="ivy.shared.default.root" value="${repository.dir}/shared"/>
+    
+	<!-- setup ivy default configuration with some custom info -->
+	<property name="ivy.local.default.root" value="${repository.dir}/local"/>
+	<property name="ivy.shared.default.root" value="${repository.dir}/shared"/>
 
-    	<!-- here is how we would have configured ivy if we had our own ivysettings file
-        <ivy:configure file="${common.dir}/ivysettings.xml" />
-         -->
-    </target>
+   	<!-- here is how we would have configured ivy if we had our own ivysettings file
+    <ivy:settings id="ivy.instance file="${common.dir}/ivysettings.xml" />
+    -->
+
 	
     <!-- ================================= 
           target: resolve              
          ================================= -->
-    <target name="resolve" depends="configure, clean-lib" description="--> retrieve dependencies with ivy">
+    <target name="resolve" depends="clean-lib" description="--> retrieve dependencies with ivy">
         <mkdir dir="${lib.dir}"/> <!-- not usually necessary, ivy creates the directory IF there are dependencies -->
     	<!-- this target is named resolve even if we do a retrieve: 
     	     in fact a resolve will be called, and then the retrieve will simply copy files in the lib directory -->
@@ -156,7 +155,7 @@
 	<!-- ================================= 
           target: clean-local              
          ================================= -->
-	<target name="clean-local" depends="configure" description="cleans the local repository for the current module">
+	<target name="clean-local" description="cleans the local repository for the current module">
 	   <delete dir="${ivy.local.default.root}/${ant.project.name}"/>
 	</target>
 
Index: build.xml
===================================================================
--- build.xml	(revision 522893)
+++ build.xml	(working copy)
@@ -299,9 +299,9 @@
         </junit>
 	</target>
 
-	<target name="test" depends="test-internal">
+	<target name="test" depends="test-internal" description="Run the test">
 		<fail if="test.failed"
-		      message="At least one test has failed. See logs for details"/>
+		      message="At least one test has failed. See logs (in ${test.xml.dir}) for details (use the target test-report to run the test with a report)"/>
 	</target>
 	
     <!-- =================================================================
@@ -315,7 +315,7 @@
 			<report format="frames" todir="${test.report.dir}" />
 		</junitreport>
 		<fail if="test.failed"
-		      message="At least one test has failed. See logs or report"/>
+		      message="At least one test has failed. See logs (in ${test.xml.dir}) or report (in ${test.report.dir})"/>
 	</target>
 	
 	<target name="coverage-report" depends="emma, test-report"  unless="skip.test"
Index: .classpath
===================================================================
--- .classpath	(revision 522893)
+++ .classpath	(working copy)
@@ -3,12 +3,12 @@
 	<classpathentry kind="src" path="src/java"/>
 	<classpathentry kind="src" path="test/java"/>
 	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
-	<classpathentry kind="con" path="org.jayasoft.ivyde.eclipse.cpcontainer.IVYDE_CONTAINER/ivy.xml/default,"/>
-	<classpathentry sourcepath="ECLIPSE_HOME/plugins/org.eclipse.jdt.source_3.0.0/src/org.junit_3.8.1/junitsrc.zip" kind="var" path="JUNIT_HOME/junit.jar"/>
-	<classpathentry sourcepath="/ANT_HOME/src/main" kind="var" path="ANT_HOME/lib/ant.jar"/>
+	<classpathentry kind="var" path="JUNIT_HOME/junit.jar" sourcepath="ECLIPSE_HOME/plugins/org.eclipse.jdt.source_3.0.0/src/org.junit_3.8.1/junitsrc.zip"/>
+	<classpathentry kind="var" path="ANT_HOME/lib/ant.jar"/>
 	<classpathentry kind="var" path="ANT_HOME/lib/ant-launcher.jar"/>
 	<classpathentry kind="var" path="ANT_HOME/lib/xercesImpl.jar"/>
 	<classpathentry kind="var" path="ANT_HOME/lib/ant-trax.jar"/>
 	<classpathentry kind="var" path="ANT_HOME/lib/xml-apis.jar"/>
+	<classpathentry kind="lib" path="C:/Documents and Settings/scokartg/.ivy/cache/apache/oro/jars/oro-2.0.8.jar"/>
 	<classpathentry kind="output" path="bin"/>
 </classpath>
Index: doc/doc/use/resolve.html
===================================================================
--- doc/doc/use/resolve.html	(revision 522893)
+++ doc/doc/use/resolve.html	(working copy)
@@ -97,7 +97,7 @@
     <tr><td>transitive</td><td>true to resolve dependencies transitively, false otherwise <span class="since">since 1.4</span></td><td>No. Defaults to true</td></tr>
     <tr><td>showprogress</td><td>true to show dots while downloading, false otherwise</td><td>No. Defaults to true</td></tr>
     <tr><td>validate</td><td>true to force ivy files validation against ivy.xsd, false to force no validation</td><td>No. Defaults to default ivy value (as configured in configuration file)</td></tr>
-</tbody>
+    <tr><td>settingsRef</td><td>A reference to the ivy settings that must be used by this task <b>since 2.0</b></td><td>No, 'ivy.instance' is taken by default.</td></tr></tbody>
 </table>
 <h1>Examples</h1>
 <code type="xml">
Index: doc/doc/use/cachefileset.html
===================================================================
--- doc/doc/use/cachefileset.html	(revision 522893)
+++ doc/doc/use/cachefileset.html	(working copy)
@@ -42,6 +42,7 @@
     <tr><td>conf</td><td>a comma separated list of the configurations to put in the created path</td>
         <td>No. Defaults to the configurations resolved by the last resolve call, or * if no resolve was explicitly called</td></tr>
     <tr><td>type</td><td>comma separated list of artifact types to accept in the path, * for all</td><td>No. Defaults to *</td></tr>
+    <tr><td>settingsRef</td><td><b>Since 2.0</b> A reference to the ivy settings that must be used by this task</td><td>No, 'ivy.instance' is taken by default.</td></tr>
 </tbody>
 </table>
 
Index: doc/doc/use/cachepath.html
===================================================================
--- doc/doc/use/cachepath.html	(revision 522893)
+++ doc/doc/use/cachepath.html	(working copy)
@@ -51,6 +51,7 @@
     <tr><td>type</td><td>comma separated list of artifact types to accept in the path, * for all (<span class="since">since 1.2</span>)</td><td>No. Defaults to *</td></tr>
     <tr><td>useOrigin</td><td>true to use original location of local artifacts, false to use only cache locations <span class="since">since 1.4</span></td>
         <td>No. Defaults false</td></tr>
+    <tr><td>settingsRef</td><td><b>Since 2.0</b> A reference to the ivy settings that must be used by this task</td><td>No, 'ivy.instance' is taken by default.</td></tr>
 </tbody>
 </table>
 
Index: doc/doc/use/configure.html
===================================================================
--- doc/doc/use/configure.html	(revision 522893)
+++ doc/doc/use/configure.html	(working copy)
@@ -24,6 +24,8 @@
 </head>
 <body>
 	<textarea id="xooki-source">
+<b>Since 2.0</b> the configure task is deprecated.  Use the <a href="settings.html">setting</a> declaration<br/>
+
 The configure task is used to configure ivy with an xml settings file.<br/><br/>
 See <a href="../../doc/configuration.html">settings</a> for details about the settings file itself.<br/><br/>
 <i>Note for developers:<br/>
Index: doc/doc/use/repreport.html
===================================================================
--- doc/doc/use/repreport.html	(revision 522893)
+++ doc/doc/use/repreport.html	(working copy)
@@ -65,7 +65,7 @@
         <td>No. Defaults to exactOrRegexp</td></tr>
     <tr><td>validate</td><td>true to force ivy files validation against ivy.xsd, false to force no validation</td>
         <td>No. Defaults to default ivy value (as configured in configuration file)</td></tr>
-</tbody>
+    <tr><td>settingsRef</td><td>A reference to the ivy settings that must be used by this task <b>since 2.0</b></td><td>No, 'ivy.instance' is taken by default.</td></tr></tbody>
 </table>
 
 <h1>Examples</h1>
Index: doc/doc/use/retrieve.html
===================================================================
--- doc/doc/use/retrieve.html	(revision 522893)
+++ doc/doc/use/retrieve.html	(working copy)
@@ -61,7 +61,7 @@
         <td>No. All artifact types are accepted by default.</td></tr>
     <tr><td>useOrigin</td><td>true to copy artifacts from their original location for local artifacts, false to use only cache locations <span class="since">since 1.4</span></td>
         <td>No. Defaults to false</td></tr>
-</tbody>
+    <tr><td>settingsRef</td><td>A reference to the ivy settings that must be used by this task <b>since 2.0</b></td><td>No, 'ivy.instance' is taken by default.</td></tr></tbody>
 </table>
 <h1>Examples</h1>
 <code type="xml">
Index: doc/doc/use/var.html
===================================================================
--- doc/doc/use/var.html	(revision 522893)
+++ doc/doc/use/var.html	(working copy)
@@ -46,6 +46,7 @@
     <tr><td>url</td><td>the url from which to read ivy variables</td></tr>
     <tr><td>prefix</td><td>Prefix to apply to variables. A "." is appended to the prefix if not specified.</td>
         <td>No</td></tr>
+    <tr><td>settingsRef</td><td>A reference to the ivy settings that must be used by this task <b>since 2.0</b></td><td>No, 'ivy.instance' is taken by default.</td></tr>
 </tbody>
 </table>
 
Index: doc/doc/use/artifactreport.html
===================================================================
--- doc/doc/use/artifactreport.html	(revision 522893)
+++ doc/doc/use/artifactreport.html	(working copy)
@@ -56,7 +56,7 @@
   <module organisation="testng" name="testng" rev="4.6.1-jdk15" status="release">
     <artifact name="testng" ext="jar" type="jar">
       <origin-location is-local="false">
-        http://repository.hippocms.org/maven/testng/jars/testng-4.6.1-jdk15.jar&lt;/origin-location>
+        http://repository.hippocms.org/maven/testng/jars/testng-4.6.1-jdk15.jar</origin-location>
       <cache-location>C:/home/jstuyts/data/ivy/cache/testng/testng/jars/testng-4.6.1-jdk15.jar</cache-location>
       <retrieve-location>lib/test/testng-4.6.1-jdk15.jar</retrieve-location>
     </artifact>
@@ -76,6 +76,7 @@
     <tr><td>conf</td><td>a comma separated list of the configurations to use to generate the report</td>
         <td>No. Defaults to the configurations resolved by the last resolve call</td></tr>
     <tr><td>haltonfailure</td><td>true to halt the build on ivy failure, false to continue</td><td>No. Defaults to true</td></tr>
+    <tr><td>settingsRef</td><td>A reference to the ivy settings that must be used by this task <b>(since 2.0)</b></td><td>No, 'ivy.instance' is taken by default.</td></tr>
 </tbody>
 </table>
 <h1>Examples</h1>
Index: doc/doc/use/deliver.html
===================================================================
--- doc/doc/use/deliver.html	(revision 522893)
+++ doc/doc/use/deliver.html	(working copy)
@@ -94,6 +94,7 @@
         <td>No. Defaults to default ivy value (as configured in configuration file)</td></tr>
     <tr><td>replacedynamicrev</td><td>true to replace dynmic revisions by static ones in the delivered file, false to avoid this replacement <span class="since">since 1.3</span></td>
         <td>No. Defaults to true</td></tr>
+    <tr><td>settingsRef</td><td>A reference to the ivy settings that must be used by this task <b>since 2.0</b></td><td>No, 'ivy.instance' is taken by default.</td></tr>
 </tbody>
 </table>
 
Index: doc/doc/use/buildlist.html
===================================================================
--- doc/doc/use/buildlist.html	(revision 522893)
+++ doc/doc/use/buildlist.html	(working copy)
@@ -51,6 +51,7 @@
     <tr><td>haltonerror</td><td>true to halt the build when an invalid ivy file is encountered, false to continue</td><td>No. Defaults to true</td></tr>
     <tr><td>skipbuildwithoutivy</td><td>true to skip files of the fileset with no corresponding ivy file, false otherwise. If false the file with no corresponding ivy file will be considered as independent of the other and put at the beginning of the built filelist.</td><td>No. Defaults to false</td></tr>
     <tr><td>reverse</td><td>true to obtain the list in the reverse order, i.e. from the most dependent to the least one</td><td>No. Defaults to default false</td></tr>
+    <tr><td>settingsRef</td><td><b>since 2.0</b> A reference to the ivy settings that must be used by this task</td><td>No, 'ivy.instance' is taken by default.</td></tr>
 </tbody>
 </table>
 
Index: doc/doc/use/info.html
===================================================================
--- doc/doc/use/info.html	(revision 522893)
+++ doc/doc/use/info.html	(working copy)
@@ -44,7 +44,7 @@
 <tbody>
     <tr><td>file</td><td>the ivy file to parse</td>
         <td>Yes</td></tr>
-</tbody>
+<tr><td>settingsRef</td><td>A reference to the ivy settings that must be used by this task <b>since 2.0</b></td><td>No, 'ivy.instance' is taken by default.</td></tr></tbody>
 </table>
 <h1>Examples</h1>
 <code type="xml">
Index: doc/doc/use/findrevision.html
===================================================================
--- doc/doc/use/findrevision.html	(revision 522893)
+++ doc/doc/use/findrevision.html	(working copy)
@@ -46,6 +46,7 @@
         <td>Yes</td></tr>
     <tr><td>property</td><td>the property to set with the found revision</td>
         <td>No, defaults to ivy.revision</td></tr>
+<tr><td>settingsRef</td><td>A reference to the ivy settings that must be used by this task <b>since 2.0</b></td><td>No, 'ivy.instance' is taken by default.</td></tr>
 </tbody>
 </table>
 <h1>Examples</h1>
Index: doc/doc/use/settings.html
===================================================================
--- doc/doc/use/settings.html	(revision 0)
+++ doc/doc/use/settings.html	(revision 0)
@@ -0,0 +1,80 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<!--
+   Licensed to the Apache Software Foundation (ASF) under one
+   or more contributor license agreements.  See the NOTICE file
+   distributed with this work for additional information
+   regarding copyright ownership.  The ASF licenses this file
+   to you under the Apache License, Version 2.0 (the
+   "License"); you may not use this file except in compliance
+   with the License.  You may obtain a copy of the License at
+
+     http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing,
+   software distributed under the License is distributed on an
+   "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+   KIND, either express or implied.  See the License for the
+   specific language governing permissions and limitations
+   under the License.    
+-->
+<html>
+<head>
+	<script type="text/javascript">var xookiConfig = {level: 2};</script>	
+	<script type="text/javascript" src="../../xooki/xooki.js"></script>
+</head>
+<body>
+	<textarea id="xooki-source">
+<b>Since 2.0</b>
+
+The settings declaration is used to configure ivy with an xml settings file.<br/><br/>
+
+See <a href="../../doc/doc/configuration.html">Settings Files</a> for details about the settings file itself.<br/><br/>
+
+Multiple settings can be defined in a build script.  Every task can reference his own settings.<br/><br/>
+
+<table class="ant">
+<thead>
+    <tr><th class="ant-att">Attribute</th><th class="ant-desc">Description</th><th class="ant-req">Required</th></tr>
+</thead>
+<tbody>
+    <tr><td>id</td><td>An reference id that can be reused in the ivy task.</td><td>No. "ivy.instance is used as a default value</td></tr>
+    <tr><td>file</td><td>path to the settings file to use</td>
+        <td rowspan="2">No. If a file is provided, url is ignored. If none are provided, then it attempts to find a file at ${ivy.settings.file}, and if this file does not exist, it uses a <a href="./misc/ivy/samples/ivysettings-default.xml">default settings file</a></td></tr>
+    <tr><td>url</td><td>url of the settings file to use</td></tr>
+    <tr><td>host</td><td>http authentication host</td><td rowspan="4">No, unless authentication is required</td></tr>
+    <tr><td>realm</td><td>http authentication realm</td></tr>
+    <tr><td>username</td><td>http authentication user name</td></tr>
+    <tr><td>passwd</td><td>http authentication password</td></tr>
+</tbody>
+</table>
+<h2>HTTP Authentication</h2>
+<i>Note: HTTP Authentication can be used only if <a href="http://jakarta.apache.org/commons/httpclient/">commons-httpclient.jar</a> is in your classpath</i>
+If any of the url you use in ivy (especially in dependency resolvers) need http
+authentication, then you have to provide the host, realm, username and passwd
+attributes of the configure task. These settings will then be used in any
+further call to ivy tasks.<br/><br/>
+
+<h2>Multiple classloader</h2>
+A special attention should be applied when you have a multi-project build with <i>subant</i> call, using ivy task loaded by a <i>typedef</i>.  Indeed in this situation, it is possible to pass settings reference to a subbuild.  When you do that, you should take of the classloader.  The ivy task of your subant should not be defined in a different classloader than the parent one.  This can be achieved by using the <i>loader</i> parameter of the antlib declaration, or avoid to reload the ivy antlib in the subbuild (place the taskdef in a target only executed when the antlib is not yet loaded).<br/><br/>
+
+
+<h2>Examples</h2>
+<h3>Simplest settings</h3>
+<code><ivy:settings/></code>
+Use either ${ivy.settings.file} if it exists, or the <a href="./misc/ivy/samples/ivysettings-default.xml">default settings file</a><br>
+This simplest setting is implicit.  If you don't declare any settings with the id <i>ivy.instance</i>, this declaration is used by default.
+<h3>Configure with a file</h3>
+<code><ivy:settings file="myconffile.xml" /></code>
+<h3>Configure with an url</h3>
+<code><ivy:settings url="http://mysite.com/myconffile.xml" /></code>
+<h3>Configure multiple URLs which require autentication</h3>
+<code>
+<ivy:settings id="authenticated.settings" file="path/to/my/ivysettings.xml">
+  <credentials host="myhost.com" realm="My Realm" username="myuser" passwd="mypasswd" />
+  <credentials host="yourhost.com" realm="Your Realm" username="myuser" passwd="myotherpasswd" />
+</ivy:configure> 
+</code>
+	</textarea>
+<script type="text/javascript">xooki.postProcess();</script>
+</body>
+</html>

Property changes on: doc\doc\use\settings.html
___________________________________________________________________
Name: svn:keywords
   + "Author Date Id Revision"
Name: svn:eol-style
   + native

Index: doc/doc/use/artifactproperty.html
===================================================================
--- doc/doc/use/artifactproperty.html	(revision 522893)
+++ doc/doc/use/artifactproperty.html	(working copy)
@@ -45,6 +45,7 @@
     <tr><td>haltonfailure</td><td>true to halt the build on ivy failure, false to continue</td><td>No. Defaults to true</td></tr>
     <tr><td>validate</td><td>true to force ivy files validation against ivy.xsd, false to force no validation</td>
         <td>No. Defaults to default ivy value (as configured in configuration file)</td></tr>
+    <tr><td>settingsRef</td><td>A reference to the ivy settings that must be used by this task <b>(since 2.0)</b></td><td>No, 'ivy.instance' is taken by default.</td></tr>
 </tbody>
 </table>
 
Index: doc/doc/use/listmodules.html
===================================================================
--- doc/doc/use/listmodules.html	(revision 522893)
+++ doc/doc/use/listmodules.html	(working copy)
@@ -50,7 +50,7 @@
     <tr><td>property</td><td>the pattern of the property to set when a module is found</td>
         <td>Yes</td></tr>
     <tr><td>value</td><td>The pattern of the value to set when a module is found</td><td>Yes</td></tr>
-</tbody>
+<tr><td>settingsRef</td><td>A reference to the ivy settings that must be used by this task <b>since 2.0</b></td><td>No, 'ivy.instance' is taken by default.</td></tr></tbody>
 </table>
 <h1>Examples</h1>
 <code type="xml">
Index: doc/doc/use/publish.html
===================================================================
--- doc/doc/use/publish.html	(revision 522893)
+++ doc/doc/use/publish.html	(working copy)
@@ -69,7 +69,7 @@
         <td>No. Defaults to ${ivy.status}</td></tr>
     <tr><td>delivertarget</td><td>the target to call for recursive delivery</td>
         <td>No. No recursive delivery is done by default</td></tr>
-</tbody>
+    <tr><td>settingsRef</td><td>A reference to the ivy settings that must be used by this task <b>since 2.0</b></td><td>No, 'ivy.instance' is taken by default.</td></tr></tbody>
 </table>
 <h1>Examples</h1>
 <code type="xml">
Index: doc/doc/use/install.html
===================================================================
--- doc/doc/use/install.html	(revision 522893)
+++ doc/doc/use/install.html	(working copy)
@@ -55,7 +55,7 @@
         <td>No, defaults to false</td></tr>
     <tr><td>matcher</td><td>the name of the matcher to use to find the modules to install</td>
         <td>No, defaults to exact</td></tr>
-</tbody>
+<tr><td>settingsRef</td><td>A reference to the ivy settings that must be used by this task <b>since 2.0</b></td><td>No, 'ivy.instance' is taken by default.</td></tr></tbody>
 </table>
 <h1>Examples</h1>
 <code type="xml">
Index: doc/doc/use/postresolvetask.html
===================================================================
--- doc/doc/use/postresolvetask.html	(revision 522893)
+++ doc/doc/use/postresolvetask.html	(working copy)
@@ -61,7 +61,7 @@
     <tr><td>transitive</td><td>true to resolve dependencies transitively, false otherwise <span class="since">since 1.4</span></td><td>No. Defaults to true</td></tr>
     <tr><td>haltonfailure</td><td>true to halt the build on ivy failure, false to continue</td><td>No. Defaults to true</td></tr>
     <tr><td>validate</td><td>true to force ivy files validation against ivy.xsd, false to force no validation</td><td>No. Defaults to default ivy value (as configured in configuration file)</td></tr>
-</tbody>
+<tr><td>settingsRef</td><td>A reference to the ivy settings that must be used by this task <b>since 2.0</b></td><td>No, 'ivy.instance' is taken by default.</td></tr></tbody>
 </table>
 <h1>Examples</h1>
 <code type="xml">
Index: doc/doc/use/buildnumber.html
===================================================================
--- doc/doc/use/buildnumber.html	(revision 522893)
+++ doc/doc/use/buildnumber.html	(working copy)
@@ -76,6 +76,7 @@
         <td>No, defaults to '.'</td></tr>
     <tr><td>prefix</td><td>the prefix to use for the property names set (will be <i>prefix</i>.revision, <i>prefix</i>.new.revision, ...)</td>
         <td>No, defaults to ivy</td></tr>
+    <tr><td>settingsRef</td><td><b>Since 2.0</b> A reference to the ivy settings that must be used by this task</td><td>No, 'ivy.instance' is taken by default.</td></tr>
 </tbody>
 </table>
 <h1>Examples</h1>
Index: doc/doc/use/report.html
===================================================================
--- doc/doc/use/report.html	(revision 522893)
+++ doc/doc/use/report.html	(working copy)
@@ -30,7 +30,6 @@
 In fact, this task uses xml report generated by resolve in cache. So if you call resolve on a module for a given configuration, you can call report safely on this module and this configuration as long as you do not clean your ivy cache.
 
 If you want to have an idea of what reports look like, check this very simple <a href="../../samples/jayasoft-ivyrep-example-default.html">example</a>.
-
 The task also generates a graphml file which can be loaded with the free <a href="http://www.yworks.com/en/products_yed_about.htm">yEd</a> graph editor.
 Then following a few <a href="../../doc/yed.html">simple steps</a> you can obtain a graph like this <a href="../../samples/jayasoft-ivyrep-example-default.jpg">one</a>.
 
@@ -63,7 +62,7 @@
         <td>No. Defaults to default ivy value (as configured in configuration file)</td></tr>
     <tr><td>xslfile</td><td>indicates which xsl file should be used to generate the report</td>
         <td>No, defaults to ivy provided xsl which generates html report</td></tr>
-</tbody>
+    <tr><td>settingsRef</td><td>A reference to the ivy settings that must be used by this task <b>since 2.0</b></td><td>No, 'ivy.instance' is taken by default.</td></tr></tbody>
 </table>
 
 <h1>Examples</h1>
Index: doc/doc/tutorial/multiproject.html
===================================================================
--- doc/doc/tutorial/multiproject.html	(revision 522893)
+++ doc/doc/tutorial/multiproject.html	(working copy)
@@ -112,23 +112,23 @@
 So, here are some aspects of this common build file:
 <h2>ivy settings</h2>
 <code type="xml">
-<target name="configure">
+
     <!-- setup ivy default configuration with some custom info -->
     <property name="ivy.local.default.root" value="${repository.dir}/local"/>
     <property name="ivy.shared.default.root" value="${repository.dir}/shared"/>
 
     <!-- here is how we would have configured ivy if we had our own ivysettings file
-        <ivy:configure file="${common.dir}/ivysettings.xml" />
+       <ivy:settings file="${common.dir}/ivysettings.xml" />
     -->
 </target>
 </code>
 
-This target configures ivy only by setting two properties: the location for the local repository and the location for the shared repository. It's the only settings done here, since ivy 1.3 is configured by default to work in a team environment (see <a href="../../tutorial/defaultconf.html">default settings tutorial</a> for details about this). For sure in a real environment the shared repository location would rather be in a team shared directory (or in a more complex repository, again see the default settings tutorial to see how to use something really different).
-This target only indicates in comments how the settings would have been done if the default settings wasn't ok for our purpose.
+This declaration configures ivy only by setting two properties: the location for the local repository and the location for the shared repository. It's the only settings done here, since ivy 1.3 is configured by default to work in a team environment (see <a href="../../tutorial/defaultconf.html">default settings tutorial</a> for details about this). For sure in a real environment the shared repository location would rather be in a team shared directory (or in a more complex repository, again see the default settings tutorial to see how to use something really different).
+There is only in comments how the settings would have been done if the default settings wasn't ok for our purpose.
 
 <h2>resolve dependencies</h2>
 <code type="xml">
-<target name="resolve" depends="configure, clean-lib" description="--> retrieve dependencies with ivy">
+<target name="resolve" depends="clean-lib" description="--> retrieve dependencies with ivy">
     <mkdir dir="${lib.dir}"/> <!-- not usually necessary, ivy creates the directory IF there are dependencies -->
     <!-- this target is named resolve even if we do a retrieve: 
          in fact a resolve will be called, and then the retrieve will simply copy files in the lib directory -->
Index: doc/doc/tutorial/build-repository/basic.html
===================================================================
--- doc/doc/tutorial/build-repository/basic.html	(revision 522893)
+++ doc/doc/tutorial/build-repository/basic.html	(working copy)
@@ -54,11 +54,13 @@
 <h1>basic, retrieve commons-lang 1.0</h1>
 Let's have a look at the <em>basic</em> target.
 <code type="xml">
-    <target name="basic" depends="init-basic" description="--> retrieve files from well formatted ivy repositories">
-        <ivy:install organisation="apache" module="commons-lang" revision="1.0" from="${from-resolver}" to="${to-resolver}" />
+    <ivy:settings id="basic.settings"    file="${configuration-dir}/ivysettings-basic.xml"/>
+
+    <target name="basic" description="--> retrieve files from well formatted ivy repositories">
+        <ivy:install settingsRef="basic.settings" organisation="apache" module="commons-lang" revision="1.0" from="${from-resolver}" to="${to-resolver}" />
     </target>
 </code>
-After a call to init-basic, that make the ivy initialization with the right ivysettings file, we only call the task <a href="../../../doc/use/install.html">install</a> to retrieve apache commons-lang in it's 1.0 version.
+After a declaration of the basic.settings, that make the ivy initialization with the right ivysettings file, we only call the task <a href="../../../doc/use/install.html">install</a> to retrieve apache commons-lang in it's 1.0 version.
 Here is the ant call output :
 <div class="shell"><pre>Z:\ivy-repository>ant basic
 Buildfile: build.xml
@@ -93,8 +95,8 @@
 <h1>basic with dependencies, retrieve hibernate 2.1.8</h1>
 Now let's advance a little more by trying a module that has some dependencies. Here is the target that we will call :
 <code type="xml">
-    <target name="basic-deps" depends="init-basic" description="--> retrieve files from well formatted ivy repositories with dependencies">
-        <ivy:install organisation="hibernate" module="hibernate" revision="2.1.8" from="${from-resolver}" to="${to-resolver}" transitive="true" />
+    <target name="basic-deps" description="--> retrieve files from well formatted ivy repositories with dependencies">
+        <ivy:install settingsRef="basic.settings" organisation="hibernate" module="hibernate" revision="2.1.8" from="${from-resolver}" to="${to-resolver}" transitive="true" />
     </target>
 </code>This target is very similar to the basic one, except it defines the transitivity mode to use. By writing, <em>transitive="true"</em>, we tell the task to retrieve the corresponding module and it's dependencies.
 
Index: doc/toc.json
===================================================================
--- doc/toc.json	(revision 522893)
+++ doc/toc.json	(working copy)
@@ -362,7 +362,7 @@
             },
             {
               "id":"doc/configuration",
-              "title":"Settings",
+              "title":"Settings Files",
               "children": [
                   {
                     "id":"doc/configuration/property",
@@ -889,6 +889,14 @@
                       ]
                   },
                   {
+                    "id":"doc/use/settings",
+                    "title":"settings",
+                    "children": [
+
+                      ]
+,
+                    "level":0                  },
+                  {
                     "id":"doc/use/var",
                     "title":"var",
                     "children": [
