You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ivy-commits@incubator.apache.org by ma...@apache.org on 2007/05/02 22:35:32 UTC

svn commit: r534641 - in /incubator/ivy/core/trunk: ./ doc/doc/use/ src/java/org/apache/ivy/ src/java/org/apache/ivy/ant/ src/java/org/apache/ivy/core/deliver/ src/java/org/apache/ivy/core/publish/ src/java/org/apache/ivy/plugins/parser/xml/ src/java/o...

Author: maartenc
Date: Wed May  2 15:35:31 2007
New Revision: 534641

URL: http://svn.apache.org/viewvc?view=rev&rev=534641
Log:
NEW: Hide private or specific conf when publishing (IVY-77)

Added:
    incubator/ivy/core/trunk/src/java/org/apache/ivy/util/ConfigurationUtils.java
    incubator/ivy/core/trunk/test/java/org/apache/ivy/plugins/parser/xml/test-update-excludedconfs1.xml
    incubator/ivy/core/trunk/test/java/org/apache/ivy/plugins/parser/xml/test-update-excludedconfs2.xml
    incubator/ivy/core/trunk/test/java/org/apache/ivy/plugins/parser/xml/test-update-excludedconfs3.xml
    incubator/ivy/core/trunk/test/java/org/apache/ivy/plugins/parser/xml/test-update-excludedconfs4.xml
    incubator/ivy/core/trunk/test/java/org/apache/ivy/plugins/parser/xml/test-update-excludedconfs5.xml
Modified:
    incubator/ivy/core/trunk/CHANGES.txt
    incubator/ivy/core/trunk/doc/doc/use/artifactproperty.html
    incubator/ivy/core/trunk/doc/doc/use/artifactreport.html
    incubator/ivy/core/trunk/doc/doc/use/deliver.html
    incubator/ivy/core/trunk/doc/doc/use/publish.html
    incubator/ivy/core/trunk/src/java/org/apache/ivy/Ivy14.java
    incubator/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyDeliver.java
    incubator/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyPublish.java
    incubator/ivy/core/trunk/src/java/org/apache/ivy/core/deliver/DeliverEngine.java
    incubator/ivy/core/trunk/src/java/org/apache/ivy/core/deliver/DeliverOptions.java
    incubator/ivy/core/trunk/src/java/org/apache/ivy/core/publish/PublishEngine.java
    incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/xml/XmlModuleDescriptorParser.java
    incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/xml/XmlModuleDescriptorUpdater.java
    incubator/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyPublishTest.java
    incubator/ivy/core/trunk/test/java/org/apache/ivy/plugins/parser/xml/XmlModuleUpdaterTest.java

Modified: incubator/ivy/core/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/CHANGES.txt?view=diff&rev=534641&r1=534640&r2=534641
==============================================================================
--- incubator/ivy/core/trunk/CHANGES.txt (original)
+++ incubator/ivy/core/trunk/CHANGES.txt Wed May  2 15:35:31 2007
@@ -46,6 +46,8 @@
 
    version in SVN
 =====================================
+- NEW: Hide private or specific conf when publishing (IVY-77)
+
 - IMPROVEMENT: Allow "main" parameters to be passed directly (instead of using -args flag) (IVY-480) (thanks to Archie Cobbs)
 
 - FIX: Cache is storing ArtifactOrigin properties with no guarantee of unicity and types telescope during resolve. (IVY-430) (thanks to Stephane Bailliez)

Modified: incubator/ivy/core/trunk/doc/doc/use/artifactproperty.html
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/doc/doc/use/artifactproperty.html?view=diff&rev=534641&r1=534640&r2=534641
==============================================================================
--- incubator/ivy/core/trunk/doc/doc/use/artifactproperty.html (original)
+++ incubator/ivy/core/trunk/doc/doc/use/artifactproperty.html Wed May  2 15:35:31 2007
@@ -24,11 +24,11 @@
 	<script type="text/javascript" src="../../xooki/xooki.js"></script>
 </head>
 <body>
-	<textarea id="xooki-source">
+	<textarea id="xooki-source">
 <div class="since">since 1.1</div>
 Sets an ant property for each dependency artifacts previously resolved.
 
-<span class="since">since 1.5</span> This is a [[ant:postresolvetask post resolve task]], with all the behaviour and attributes common to all post resolve tasks.
+<span class="since">since 2.0</span> This is a [[ant:postresolvetask post resolve task]], with all the behaviour and attributes common to all post resolve tasks.
 
 Please prefer the use of retrieve + standard ant path creation, which make your build more independent from ivy (once artifacts are properly retrieved, ivy is not required any more).
 

Modified: incubator/ivy/core/trunk/doc/doc/use/artifactreport.html
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/doc/doc/use/artifactreport.html?view=diff&rev=534641&r1=534640&r2=534641
==============================================================================
--- incubator/ivy/core/trunk/doc/doc/use/artifactreport.html (original)
+++ incubator/ivy/core/trunk/doc/doc/use/artifactreport.html Wed May  2 15:35:31 2007
@@ -24,11 +24,11 @@
 	<script type="text/javascript" src="../../xooki/xooki.js"></script>
 </head>
 <body>
-	<textarea id="xooki-source">
+	<textarea id="xooki-source">
 <span class="since">since 1.4</span>
 The artifactreport task generates an xml report of all artifacts dependencies resolved by the last <a href="../../doc/use/resolve.html">resolve</a> task call during the same build.
 
-<span class="since">since 1.5</span> This is a [[ant:postresolvetask post resolve task]], with all the behaviour and attributes common to all post resolve tasks.
+<span class="since">since 2.0</span> This is a [[ant:postresolvetask post resolve task]], with all the behaviour and attributes common to all post resolve tasks.
 
 This report is different from the standard <a href="../../doc/use/report.html">report</a> which reports all modules and artifacts, whle this report is much simpler and focuses only on artifacts, and gives more information on artifacts, such as the original location and the retrieve location. 
 
@@ -59,7 +59,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>

Modified: incubator/ivy/core/trunk/doc/doc/use/deliver.html
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/doc/doc/use/deliver.html?view=diff&rev=534641&r1=534640&r2=534641
==============================================================================
--- incubator/ivy/core/trunk/doc/doc/use/deliver.html (original)
+++ incubator/ivy/core/trunk/doc/doc/use/deliver.html Wed May  2 15:35:31 2007
@@ -24,7 +24,7 @@
 	<script type="text/javascript" src="../../xooki/xooki.js"></script>
 </head>
 <body>
-	<textarea id="xooki-source">
+	<textarea id="xooki-source">
 Delivers a resolved ivy file of the current module, and possibly do recursive delivery of dependencies. 
 This task does two main things:
 <h2>Generate a resolved ivy file</h2>
@@ -95,10 +95,17 @@
         <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>conf</td><td>comma-separated list of configurations to include in the delivered file. Accepts wildcards. <span class="since">since 2.0</span></td>
+        <td>No. Defaults to all configurations</td></tr>
 </tbody>
 </table>
 
-	</textarea>
+<h1>Example</h1>
+Deliver an ivy file without the private configurations:
+<code type="xml">
+<deliver conf="*(public)" /> 
+</code>
+</textarea>
 <script type="text/javascript">xooki.postProcess();</script>
 </body>
 </html>

Modified: incubator/ivy/core/trunk/doc/doc/use/publish.html
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/doc/doc/use/publish.html?view=diff&rev=534641&r1=534640&r2=534641
==============================================================================
--- incubator/ivy/core/trunk/doc/doc/use/publish.html (original)
+++ incubator/ivy/core/trunk/doc/doc/use/publish.html Wed May  2 15:35:31 2007
@@ -24,7 +24,7 @@
 	<script type="text/javascript" src="../../xooki/xooki.js"></script>
 </head>
 <body>
-	<textarea id="xooki-source">
+	<textarea id="xooki-source">
 Publishes the current modules artifacts.
 
 This task is meant to publish the declared published artifacts of the current module to a repository.
@@ -54,8 +54,8 @@
         <td>No. Defaults to true</td></tr>
     <tr><td>publishivy</td><td>True to publish delivered ivy file, false otherwise</td>
         <td>No. Defaults to true</td></tr>
-    <tr><td>conf</td><td>A comma separated list of configurations to publish. Note that the ivy file won't be published in this case, publishivy must be set to false. <span class="since">since 1.4.1</span></td>
-        <td>No. Defaults to all configurations published</td></tr>
+    <tr><td>conf</td><td>A comma separated list of configurations to publish.  <span class="since">since 1.4.1</span></td>
+        <td>No. Defaults to all configurations</td></tr>
     <tr><td>overwrite</td><td>True to overwrite files in repository if the revision already exist, false to let it as is</td>
         <td>No. Defaults to false</td></tr>
     <tr><td>warnonmissing</td><td>True to warn when artifacts to be published are missing</td>

Modified: incubator/ivy/core/trunk/src/java/org/apache/ivy/Ivy14.java
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/src/java/org/apache/ivy/Ivy14.java?view=diff&rev=534641&r1=534640&r2=534641
==============================================================================
--- incubator/ivy/core/trunk/src/java/org/apache/ivy/Ivy14.java (original)
+++ incubator/ivy/core/trunk/src/java/org/apache/ivy/Ivy14.java Wed May  2 15:35:31 2007
@@ -97,7 +97,7 @@
 	}
 
 	public void deliver(ModuleRevisionId mrid, String revision, File cache, String destIvyPattern, String status, Date pubdate, PublishingDependencyRevisionResolver pdrResolver, boolean validate, boolean resolveDynamicRevisions) throws IOException, ParseException {
-		_ivy.deliver(mrid, revision, destIvyPattern, new DeliverOptions(status, pubdate, CacheManager.getInstance(_ivy.getSettings(), cache), pdrResolver, validate, resolveDynamicRevisions));
+		_ivy.deliver(mrid, revision, destIvyPattern, new DeliverOptions(status, pubdate, CacheManager.getInstance(_ivy.getSettings(), cache), pdrResolver, validate, resolveDynamicRevisions, null));
 	}
 
 	public void deliver(ModuleRevisionId mrid, String revision, File cache, String destIvyPattern, String status, Date pubdate, PublishingDependencyRevisionResolver pdrResolver, boolean validate) throws IOException, ParseException {

Modified: incubator/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyDeliver.java
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyDeliver.java?view=diff&rev=534641&r1=534640&r2=534641
==============================================================================
--- incubator/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyDeliver.java (original)
+++ incubator/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyDeliver.java Wed May  2 15:35:31 2007
@@ -215,6 +215,8 @@
     private boolean _replacedynamicrev = true;
     
     private String _resolveId;
+    
+    private String _conf;
 
     public File getCache() {
         return _cache;
@@ -303,6 +305,14 @@
     public void setResolveId(String resolveId) {
     	_resolveId = resolveId;
     }
+    
+    public String getConf() {
+    	return _conf;
+    }
+    
+    public void setConf(String confs) {
+    	_conf = confs;
+    }
 
     public void execute() throws BuildException {
     	Ivy ivy = getIvyInstance();
@@ -379,7 +389,7 @@
             
             DeliverOptions options = new DeliverOptions(_status, pubdate, 
     				CacheManager.getInstance(settings, _cache), 
-    				drResolver, doValidate(settings), _replacedynamicrev).setResolveId(_resolveId);
+    				drResolver, doValidate(settings), _replacedynamicrev, splitConfs(_conf)).setResolveId(_resolveId);
             if (mrid == null) {
             	ivy.deliver(_pubRevision, _deliverpattern, options);
             } else {

Modified: incubator/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyPublish.java
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyPublish.java?view=diff&rev=534641&r1=534640&r2=534641
==============================================================================
--- incubator/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyPublish.java (original)
+++ incubator/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyPublish.java Wed May  2 15:35:31 2007
@@ -218,13 +218,6 @@
         ModuleRevisionId mrid = ModuleRevisionId.newInstance(_organisation, _module, _revision);
         try {
             File ivyFile = new File(IvyPatternHelper.substitute(_srcivypattern, _organisation, _module, _pubRevision, "ivy", "ivy", "xml"));
-            if (null!=_conf && isPublishivy()) {
-            	if (isPublishivy()) {
-            		Message.warn("Impossible to publish ivy file when conf is specified");
-            		Message.warn("Please, set publishivy to false");
-            		setPublishivy(false);
-            	}
-            }
             if (_publishivy && (!ivyFile.exists() || _forcedeliver)) {
                 IvyDeliver deliver = new IvyDeliver();
                 deliver.setProject(getProject());
@@ -240,6 +233,7 @@
                 deliver.setStatus(getStatus());
                 deliver.setValidate(doValidate(settings));
                 deliver.setReplacedynamicrev(isReplacedynamicrev());
+                deliver.setConf(_conf);
                 
                 deliver.execute();
             }

Modified: incubator/ivy/core/trunk/src/java/org/apache/ivy/core/deliver/DeliverEngine.java
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/src/java/org/apache/ivy/core/deliver/DeliverEngine.java?view=diff&rev=534641&r1=534640&r2=534641
==============================================================================
--- incubator/ivy/core/trunk/src/java/org/apache/ivy/core/deliver/DeliverEngine.java (original)
+++ incubator/ivy/core/trunk/src/java/org/apache/ivy/core/deliver/DeliverEngine.java Wed May  2 15:35:31 2007
@@ -23,10 +23,13 @@
 import java.net.MalformedURLException;
 import java.net.URL;
 import java.text.ParseException;
+import java.util.Arrays;
 import java.util.HashMap;
+import java.util.HashSet;
 import java.util.Iterator;
 import java.util.Map;
 import java.util.Properties;
+import java.util.Set;
 
 import org.apache.ivy.core.IvyPatternHelper;
 import org.apache.ivy.core.module.descriptor.DependencyDescriptor;
@@ -36,6 +39,7 @@
 import org.apache.ivy.plugins.parser.xml.XmlModuleDescriptorParser;
 import org.apache.ivy.plugins.parser.xml.XmlModuleDescriptorUpdater;
 import org.apache.ivy.plugins.report.XmlReportParser;
+import org.apache.ivy.util.ConfigurationUtils;
 import org.apache.ivy.util.Message;
 import org.xml.sax.SAXException;
 
@@ -92,7 +96,7 @@
         // 1) find the resolved module descriptor in cache
         File ivyFile = options.getCache().getResolvedIvyFileInCache(mrid);
         if (!ivyFile.exists()) {
-            throw new IllegalStateException("ivy file not found in cache for "+mrid+": please resolve dependencies before publishing ("+ivyFile+")");
+            throw new IllegalStateException("ivy file not found in cache for "+mrid+": please resolve dependencies before delivering ("+ivyFile+")");
         }
         ModuleDescriptor md = null;
         URL ivyFileURL = null;
@@ -112,7 +116,7 @@
         Map dependenciesStatus = new HashMap(); // Map (ModuleId -> String status)
         File ivyProperties = options.getCache().getResolvedIvyPropertiesInCache(mrid);
         if (!ivyProperties.exists()) {
-            throw new IllegalStateException("ivy properties not found in cache for "+mrid+": please resolve dependencies before publishing ("+ivyFile+")");
+            throw new IllegalStateException("ivy properties not found in cache for "+mrid+": please resolve dependencies before delivering ("+ivyFile+")");
         }
         Properties props = new Properties();
         FileInputStream in = new FileInputStream(ivyProperties);
@@ -149,10 +153,16 @@
         //    PublishingDependencyRevisionResolver
         String publishedIvy = IvyPatternHelper.substitute(destIvyPattern, md.getResolvedModuleRevisionId());
         Message.info("\tdelivering ivy file to "+publishedIvy);
+        
+		String[] confs = ConfigurationUtils.replaceWildcards(options.getConfs(), md);
+		Set confsToRemove = new HashSet(Arrays.asList(md.getConfigurationsNames()));
+		confsToRemove.removeAll(Arrays.asList(confs));
+
         try {
             XmlModuleDescriptorUpdater.update(_settings, ivyFileURL, 
                     new File(publishedIvy),
-                    resolvedDependencies, options.getStatus(), revision, options.getPubdate(), null, true);
+                    resolvedDependencies, options.getStatus(), revision, options.getPubdate(), null, true, (
+                    String[]) confsToRemove.toArray(new String[confsToRemove.size()]));
         } catch (SAXException ex) {
             throw new RuntimeException("bad ivy file in cache for "+mrid+": please clean and resolve again" , ex);
         }

Modified: incubator/ivy/core/trunk/src/java/org/apache/ivy/core/deliver/DeliverOptions.java
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/src/java/org/apache/ivy/core/deliver/DeliverOptions.java?view=diff&rev=534641&r1=534640&r2=534641
==============================================================================
--- incubator/ivy/core/trunk/src/java/org/apache/ivy/core/deliver/DeliverOptions.java (original)
+++ incubator/ivy/core/trunk/src/java/org/apache/ivy/core/deliver/DeliverOptions.java Wed May  2 15:35:31 2007
@@ -33,6 +33,7 @@
 	private boolean _validate = true;
 	private boolean _resolveDynamicRevisions = true;
 	private String _resolveId;
+	private String[] _confs;
 	
 	/**
 	 * Returns an instance of DeliverOptions with options corresponding to default values
@@ -45,7 +46,7 @@
 		return new DeliverOptions(null, new Date(), CacheManager.getInstance(settings), 
 				new DefaultPublishingDRResolver(),
 				settings.doValidate(),
-				true);
+				true, null);
 	}
 
 	/**
@@ -58,13 +59,14 @@
 	/**
 	 * Creates an instance of DeliverOptions with all options explicitly set.
 	 */
-	public DeliverOptions(String status, Date pubDate, CacheManager cache, PublishingDependencyRevisionResolver pdrResolver, boolean validate, boolean resolveDynamicRevisions) {
+	public DeliverOptions(String status, Date pubDate, CacheManager cache, PublishingDependencyRevisionResolver pdrResolver, boolean validate, boolean resolveDynamicRevisions, String[] confs) {
 		_status = status;
 		_pubdate = pubDate;
 		_cache = cache;
 		_pdrResolver = pdrResolver;
 		_validate = validate;
 		_resolveDynamicRevisions = resolveDynamicRevisions;
+		_confs = confs;
 	}
 
 	public CacheManager getCache() {
@@ -174,8 +176,29 @@
 		return this;
 	}
 	
+	/**
+	 * Return the configurations which must be deliverd. Returns <tt>null</tt> if all
+	 * configurations has to be deliverd. Attention: the returned array can contain wildcards!
+	 * @return the configurations to deliver
+	 */
+	public String[] getConfs() {
+		return _confs;
+	}
+	
+	/**
+	 * Sets the configurations to deliver.
+	 * @param confs the configurations to deliver
+	 * @return the instance of DeliverOptions on which the method has been called, 
+	 * for easy method chaining 
+	 */
+	public DeliverOptions setConfs(String[] confs) {
+		_confs = confs;
+		return this;
+	}
+	
 	public String toString() {
 		return "status="+_status+" pubdate="+_pubdate+" validate="+_validate+" resolveDynamicRevisions="+_resolveDynamicRevisions+" cache="+_cache+" resolveId="+_resolveId;
+		
 	}
 	
 }

Modified: incubator/ivy/core/trunk/src/java/org/apache/ivy/core/publish/PublishEngine.java
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/src/java/org/apache/ivy/core/publish/PublishEngine.java?view=diff&rev=534641&r1=534640&r2=534641
==============================================================================
--- incubator/ivy/core/trunk/src/java/org/apache/ivy/core/publish/PublishEngine.java (original)
+++ incubator/ivy/core/trunk/src/java/org/apache/ivy/core/publish/PublishEngine.java Wed May  2 15:35:31 2007
@@ -23,6 +23,7 @@
 import java.net.URL;
 import java.text.ParseException;
 import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.Collection;
 import java.util.Date;
 import java.util.HashMap;
@@ -42,6 +43,7 @@
 import org.apache.ivy.plugins.parser.xml.XmlModuleDescriptorParser;
 import org.apache.ivy.plugins.parser.xml.XmlModuleDescriptorUpdater;
 import org.apache.ivy.plugins.resolver.DependencyResolver;
+import org.apache.ivy.util.ConfigurationUtils;
 import org.apache.ivy.util.Message;
 import org.xml.sax.SAXException;
 
@@ -55,7 +57,7 @@
      * Publishes a module to the repository.
      * 
      * The publish can update the ivy file to publish if update is set to true. In this case it will use
-     * the given pubrevision, pubdate and status. If pudate is null it will default to the current date.
+     * the given pubrevision, pubdate and status. If pubdate is null it will default to the current date.
      * If status is null it will default to the current ivy file status (which itself defaults to integration if none is found).
      * If update is false, then if the revision is not the same in the ivy file than the one expected (given as parameter),
      * this method will fail with an  IllegalArgumentException.
@@ -97,31 +99,35 @@
         	ivyFileURL = ivyFile.toURL();
         	md = XmlModuleDescriptorParser.getInstance().parseDescriptor(_settings, ivyFileURL, false);
         	if (options.getSrcIvyPattern() != null) {
-            	if (!options.getPubrevision().equals(md.getModuleRevisionId().getRevision())) {
-            		if (options.isUpdate()) {
-            			File tmp = File.createTempFile("ivy", ".xml");
-            			tmp.deleteOnExit();
-            			try {
-							XmlModuleDescriptorUpdater.update(
-									_settings, 
-									ivyFileURL, 
-									tmp, 
-									new HashMap(), 
-									options.getStatus()==null?md.getStatus():options.getStatus(), 
-									options.getPubrevision(), 
-									options.getPubdate()==null?new Date():options.getPubdate(), 
-									null, 
-									true);
-							ivyFile = tmp;
-							// we parse the new file to get updated module descriptor
-							md = XmlModuleDescriptorParser.getInstance().parseDescriptor(_settings, ivyFile.toURL(), false);
-							options.setSrcIvyPattern(ivyFile.getAbsolutePath());
-						} catch (SAXException e) {
-				        	throw new IllegalStateException("bad ivy file for "+mrid+": "+ivyFile+": "+e);
-						}
-            		} else {
-            			throw new IllegalArgumentException("cannot publish "+ivyFile+" as "+options.getPubrevision()+": bad revision found in ivy file (Revision: "+md.getModuleRevisionId().getRevision()+"). Use forcedeliver or update.");
-            		}
+        		if (options.isUpdate()) {
+        			File tmp = File.createTempFile("ivy", ".xml");
+        			tmp.deleteOnExit();
+        			
+        			String[] confs = ConfigurationUtils.replaceWildcards(options.getConfs(), md);
+        			Set confsToRemove = new HashSet(Arrays.asList(md.getConfigurationsNames()));
+        			confsToRemove.removeAll(Arrays.asList(confs));
+        			
+        			try {
+						XmlModuleDescriptorUpdater.update(
+								_settings, 
+								ivyFileURL, 
+								tmp, 
+								new HashMap(), 
+								options.getStatus()==null?md.getStatus():options.getStatus(), 
+								options.getPubrevision(), 
+								options.getPubdate()==null?new Date():options.getPubdate(), 
+								null, 
+								true,
+								(String[]) confsToRemove.toArray(new String[confsToRemove.size()]));
+						ivyFile = tmp;
+						// we parse the new file to get updated module descriptor
+						md = XmlModuleDescriptorParser.getInstance().parseDescriptor(_settings, ivyFile.toURL(), false);
+						options.setSrcIvyPattern(ivyFile.getAbsolutePath());
+					} catch (SAXException e) {
+			        	throw new IllegalStateException("bad ivy file for "+mrid+": "+ivyFile+": "+e);
+					}
+        		} else if (!options.getPubrevision().equals(md.getModuleRevisionId().getRevision())) {
+           			throw new IllegalArgumentException("cannot publish "+ivyFile+" as "+options.getPubrevision()+": bad revision found in ivy file (Revision: "+md.getModuleRevisionId().getRevision()+"). Use forcedeliver or update.");
             	}
         	} else {
 				md.setResolvedModuleRevisionId(pubmrid);

Modified: incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/xml/XmlModuleDescriptorParser.java
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/xml/XmlModuleDescriptorParser.java?view=diff&rev=534641&r1=534640&r2=534641
==============================================================================
--- incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/xml/XmlModuleDescriptorParser.java (original)
+++ incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/xml/XmlModuleDescriptorParser.java Wed May  2 15:35:31 2007
@@ -101,6 +101,12 @@
         return parser.getModuleDescriptor();
     }
 
+    public ModuleDescriptor parseDescriptor(IvySettings ivySettings, InputStream descriptor, Resource res, boolean validate) throws ParseException, IOException {
+        Parser parser = new Parser(this, ivySettings, validate);
+        parser.parse(descriptor, res, validate);
+        return parser.getModuleDescriptor();
+    }
+
     public boolean accept(Resource res) {
         return true; // this the default parser, it thus accepts all resources
     }
@@ -121,7 +127,8 @@
                     md.getResolvedModuleRevisionId().getRevision(), 
                     md.getResolvedPublicationDate(),
                     ns,
-                    false);
+                    false,
+                    null);
         } catch (SAXException e) {
             ParseException ex = new ParseException("exception occured while parsing "+res, 0);
             ex.initCause(e);
@@ -190,7 +197,33 @@
             throw pe;
         }
     }
-
+    
+    private void parse(InputStream descriptor, Resource res, boolean validate) throws ParseException, IOException {
+        try {
+            setResource(res);
+            URL schemaURL = validate?getClass().getResource("ivy.xsd"):null;
+            XMLHelper.parse(descriptor, schemaURL, this, null);
+            checkConfigurations();
+            replaceConfigurationWildcards();
+            if (!_artifactsDeclared) {
+                String[] confs = _md.getConfigurationsNames();
+                for (int i = 0; i < confs.length; i++) {
+                    _md.addArtifact(confs[i], new MDArtifact(_md, _md.getModuleRevisionId().getName(), "jar", "jar"));
+                }
+            }
+            _md.check();
+        } catch (ParserConfigurationException ex) {
+            IllegalStateException ise = new IllegalStateException(ex.getMessage());
+            ise.initCause(ex);
+            throw ise;
+        } catch (Exception ex) {
+            checkErrors();
+            ParseException pe = new ParseException(ex.getMessage(), 0);
+            pe.initCause(ex);
+            throw pe;
+        }
+    }
+    
     public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException {
         try {
             if ("ivy-module".equals(qName)) {

Modified: incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/xml/XmlModuleDescriptorUpdater.java
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/xml/XmlModuleDescriptorUpdater.java?view=diff&rev=534641&r1=534640&r2=534641
==============================================================================
--- incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/xml/XmlModuleDescriptorUpdater.java (original)
+++ incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/xml/XmlModuleDescriptorUpdater.java Wed May  2 15:35:31 2007
@@ -28,11 +28,16 @@
 import java.io.OutputStreamWriter;
 import java.io.PrintWriter;
 import java.net.URL;
+import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collection;
+import java.util.Collections;
 import java.util.Date;
+import java.util.Iterator;
+import java.util.List;
 import java.util.Map;
 import java.util.Stack;
+import java.util.StringTokenizer;
 
 import javax.xml.parsers.ParserConfigurationException;
 
@@ -71,26 +76,26 @@
      * @param revision the new revision, null to keep the old one
      */
     public static void update(URL srcURL, File destFile, final Map resolvedRevisions, final String status, 
-            final String revision, final Date pubdate) 
+            final String revision, final Date pubdate, String[] confsToExclude) 
                                 throws IOException, SAXException {
-        update(null, srcURL, destFile, resolvedRevisions, status, revision, pubdate, null, false);
+        update(null, srcURL, destFile, resolvedRevisions, status, revision, pubdate, null, false, confsToExclude);
     }
 
     public static void update(final IvySettings settings, URL srcURL, File destFile, final Map resolvedRevisions, final String status, 
-            final String revision, final Date pubdate, final Namespace ns, final boolean replaceInclude) 
+            final String revision, final Date pubdate, final Namespace ns, final boolean replaceInclude, String[] confsToExclude) 
                                 throws IOException, SAXException {
-    	update(settings, srcURL.openStream(), destFile, resolvedRevisions, status, revision, pubdate, ns, replaceInclude);
+    	update(settings, srcURL.openStream(), destFile, resolvedRevisions, status, revision, pubdate, ns, replaceInclude, confsToExclude);
     }
     
     public static void update(final IvySettings settings, InputStream in, File destFile, final Map resolvedRevisions, final String status, 
-            final String revision, final Date pubdate, final Namespace ns, final boolean replaceInclude) 
+            final String revision, final Date pubdate, final Namespace ns, final boolean replaceInclude, String[] confsToExclude) 
                                 throws IOException, SAXException {
         if (destFile.getParentFile() != null) {
             destFile.getParentFile().mkdirs();
         }
         OutputStream fos = new FileOutputStream(destFile);
         try {
-           update(settings, in, fos, resolvedRevisions, status, revision, pubdate, ns, replaceInclude);
+           update(settings, in, fos, resolvedRevisions, status, revision, pubdate, ns, replaceInclude, confsToExclude);
         } finally {
            try {
                in.close();
@@ -112,9 +117,10 @@
 		private final Namespace ns;
 		private final boolean replaceInclude;
 		private boolean inHeader = true;
+		private final List confs;
 		
 		public UpdaterHandler(final IvySettings settings, final PrintWriter out, final Map resolvedRevisions, final String status, 
-            final String revision, final Date pubdate, final Namespace ns, final boolean replaceInclude) {
+            final String revision, final Date pubdate, final Namespace ns, final boolean replaceInclude, final String[] confs) {
 				this.settings = settings;
 				this.out = out;
 				this.resolvedRevisions = resolvedRevisions;
@@ -123,7 +129,11 @@
 				this.pubdate = pubdate;
 				this.ns = ns;
 				this.replaceInclude = replaceInclude;
-    		
+				if (confs != null) {
+					this.confs = Arrays.asList(confs);
+				} else {
+					this.confs = Collections.EMPTY_LIST;
+				}
     	}
     	
         // never print *ln* cause \n is found in copied characters stream
@@ -134,43 +144,47 @@
         private Boolean _confMappingOverride = null; // confMappingOverride of imported configurations, if any
         private String _justOpen = null; // used to know if the last open tag was empty, to adjust termination with /> instead of ></qName>
         private Stack _context = new Stack();
+        private Stack _buffers = new Stack();
+        private Stack _confAttributeBuffers = new Stack();
         public void startElement(String uri, String localName,
                 String qName, Attributes attributes)
                 throws SAXException {
         	inHeader = false;
             if (_justOpen != null) {
-                out.print(">");
+            	write(">");
             }
             _context.push(qName);
             if ("info".equals(qName)) {
                 _organisation = substitute(settings, attributes.getValue("organisation"));
-                out.print("<info organisation=\""+_organisation
+                write("<info organisation=\""+_organisation
                         				+"\" module=\""+substitute(settings, attributes.getValue("module"))+"\"");
                 if (revision != null) {
-                    out.print(" revision=\""+revision+"\"");
+                	write(" revision=\""+revision+"\"");
                 } else if (attributes.getValue("revision") != null) {
-                    out.print(" revision=\""+substitute(settings, attributes.getValue("revision"))+"\"");
+                	write(" revision=\""+substitute(settings, attributes.getValue("revision"))+"\"");
                 }
                 if (status != null) {
-                    out.print(" status=\""+status+"\"");
+                	write(" status=\""+status+"\"");
                 } else {
-                    out.print(" status=\""+substitute(settings, attributes.getValue("status"))+"\"");
+                	write(" status=\""+substitute(settings, attributes.getValue("status"))+"\"");
                 }
                 if (pubdate != null) {
-                    out.print(" publication=\""+Ivy.DATE_FORMAT.format(pubdate)+"\"");
+                	write(" publication=\""+Ivy.DATE_FORMAT.format(pubdate)+"\"");
                 } else if (attributes.getValue("publication") != null) {
-                    out.print(" publication=\""+substitute(settings, attributes.getValue("publication"))+"\"");
+                	write(" publication=\""+substitute(settings, attributes.getValue("publication"))+"\"");
                 }
                 Collection stdAtts = Arrays.asList(new String[] {"organisation", "module", "revision", "status", "publication", "namespace"});
                 if (attributes.getValue("namespace") != null) {
-                    out.print(" namespace=\""+substitute(settings, attributes.getValue("namespace"))+"\"");
+                	write(" namespace=\""+substitute(settings, attributes.getValue("namespace"))+"\"");
                 }
                 for (int i=0; i<attributes.getLength(); i++) {
                 	if (!stdAtts.contains(attributes.getQName(i))) {
-                		out.print(" "+attributes.getQName(i)+"=\""+substitute(settings, attributes.getValue(i))+"\"");
+                		write(" "+attributes.getQName(i)+"=\""+substitute(settings, attributes.getValue(i))+"\"");
                 	}
                 }
             } else if (replaceInclude && "include".equals(qName) && _context.contains("configurations")) {
+            	final ExtendedBuffer buffer = new ExtendedBuffer(getContext());
+            	_buffers.push(buffer);
                 try {
                     URL url;
                     String fileName = substitute(settings, attributes.getValue("file"));
@@ -181,11 +195,13 @@
                         url = new File(fileName).toURL();
                     }     
                     XMLHelper.parse(url, null, new DefaultHandler() {
-                        boolean _first = true;
+                    	boolean _insideConfigurations = false;
+                    	boolean _doIndent = false;
                         public void startElement(String uri, String localName,
                                 String qName, Attributes attributes)
                                 throws SAXException {
                             if ("configurations".equals(qName)) {
+                            	_insideConfigurations = true;
                                 String defaultconf = substitute(settings, attributes.getValue("defaultconfmapping"));
                                 if (defaultconf != null) {
                                     _defaultConfMapping = defaultconf;
@@ -194,26 +210,50 @@
                                 if (mappingOverride != null) {
                                    _confMappingOverride = Boolean.valueOf(mappingOverride);
                                 }
-                            } else if ("conf".equals(qName)) {
-                                // copy
-                                if (!_first) {
-                                    out.print("/>\n\t\t");
-                                } else {
-                                    _first = false;
-                                }
-                                out.print("<"+qName);
-                                for (int i=0; i<attributes.getLength(); i++) {
-                                    out.print(" "+attributes.getQName(i)+"=\""+substitute(settings, attributes.getValue(i))+"\"");
+                            } else if ("conf".equals(qName) && _insideConfigurations) {
+                                String confName = attributes.getValue("name");
+                                if (!confs.contains(confName)) {
+                                	buffer.setPrint(true);
+	                                if (_doIndent) {
+	                                	write("/>\n\t\t");
+	                                }
+                                	String extend = attributes.getValue("extends");
+                                	if (extend != null) {
+                                		for (StringTokenizer tok = new StringTokenizer(extend, ", "); tok.hasMoreTokens(); ) {
+                                			String current = tok.nextToken();
+                                			if (confs.contains(current)) {
+                                				throw new IllegalArgumentException("Cannot exclude a configuration which is extended.");
+                                			}
+                                		}
+                                		
+                                	}
+                                	
+                                	write("<"+qName);
+	                                for (int i=0; i<attributes.getLength(); i++) {
+	                                	write(" "+attributes.getQName(i)+"=\""+substitute(settings, attributes.getValue(i))+"\"");
+	                                }
+	                                _doIndent = true;
                                 }
                             }
                         }
+                        
+                        public void endElement(String uri, String localName,
+                        		String name) throws SAXException {
+                        	if ("configurations".equals(name)) {
+                        		_insideConfigurations = false;
+                        	}
+                        }
                     });
                 } catch (Exception e) {
                     Message.warn("exception occured while importing configurations: "+e.getMessage());
                     throw new SAXException(e);
                 }
-            } else if ("dependency".equals(qName)) {
-                out.print("<dependency");
+        	} else if ("ivy-module/dependencies/dependency".equals(getContext())) {
+        		ExtendedBuffer buffer = new ExtendedBuffer(getContext());
+        		_buffers.push(buffer);
+        		_confAttributeBuffers.push(buffer);
+        		buffer.setDefaultPrint(attributes.getValue("conf") == null);
+            	write("<dependency");
                 String org = substitute(settings, attributes.getValue("org"));
                 org = org == null ? _organisation : org;
                 String module = substitute(settings, attributes.getValue("name"));
@@ -232,67 +272,223 @@
                     if ("rev".equals(attName)) {
                         String rev = (String)resolvedRevisions.get(systemMid);
                         if (rev != null) {
-                            out.print(" rev=\""+rev+"\"");
+                        	write(" rev=\""+rev+"\"");
                         } else {
-                            out.print(" rev=\""+systemMid.getRevision()+"\"");
+                        	write(" rev=\""+systemMid.getRevision()+"\"");
                         }
                     } else if ("org".equals(attName)) {
-                        out.print(" org=\""+systemMid.getOrganisation()+"\"");
+                    	write(" org=\""+systemMid.getOrganisation()+"\"");
                     } else if ("name".equals(attName)) {
-                        out.print(" name=\""+systemMid.getName()+"\"");
+                    	write(" name=\""+systemMid.getName()+"\"");
                     } else if ("branch".equals(attName)) {
-                        out.print(" branch=\""+systemMid.getBranch()+"\"");
+                    	write(" branch=\""+systemMid.getBranch()+"\"");
+                    } else if ("conf".equals(attName)) {
+                    	String oldMapping = attributes.getValue("conf");
+                    	if (oldMapping.length() > 0) {
+                    		String newMapping = removeConfigurationsFromMapping(oldMapping, confs);
+                    		if (newMapping.length() > 0) {
+                    			write(" conf=\"" + newMapping + "\"");
+                    			((ExtendedBuffer) _buffers.peek()).setPrint(true);
+                    		}
+                    	}
                     } else {
-                        out.print(" "+attName+"=\""+substitute(settings, attributes.getValue(attName))+"\"");
+                    	write(" "+attName+"=\""+substitute(settings, attributes.getValue(attName))+"\"");
                     }
                 }
             } else if ("dependencies".equals(qName)) {
                 // copy
-                out.print("<"+qName);
+            	write("<"+qName);
                 for (int i=0; i<attributes.getLength(); i++) {
-                    out.print(" "+attributes.getQName(i)+"=\""+substitute(settings, attributes.getValue(i))+"\"");
+                	String attName = attributes.getQName(i);
+                	if ("defaultconfmapping".equals(attName)) {
+                		String newMapping = removeConfigurationsFromMapping(attributes.getValue("defaultconfmapping"), confs);
+                		if (newMapping.length() > 0) {
+                			write(" "+attributes.getQName(i)+"=\""+newMapping+"\"");
+                		}
+                	} else {
+                		write(" "+attributes.getQName(i)+"=\""+substitute(settings, attributes.getValue(i))+"\"");
+                	}
                 }
                 // add default conf mapping if needed
                 if (_defaultConfMapping != null && attributes.getValue("defaultconfmapping") == null) {
-                    out.print(" defaultconfmapping=\""+_defaultConfMapping+"\"");
+            		String newMapping = removeConfigurationsFromMapping(_defaultConfMapping, confs);
+            		if (newMapping.length() > 0) {
+            			write(" defaultconfmapping=\""+newMapping+"\"");
+            		}
                 }
                 // add confmappingoverride if needed
                 if (_confMappingOverride != null && attributes.getValue("confmappingoverride") == null) {
-                   out.print(" confmappingoverride=\""+_confMappingOverride.toString()+"\"");
+                	write(" confmappingoverride=\""+_confMappingOverride.toString()+"\"");
+                }
+            } else if ("ivy-module/configurations/conf".equals(getContext())) {
+            	_buffers.push(new ExtendedBuffer(getContext()));
+            	String confName = attributes.getValue("name");
+            	if (!confs.contains(confName)) {
+        			((ExtendedBuffer) _buffers.peek()).setPrint(true);
+                	String extend = attributes.getValue("extends");
+                	if (extend != null) {
+                		for (StringTokenizer tok = new StringTokenizer(extend, ", "); tok.hasMoreTokens(); ) {
+                			String current = tok.nextToken();
+                			if (confs.contains(current)) {
+                				throw new IllegalArgumentException("Cannot exclude a configuration which is extended.");
+                			}
+                		}
+                	}
+
+                	write("<"+qName);
+                    for (int i=0; i<attributes.getLength(); i++) {
+                    	write(" "+attributes.getQName(i)+"=\""+substitute(settings, attributes.getValue(i))+"\"");
+                    }
+            	}
+            } else if ("ivy-module/publications/artifact/conf".equals(getContext()) || "ivy-module/dependencies/dependency/conf".equals(getContext()) || "ivy-module/dependencies/dependency/artifact/conf".equals(getContext())) {
+            	_buffers.push(new ExtendedBuffer(getContext()));
+            	((ExtendedBuffer) _confAttributeBuffers.peek()).setDefaultPrint(false);
+            	String confName = attributes.getValue("name");
+            	if (!confs.contains(confName)) {
+            		((ExtendedBuffer) _confAttributeBuffers.peek()).setPrint(true);
+        			((ExtendedBuffer) _buffers.peek()).setPrint(true);
+            		write("<"+qName);
+                    for (int i=0; i<attributes.getLength(); i++) {
+                    	write(" "+attributes.getQName(i)+"=\""+substitute(settings, attributes.getValue(i))+"\"");
+                    }
+            	}
+        	} else if ("ivy-module/publications/artifact".equals(getContext()) || "ivy-module/dependencies/dependency/artifact".equals(getContext())) {
+        		ExtendedBuffer buffer = new ExtendedBuffer(getContext());
+            	_buffers.push(buffer);
+            	_confAttributeBuffers.push(buffer);
+            	write("<"+qName);
+            	buffer.setDefaultPrint(attributes.getValue("conf") == null);
+                for (int i=0; i<attributes.getLength(); i++) {
+                	String attName = attributes.getQName(i);
+                	if ("conf".equals(attName)) {
+                		String confName = attributes.getValue("conf");
+                		String newConf = removeConfigurationsFromList(confName, confs);
+                		if (newConf.length() > 0) {
+                			write(" "+attributes.getQName(i)+"=\""+newConf+"\"");
+                			((ExtendedBuffer) _buffers.peek()).setPrint(true);
+                		}
+                	} else {
+                		write(" "+attributes.getQName(i)+"=\""+substitute(settings, attributes.getValue(i))+"\"");
+                	}
                 }
             } else {
                 // copy
-                out.print("<"+qName);
+        		write("<"+qName);
                 for (int i=0; i<attributes.getLength(); i++) {
-                    out.print(" "+attributes.getQName(i)+"=\""+substitute(settings, attributes.getValue(i))+"\"");
+                	write(" "+attributes.getQName(i)+"=\""+substitute(settings, attributes.getValue(i))+"\"");
                 }
             }
             _justOpen = qName;
 //            indent.append("\t");
         }
+        
+        private void write(String content) {
+        	if (_buffers.isEmpty()) {
+        		out.print(content);
+        	} else {
+        		ExtendedBuffer buffer = (ExtendedBuffer) _buffers.peek();
+        		buffer.getBuffer().append(content);
+        	}
+        }
+        
+        private String getContext() {
+            StringBuffer buf = new StringBuffer();
+            for (Iterator iter = _context.iterator(); iter.hasNext();) {
+                String ctx = (String)iter.next();
+                buf.append(ctx).append("/");
+            }
+            if (buf.length() > 0) {
+                buf.setLength(buf.length() - 1);
+            }
+            return buf.toString();
+        }
 
         private String substitute(IvySettings ivy, String value) {
             return ivy == null ? value : ivy.substitute(value);
         }
+        
+        private String removeConfigurationsFromMapping(String mapping, List confsToRemove) {
+        	StringBuffer newMapping = new StringBuffer();
+        	String mappingSep = "";
+        	for (StringTokenizer tokenizer = new StringTokenizer(mapping, ";"); tokenizer.hasMoreTokens(); ) {
+        		String current = tokenizer.nextToken();
+        		String[] ops = current.split("->");
+        		String[] lhs = ops[0].split(",");
+        		List confsToWrite = new ArrayList();
+        		for (int j = 0; j < lhs.length; j++) {
+        			if (!confs.contains(lhs[j].trim())) {
+        				confsToWrite.add(lhs[j]);
+        			}
+        		}
+        		if (!confsToWrite.isEmpty()) {
+        			newMapping.append(mappingSep);
+        			
+        			String sep = "";
+        			for (Iterator it = confsToWrite.iterator(); it.hasNext(); ) {
+        				newMapping.append(sep);
+        				newMapping.append(it.next());
+        				sep = ",";
+        			}
+        			if (ops.length == 2) {
+        				newMapping.append("->");
+        				newMapping.append(ops[1]);
+        			}
+            		mappingSep = ";";
+        		}
+        	}
+
+        	return newMapping.toString();
+        }
+        
+        private String removeConfigurationsFromList(String list, List confsToRemove) {
+        	StringBuffer newList = new StringBuffer();
+        	String listSep = "";
+        	for (StringTokenizer tokenizer = new StringTokenizer(list, ","); tokenizer.hasMoreTokens(); ) {
+        		String current = tokenizer.nextToken();
+        		if (!confsToRemove.contains(current.trim())) {
+        			newList.append(listSep);
+        			newList.append(current);
+        			listSep = ",";
+        		}
+        	}
+        	
+        	return newList.toString();
+        }
 
         public void characters(char[] ch, int start, int length)
                 throws SAXException {
             if (_justOpen != null) {
-                out.print(">"); 
+            	write(">"); 
                 _justOpen = null;
             }
-            for (int i = start; i < start + length; i++) {
-                out.print(ch[i]);
-            }
+            write(String.valueOf(ch, start, length));
         }
 
         public void endElement(String uri, String localName,
                 String qName) throws SAXException {
             if (qName.equals(_justOpen)) {
-                out.print("/>");
+            	write("/>");
             } else {
-                out.print("</"+qName+">");
+            	write("</"+qName+">");
+            }
+        	
+        	if (!_buffers.isEmpty()) {
+        		ExtendedBuffer buffer = (ExtendedBuffer)_buffers.peek();
+        		if (buffer.getContext().equals(getContext())) {
+        			_buffers.pop();
+	        		if (buffer.isPrint()) {
+	        			write(buffer.getBuffer().toString());
+	        		}
+        		}
+        	}
+            
+            if (!_confAttributeBuffers.isEmpty()) {
+        		ExtendedBuffer buffer = (ExtendedBuffer)_confAttributeBuffers.peek();
+        		if (buffer.getContext().equals(getContext())) {
+        			_confAttributeBuffers.pop();
+        		}
             }
+        	
             _justOpen = null;
             _context.pop();
         }
@@ -327,9 +523,9 @@
 			if (!inHeader) {
 				StringBuffer comment = new StringBuffer();
 				comment.append(ch, start, length);
-				out.print("<!--");
-				out.print(comment.toString());
-				out.print("-->");
+				write("<!--");
+				write(comment.toString());
+				write("-->");
 			}
 		}
 
@@ -343,10 +539,16 @@
 		}
 
     }
-    
+
     public static void update(final IvySettings settings, InputStream inStream, OutputStream outStream, final Map resolvedRevisions, final String status, 
             final String revision, final Date pubdate, final Namespace ns, final boolean replaceInclude) 
                                 throws IOException, SAXException {
+    	update(settings, inStream, outStream, resolvedRevisions, status, revision, pubdate, ns, replaceInclude, null);
+    }
+    
+    public static void update(final IvySettings settings, InputStream inStream, OutputStream outStream, final Map resolvedRevisions, final String status, 
+            final String revision, final Date pubdate, final Namespace ns, final boolean replaceInclude, String[] confsToExclude) 
+                                throws IOException, SAXException {
         final PrintWriter out = new PrintWriter(new OutputStreamWriter(outStream , "UTF-8"));
         final BufferedInputStream in = new BufferedInputStream(inStream);
         
@@ -355,7 +557,7 @@
         in.reset(); // reposition the stream at the beginning
             
         try {
-        	UpdaterHandler updaterHandler = new UpdaterHandler(settings,out,resolvedRevisions,status,revision,pubdate,ns,replaceInclude);
+        	UpdaterHandler updaterHandler = new UpdaterHandler(settings,out,resolvedRevisions,status,revision,pubdate,ns,replaceInclude,confsToExclude);
 			XMLHelper.parse(in, null, updaterHandler, updaterHandler);
         } catch (ParserConfigurationException e) {
             IllegalStateException ise = new IllegalStateException("impossible to update Ivy files: parser problem");
@@ -394,5 +596,33 @@
             }
         }
         //r.close();
+    }
+    
+    private static class ExtendedBuffer {
+    	private String _context = null;
+    	private Boolean _print = null;
+    	private boolean _defaultPrint = false;
+    	private StringBuffer _buffer = new StringBuffer();
+    	ExtendedBuffer(String context) {
+    		this._context = context;
+    	}
+    	boolean isPrint() {
+    		if (_print == null) {
+    			return _defaultPrint;
+    		}
+    		return _print.booleanValue();
+    	}
+    	void setPrint(boolean print) {
+    		this._print = Boolean.valueOf(print);
+    	}
+    	void setDefaultPrint(boolean print) {
+    		this._defaultPrint = print;
+    	}
+    	StringBuffer getBuffer() {
+    		return _buffer;
+    	}
+    	String getContext() {
+    		return _context;
+    	}
     }
 }

Added: incubator/ivy/core/trunk/src/java/org/apache/ivy/util/ConfigurationUtils.java
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/src/java/org/apache/ivy/util/ConfigurationUtils.java?view=auto&rev=534641
==============================================================================
--- incubator/ivy/core/trunk/src/java/org/apache/ivy/util/ConfigurationUtils.java (added)
+++ incubator/ivy/core/trunk/src/java/org/apache/ivy/util/ConfigurationUtils.java Wed May  2 15:35:31 2007
@@ -0,0 +1,88 @@
+/*
+ *  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.util;
+
+import java.util.Arrays;
+import java.util.LinkedHashSet;
+import java.util.Set;
+
+import org.apache.ivy.core.module.descriptor.Configuration;
+import org.apache.ivy.core.module.descriptor.ModuleDescriptor;
+import org.apache.ivy.core.module.descriptor.Configuration.Visibility;
+
+/**
+ * Class containing several utility methods for working with configurations.
+ * 
+ * @author Maarten Coene
+ *
+ */
+public class ConfigurationUtils {
+	
+	/**
+	 * Private constructor to avoid instantiation of this class.
+	 */
+	private ConfigurationUtils() {
+	}
+
+	/**
+	 * Replace all the wildcards in the given configuration array. Supported wildcards
+	 * are:
+	 * <ul>
+	 * <li><b><tt>*</tt>:</b>all configurations</li>
+	 * <li><b><tt>*(public)</tt>:</b>all public configurations</li>
+	 * <li><b><tt>*(private)</tt>:</b>all private configurations</li>
+	 * </ul>
+	 * If the given array of configurations is <tt>null</tt>, all configurations are returned.
+	 * 
+	 * @param confs the configurations, can contain wildcards
+	 * @param md the configurations where the wildcards are replaced
+	 * @return
+	 */
+	public static String[] replaceWildcards(String[] confs, ModuleDescriptor md) {
+		Set result = new LinkedHashSet();
+		
+		if (confs == null) {
+			return md.getConfigurationsNames();
+		}
+		
+		for (int i = 0; i < confs.length; i++) {
+			if ("*".equals(confs[i])) {
+				result.addAll(Arrays.asList(md.getConfigurationsNames()));
+			} else if ("*(public)".equals(confs[i])) {
+				Configuration[] all = md.getConfigurations();
+				for (int j = 0; j < all.length; j++) {
+					if (all[j].getVisibility().equals(Visibility.PUBLIC)) {
+						result.add(all[j].getName());
+					}
+				}
+			} else if ("*(private)".equals(confs[i])) {
+				Configuration[] all = md.getConfigurations();
+				for (int j = 0; j < all.length; j++) {
+					if (all[j].getVisibility().equals(Visibility.PRIVATE)) {
+						result.add(all[j].getName());
+					}
+				}
+			} else {
+				result.add(confs[i]);
+			}
+		}
+		
+		return (String[]) result.toArray(new String[result.size()]); 
+	}
+	
+}

Modified: incubator/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyPublishTest.java
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyPublishTest.java?view=diff&rev=534641&r1=534640&r2=534641
==============================================================================
--- incubator/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyPublishTest.java (original)
+++ incubator/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyPublishTest.java Wed May  2 15:35:31 2007
@@ -27,7 +27,10 @@
 import org.apache.ivy.core.module.descriptor.ModuleDescriptor;
 import org.apache.ivy.core.settings.IvySettings;
 import org.apache.ivy.plugins.parser.xml.XmlModuleDescriptorParser;
+import org.apache.ivy.util.DefaultMessageImpl;
 import org.apache.ivy.util.FileUtil;
+import org.apache.ivy.util.Message;
+import org.apache.ivy.util.MessageImpl;
 import org.apache.tools.ant.BuildException;
 import org.apache.tools.ant.Project;
 import org.apache.tools.ant.taskdefs.Delete;
@@ -50,6 +53,8 @@
         _publish = new IvyPublish();
         _publish.setProject(_project);
         _publish.setCache(_cache);
+        
+        Message.init(new DefaultMessageImpl(10));
     }
 
     private void createCache() {
@@ -85,13 +90,39 @@
     }
 
     public void testSimple() throws Exception {
-        _project.setProperty("ivy.dep.file", "test/java/org/apache/ivy/ant/ivy-simple.xml");
+        _project.setProperty("ivy.dep.file", "test/java/org/apache/ivy/ant/ivy-multiconf.xml");
+        IvyResolve res = new IvyResolve();
+        res.setProject(_project);
+        res.execute();
+        
+        _publish.setPubrevision("1.2");
+        _publish.setResolver("1");
+        File art = new File("build/test/publish/resolve-simple-1.2.jar");
+        FileUtil.copy(new File("test/repositories/1/org1/mod1.1/jars/mod1.1-1.0.jar"), art, null);
+        _publish.execute();
+        
+        // should have do the ivy delivering
+        assertTrue(new File("build/test/publish/ivy-1.2.xml").exists()); 
+        
+        // should have published the files with "1" resolver
+        assertTrue(new File("test/repositories/1/apache/resolve-simple/ivys/ivy-1.2.xml").exists()); 
+        assertTrue(new File("test/repositories/1/apache/resolve-simple/jars/resolve-simple-1.2.jar").exists());
+        
+        // should have updated published ivy version
+        ModuleDescriptor md = XmlModuleDescriptorParser.getInstance().parseDescriptor(new IvySettings(), new File("test/repositories/1/apache/resolve-simple/ivys/ivy-1.2.xml").toURL(), false);
+        assertEquals("1.2", md.getModuleRevisionId().getRevision());
+    }
+    
+    public void testPublishNotAllConfigs() throws Exception {
+        _project.setProperty("ivy.dep.file", "test/java/org/apache/ivy/ant/ivy-multiconf.xml");
         IvyResolve res = new IvyResolve();
         res.setProject(_project);
         res.execute();
         
         _publish.setPubrevision("1.2");
         _publish.setResolver("1");
+        _publish.setConf("compile");
+        _publish.setUpdate(true);
         File art = new File("build/test/publish/resolve-simple-1.2.jar");
         FileUtil.copy(new File("test/repositories/1/org1/mod1.1/jars/mod1.1-1.0.jar"), art, null);
         _publish.execute();
@@ -106,6 +137,11 @@
         // should have updated published ivy version
         ModuleDescriptor md = XmlModuleDescriptorParser.getInstance().parseDescriptor(new IvySettings(), new File("test/repositories/1/apache/resolve-simple/ivys/ivy-1.2.xml").toURL(), false);
         assertEquals("1.2", md.getModuleRevisionId().getRevision());
+        
+        // should only contain the default configuration
+        String[] configs = md.getConfigurationsNames();
+        assertEquals("Number of configurations not correct", 1, configs.length);
+        assertEquals("Compile configuration not present", "compile", configs[0]);
     }
 
     public void testMultiPatterns() throws Exception {

Modified: incubator/ivy/core/trunk/test/java/org/apache/ivy/plugins/parser/xml/XmlModuleUpdaterTest.java
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/test/java/org/apache/ivy/plugins/parser/xml/XmlModuleUpdaterTest.java?view=diff&rev=534641&r1=534640&r2=534641
==============================================================================
--- incubator/ivy/core/trunk/test/java/org/apache/ivy/plugins/parser/xml/XmlModuleUpdaterTest.java (original)
+++ incubator/ivy/core/trunk/test/java/org/apache/ivy/plugins/parser/xml/XmlModuleUpdaterTest.java Wed May  2 15:35:31 2007
@@ -18,21 +18,31 @@
 package org.apache.ivy.plugins.parser.xml;
 
 import java.io.BufferedReader;
+import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
 import java.io.File;
 import java.io.FileReader;
 import java.io.InputStreamReader;
+import java.text.ParseException;
+import java.util.Arrays;
 import java.util.Date;
 import java.util.GregorianCalendar;
 import java.util.HashMap;
+import java.util.List;
 import java.util.Map;
 
 import junit.framework.TestCase;
 
 import org.apache.ivy.Ivy;
+import org.apache.ivy.core.module.descriptor.Artifact;
+import org.apache.ivy.core.module.descriptor.Configuration;
+import org.apache.ivy.core.module.descriptor.DependencyDescriptor;
+import org.apache.ivy.core.module.descriptor.ModuleDescriptor;
 import org.apache.ivy.core.module.id.ModuleRevisionId;
 import org.apache.ivy.core.settings.IvySettings;
+import org.apache.ivy.plugins.repository.BasicResource;
 import org.apache.ivy.util.FileUtil;
+import org.xml.sax.SAXParseException;
 
 public class XmlModuleUpdaterTest extends TestCase {
     
@@ -58,7 +68,7 @@
         ivy.setVariable("myvar", "myconf1");
         XmlModuleDescriptorUpdater.update(ivy.getSettings(), 
                 XmlModuleUpdaterTest.class.getResource("test-update.xml"), 
-                dest, resolvedRevisions, "release", "mynewrev", cal.getTime(), null, true);
+                dest, resolvedRevisions, "release", "mynewrev", cal.getTime(), null, true, null);
         
         assertTrue(dest.exists());
         String expected = FileUtil.readEntirely(new BufferedReader(new InputStreamReader(XmlModuleUpdaterTest.class.getResourceAsStream("updated.xml"))));
@@ -67,7 +77,7 @@
     }
     
     public void testUpdateWithImportedMappingOverride() throws Exception {
-       ByteArrayOutputStream buffer = new ByteArrayOutputStream();
+        ByteArrayOutputStream buffer = new ByteArrayOutputStream();
         XmlModuleDescriptorUpdater.update(new IvySettings(), 
                 XmlModuleUpdaterTest.class.getResourceAsStream("test-configurations-import4.xml"), 
                 buffer, new HashMap(), "release", "mynewrev", new Date(), null, true);
@@ -78,4 +88,110 @@
         assertTrue("Updated XML doesn't define the confmappingoverride attribute", updatedXml.indexOf("confmappingoverride=\"true\"") != -1);
     }
     
+    public void testUpdateWithExcludeConfigurations1() throws Exception {
+        ByteArrayOutputStream buffer = new ByteArrayOutputStream();
+        XmlModuleDescriptorUpdater.update(new IvySettings(), 
+                XmlModuleUpdaterTest.class.getResourceAsStream("test-update-excludedconfs1.xml"), 
+                buffer, new HashMap(), "release", "mynewrev", new Date(), null, true, new String[] {"myconf2"});
+       
+        XmlModuleDescriptorParser parser = XmlModuleDescriptorParser.getInstance();
+        ModuleDescriptor updatedMd = parser.parseDescriptor(new IvySettings(), new ByteArrayInputStream(buffer.toByteArray()), new BasicResource("test", false, 0, 0, false), true);
+        
+        // test the number of configurations
+        Configuration[] configs = updatedMd.getConfigurations();
+        assertNotNull("Configurations shouldn't be null", configs);
+        assertEquals("Number of configurations incorrect", 3, configs.length);
+
+        // test that the correct configuration has been removed
+        assertNull("myconf2 hasn't been removed", updatedMd.getConfiguration("myconf2"));
+        
+        // test that the other configurations aren't removed
+        assertNotNull("myconf1 has been removed", updatedMd.getConfiguration("myconf1"));
+        assertNotNull("myconf3 has been removed", updatedMd.getConfiguration("myconf3"));
+        assertNotNull("myconf4 has been removed", updatedMd.getConfiguration("myconf4"));
+    }
+    
+    public void testUpdateWithExcludeConfigurations2() throws Exception {
+        ByteArrayOutputStream buffer = new ByteArrayOutputStream();
+        try {
+	        XmlModuleDescriptorUpdater.update(new IvySettings(), 
+	                XmlModuleUpdaterTest.class.getResourceAsStream("test-update-excludedconfs2.xml"), 
+	                buffer, new HashMap(), "release", "mynewrev", new Date(), null, true, new String[] {"myconf2"});
+	        fail("IllegalArgumentException hasn't been thrown");
+        } catch (IllegalArgumentException e) {
+        	// this is ok
+        } catch (SAXParseException e) {
+        	// this is ok too
+        }
+    }
+    
+    public void testUpdateWithExcludeConfigurations3() throws Exception {
+        ByteArrayOutputStream buffer = new ByteArrayOutputStream();
+        XmlModuleDescriptorUpdater.update(new IvySettings(), 
+                XmlModuleUpdaterTest.class.getResourceAsStream("test-update-excludedconfs3.xml"), 
+                buffer, new HashMap(), "release", "mynewrev", new Date(), null, true, new String[] {"myconf2", "conf2"});
+       
+        XmlModuleDescriptorParser parser = XmlModuleDescriptorParser.getInstance();
+        ModuleDescriptor updatedMd = parser.parseDescriptor(new IvySettings(), new ByteArrayInputStream(buffer.toByteArray()), new BasicResource("test", false, 0, 0, false), true);
+        
+        // test the number of configurations
+        Configuration[] configs = updatedMd.getConfigurations();
+        assertNotNull("Configurations shouldn't be null", configs);
+        assertEquals("Number of configurations incorrect", 4, configs.length);
+
+        // test that the correct configuration has been removed
+        assertNull("myconf2 hasn't been removed", updatedMd.getConfiguration("myconf2"));
+        assertNull("conf2 hasn't been removed", updatedMd.getConfiguration("conf2"));
+        
+        // test that the other configurations aren't removed
+        assertNotNull("conf1 has been removed", updatedMd.getConfiguration("conf1"));
+        assertNotNull("myconf1 has been removed", updatedMd.getConfiguration("myconf1"));
+        assertNotNull("myconf3 has been removed", updatedMd.getConfiguration("myconf3"));
+        assertNotNull("myconf4 has been removed", updatedMd.getConfiguration("myconf4"));
+    }
+    
+    public void testUpdateWithExcludeConfigurations4() throws Exception {
+        ByteArrayOutputStream buffer = new ByteArrayOutputStream();
+        XmlModuleDescriptorUpdater.update(new IvySettings(), 
+                XmlModuleUpdaterTest.class.getResourceAsStream("test-update-excludedconfs4.xml"), 
+                buffer, new HashMap(), "release", "mynewrev", new Date(), null, true, new String[] {"myconf2"});
+       
+        XmlModuleDescriptorParser parser = XmlModuleDescriptorParser.getInstance();
+        ModuleDescriptor updatedMd = parser.parseDescriptor(new IvySettings(), new ByteArrayInputStream(buffer.toByteArray()), new BasicResource("test", false, 0, 0, false), true);
+        
+        // test the number of configurations
+        Artifact[] artifacts = updatedMd.getAllArtifacts();
+        assertNotNull("Published artifacts shouldn't be null", artifacts);
+        assertEquals("Number of published artifacts incorrect", 4, artifacts.length);
+
+        // test that the correct configuration has been removed
+        for (int i = 0; i < artifacts.length; i++) {
+        	Artifact current = artifacts[i];
+        	List currentConfs = Arrays.asList(current.getConfigurations());
+        	assertTrue("myconf2 hasn't been removed for artifact " + current.getName(), !currentConfs.contains("myconf2"));
+        }
+    }
+    
+    public void testUpdateWithExcludeConfigurations5() throws Exception {
+        ByteArrayOutputStream buffer = new ByteArrayOutputStream();
+        XmlModuleDescriptorUpdater.update(new IvySettings(), 
+                XmlModuleUpdaterTest.class.getResourceAsStream("test-update-excludedconfs5.xml"), 
+                buffer, new HashMap(), "release", "mynewrev", new Date(), null, true, new String[] {"myconf2"});
+       
+        XmlModuleDescriptorParser parser = XmlModuleDescriptorParser.getInstance();
+        ModuleDescriptor updatedMd = parser.parseDescriptor(new IvySettings(), new ByteArrayInputStream(buffer.toByteArray()), new BasicResource("test", false, 0, 0, false), true);
+
+        DependencyDescriptor[] deps = updatedMd.getDependencies();
+        assertNotNull("Dependencies shouldn't be null", deps);
+        assertEquals("Number of dependencies is incorrect", 8, deps.length);
+        
+        // check that none of the dependencies contains myconf2
+        for (int i = 0; i < deps.length; i++) {
+        	String name = deps[i].getDependencyId().getName();
+        	assertFalse("Dependency " + name + " shouldn't have myconf2 as module configuration",
+        			Arrays.asList(deps[i].getModuleConfigurations()).contains("myconf2"));
+        	assertEquals("Dependency " + name + " shouldn't have a dependency artifact for configuration myconf2",
+        			0, deps[i].getDependencyArtifacts("myconf2").length);
+        }
+    }
 }

Added: incubator/ivy/core/trunk/test/java/org/apache/ivy/plugins/parser/xml/test-update-excludedconfs1.xml
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/test/java/org/apache/ivy/plugins/parser/xml/test-update-excludedconfs1.xml?view=auto&rev=534641
==============================================================================
--- incubator/ivy/core/trunk/test/java/org/apache/ivy/plugins/parser/xml/test-update-excludedconfs1.xml (added)
+++ incubator/ivy/core/trunk/test/java/org/apache/ivy/plugins/parser/xml/test-update-excludedconfs1.xml Wed May  2 15:35:31 2007
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<?xml-stylesheet type="text/xsl" href="http://www.somesite.com/ivy-doc.xsl"?>
+<!--
+   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.    
+-->
+<ivy-module version="2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://incubator.apache.org/ivy/schemas/ivy.xsd">
+	<info organisation="myorg"
+	       module="mymodule"
+	       revision="myrev"
+	       status="integration"
+	       publication="20041101110000" />
+	<configurations>
+		<conf name="myconf1" description="desc 1"/>
+		<conf name="myconf2" description="desc 2" visibility="public"/>
+		<conf name="myconf3" description="desc 3" visibility="private"/>
+		<conf name="myconf4" description="desc 4" />
+	</configurations>
+	<publications />
+	<dependencies />
+</ivy-module>

Added: incubator/ivy/core/trunk/test/java/org/apache/ivy/plugins/parser/xml/test-update-excludedconfs2.xml
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/test/java/org/apache/ivy/plugins/parser/xml/test-update-excludedconfs2.xml?view=auto&rev=534641
==============================================================================
--- incubator/ivy/core/trunk/test/java/org/apache/ivy/plugins/parser/xml/test-update-excludedconfs2.xml (added)
+++ incubator/ivy/core/trunk/test/java/org/apache/ivy/plugins/parser/xml/test-update-excludedconfs2.xml Wed May  2 15:35:31 2007
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<?xml-stylesheet type="text/xsl" href="http://www.somesite.com/ivy-doc.xsl"?>
+<!--
+   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.    
+-->
+<ivy-module version="2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://incubator.apache.org/ivy/schemas/ivy.xsd">
+	<info organisation="myorg"
+	       module="mymodule"
+	       revision="myrev"
+	       status="integration"
+	       publication="20041101110000" />
+	<configurations>
+		<conf name="myconf1" description="desc 1"/>
+		<conf name="myconf2" description="desc 2" visibility="public"/>
+		<conf name="myconf3" description="desc 3" extends="myconf2" visibility="private"/>
+		<conf name="myconf4" description="desc 4" extends="myconf1, myconf2"/>		
+	</configurations>
+	<publications />
+	<dependencies />
+</ivy-module>

Added: incubator/ivy/core/trunk/test/java/org/apache/ivy/plugins/parser/xml/test-update-excludedconfs3.xml
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/test/java/org/apache/ivy/plugins/parser/xml/test-update-excludedconfs3.xml?view=auto&rev=534641
==============================================================================
--- incubator/ivy/core/trunk/test/java/org/apache/ivy/plugins/parser/xml/test-update-excludedconfs3.xml (added)
+++ incubator/ivy/core/trunk/test/java/org/apache/ivy/plugins/parser/xml/test-update-excludedconfs3.xml Wed May  2 15:35:31 2007
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<?xml-stylesheet type="text/xsl" href="http://www.somesite.com/ivy-doc.xsl"?>
+<!--
+   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.    
+-->
+<ivy-module version="2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://incubator.apache.org/ivy/schemas/ivy.xsd">
+	<info organisation="myorg"
+	       module="mymodule"
+	       revision="myrev"
+	       status="integration"
+	       publication="20041101110000" />
+	<configurations>
+		<include file="test/java/org/apache/ivy/plugins/parser/xml/imported-configurations.xml"/>
+		<conf name="myconf1" description="desc 1"/>
+		<conf name="myconf2" description="desc 2" visibility="public"/>
+		<conf name="myconf3" description="desc 3" visibility="private"/>
+		<conf name="myconf4" description="desc 4" />
+	</configurations>
+	<publications />
+	<dependencies />
+</ivy-module>

Added: incubator/ivy/core/trunk/test/java/org/apache/ivy/plugins/parser/xml/test-update-excludedconfs4.xml
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/test/java/org/apache/ivy/plugins/parser/xml/test-update-excludedconfs4.xml?view=auto&rev=534641
==============================================================================
--- incubator/ivy/core/trunk/test/java/org/apache/ivy/plugins/parser/xml/test-update-excludedconfs4.xml (added)
+++ incubator/ivy/core/trunk/test/java/org/apache/ivy/plugins/parser/xml/test-update-excludedconfs4.xml Wed May  2 15:35:31 2007
@@ -0,0 +1,48 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<?xml-stylesheet type="text/xsl" href="http://www.somesite.com/ivy-doc.xsl"?>
+<!--
+   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.    
+-->
+<ivy-module version="2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://incubator.apache.org/ivy/schemas/ivy.xsd">
+	<info organisation="myorg"
+	       module="mymodule"
+	       revision="myrev"
+	       status="integration"
+	       publication="20041101110000" />
+	<configurations>
+		<conf name="myconf1" description="desc 1"/>
+		<conf name="myconf2" description="desc 2" visibility="public"/>
+		<conf name="myconf3" description="desc 3" visibility="private"/>
+		<conf name="myconf4" description="desc 4" />
+	</configurations>
+	<publications>
+		<artifact name="myartifact1" type="jar"/>
+		<artifact name="myartifact2" type="jar" conf="myconf1"/>
+		<artifact name="myartifact3" type="jar" conf="myconf1, myconf2, myconf3"/>
+		<artifact name="myartifact4" type="jar">
+			<conf name="myconf1"/>
+			<conf name="myconf2"/>
+			<conf name="myconf3"/>
+		</artifact>
+		<artifact name="myartifact5" type="jar" conf="myconf2"/>
+		<artifact name="myartifact6" type="jar">
+			<conf name="myconf2"/>
+		</artifact>
+	</publications>
+	<dependencies />
+</ivy-module>

Added: incubator/ivy/core/trunk/test/java/org/apache/ivy/plugins/parser/xml/test-update-excludedconfs5.xml
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/test/java/org/apache/ivy/plugins/parser/xml/test-update-excludedconfs5.xml?view=auto&rev=534641
==============================================================================
--- incubator/ivy/core/trunk/test/java/org/apache/ivy/plugins/parser/xml/test-update-excludedconfs5.xml (added)
+++ incubator/ivy/core/trunk/test/java/org/apache/ivy/plugins/parser/xml/test-update-excludedconfs5.xml Wed May  2 15:35:31 2007
@@ -0,0 +1,83 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<?xml-stylesheet type="text/xsl" href="http://www.somesite.com/ivy-doc.xsl"?>
+<!--
+   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.    
+-->
+<ivy-module version="2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://incubator.apache.org/ivy/schemas/ivy.xsd">
+	<info organisation="myorg"
+	       module="mymodule"
+	       revision="myrev"
+	       status="integration"
+	       publication="20041101110000" />
+	<configurations>
+		<conf name="myconf1" description="desc 1"/>
+		<conf name="myconf2" description="desc 2" visibility="public"/>
+		<conf name="myconf3" description="desc 3" visibility="private"/>
+		<conf name="myconf4" description="desc 4" />
+	</configurations>
+	<publications />
+	<dependencies>
+		<dependency org="yourorg" name="yourmodule1" rev="1.1" conf="myconf1"/>
+		<dependency org="yourorg" name="yourmodule2" rev="2+" conf="myconf1->yourconf1"/>
+		<dependency org="yourorg" name="yourmodule3" rev="3.1" conf="myconf2->yourconf1, yourconf2"/>
+
+		<dependency org="yourorg" name="yourmodule4" rev="4.1">
+			<conf name="myconf2" mapped="yourconf2"/>
+		</dependency>
+
+		<dependency org="yourorg" name="yourmodule5" rev="5.1" conf="myconf2->yourconf2">
+			<conf name="myconf1" mapped="yourconf1"/>
+		</dependency>
+
+		<dependency org="yourorg" name="yourmodule6" rev="latest.integration">
+			<conf name="myconf1" mapped="yourconf1"/>
+			<conf name="myconf2" mapped="yourconf1, yourconf2"/>
+		</dependency>
+
+		<dependency org="yourorg" name="yourmodule7" rev="7.1">
+			<conf name="myconf1">
+				<mapped name="yourconf1"/>
+			</conf>
+			<conf name="myconf2">
+				<mapped name="yourconf1"/>
+				<mapped name="yourconf2"/>
+			</conf>
+		</dependency>
+
+		<dependency org="yourorg" name="yourmodule8" rev="8.1">
+			<artifact name="yourartifact8-1" type="jar"/>
+			<artifact name="yourartifact8-2" type="jar"/>
+		</dependency>		
+
+		<dependency org="yourorg" name="yourmodule9" rev="9.1" conf="myconf1,myconf2,myconf3->default">
+			<artifact name="yourartifact9-1" type="jar" conf="myconf1,myconf2"/>
+			<artifact name="yourartifact9-2" type="jar">
+				<conf name="myconf2"/>
+				<conf name="myconf3"/>
+			</artifact>
+		</dependency>		
+
+		<dependency org="yourorg" name="yourmodule10" rev="10.1" conf="myconf1,myconf2,myconf3->default">
+			<artifact name="yourartifact9-1" type="jar" conf="myconf2"/>
+			<artifact name="yourartifact9-2" type="jar">
+				<conf name="myconf2"/>
+				<conf name="myconf3"/>
+			</artifact>
+		</dependency>		
+	</dependencies>
+</ivy-module>