I also thought this was a little sketchy and is why I don't like the
cross project commit privs because people think it's just ok to do
this kind of thing.
Due to a limitation in Archiva not being able to deal with a single
URL (which the other repositories managers don't have a problem with)
a hack in Maven itself was done by an Archiva developer. No discussion
either. The proximity and artifactory developers don't have this
luxury and is a mild abuse of the system we have in place here IMO.
On 15-Mar-08, at 8:29 AM, Brian E. Fox wrote:
I'm -1 on this commit for several reasons:
First and foremost, there was no proposal on the wiki or any
discussion
on the dev list that I can see for this.
Second, the use case is not very clear and implementation
questionable.
If this functionality is needed for some reason, it should be
brought up
and discussed in a proposal and on the dev list. We don't just write
issues, fix them, commit and close the issue with no discussion.
Also it
seems like this change is tailored to support only one repository
manager which is concerning to me.
_________________________-
Author: nicolas
Date: Mon Feb 25 02:18:23 2008
New Revision: 630789
URL: http://svn.apache.org/viewvc?rev=630789&view=rev
Log:
MNG-3407 : improve mirrorOf to support pattern based repository URL
Modified:
maven/artifact/trunk/src/main/java/org/apache/maven/artifact/manager/
Def
aultWagonManager.java
maven/artifact/trunk/src/test/java/org/apache/maven/artifact/manager/
Def
aultWagonManagerTest.java
Modified:
maven/artifact/trunk/src/main/java/org/apache/maven/artifact/manager/
Def
aultWagonManager.java
URL:
http://svn.apache.org/viewvc/maven/artifact/trunk/src/main/java/org/apac
he/maven/artifact/manager/DefaultWagonManager.java?
rev=630789&r1=630788&
r2=630789&view=diff
=
=
======================================================================
======
---
maven/artifact/trunk/src/main/java/org/apache/maven/artifact/manager/
Def
aultWagonManager.java (original)
+++
maven/artifact/trunk/src/main/java/org/apache/maven/artifact/manager/
Def
aultWagonManager.java Mon Feb 25 02:18:23 2008
@@ -52,6 +52,7 @@
import org.codehaus.plexus.logging.AbstractLogEnabled;
import
org
.codehaus.plexus.personality.plexus.lifecycle.phase.Contextualizable;
import org.codehaus.plexus.util.FileUtils;
+import org.codehaus.plexus.util.StringUtils;
import org.codehaus.plexus.util.xml.Xpp3Dom;
import java.io.File;
@@ -62,6 +63,7 @@
import java.util.Iterator;
import java.util.List;
import java.util.Map;
+import java.text.MessageFormat;
/** @plexus.component */
public class DefaultWagonManager
@@ -754,6 +756,17 @@
if ( repository == null )
{
repository = (ArtifactRepository) mirrors.get( WILDCARD );
+ if ( repository != null )
+ {
+ String url = repository.getUrl();
+ if ( url.indexOf( "${mirrorOf}" ) >= 0 )
+ {
+ url = StringUtils.replace( url, "${mirrorOf}", "{0}" );
+ url = MessageFormat.format( url, new Object[] { mirrorOf } );
+ repository = new DefaultArtifactRepository( mirrorOf, url,
null );
+ mirrors.put( mirrorOf, repository );
+ }
+ }
}
return repository;
Modified:
maven/artifact/trunk/src/test/java/org/apache/maven/artifact/manager/
Def
aultWagonManagerTest.java
URL:
http://svn.apache.org/viewvc/maven/artifact/trunk/src/test/java/org/apac
he/maven/artifact/manager/DefaultWagonManagerTest.java?
rev=630789&r1=630
788&r2=630789&view=diff
=
=
======================================================================
======
---
maven/artifact/trunk/src/test/java/org/apache/maven/artifact/manager/
Def
aultWagonManagerTest.java (original)
+++
maven/artifact/trunk/src/test/java/org/apache/maven/artifact/manager/
Def
aultWagonManagerTest.java Mon Feb 25 02:18:23 2008
@@ -56,6 +56,15 @@
wagonManager = (WagonManager) lookup( WagonManager.ROLE );
}
+ public void testMappedMirror()
+ throws Exception
+ {
+ DefaultWagonManager manager = (DefaultWagonManager) wagonManager;
+ manager.addMirror( "wildcar", "*",
"http://archiva/repository/${mirrorOf}" );
+ assertEquals( "http://archiva/repository/central",
manager.getMirror(
"central" ).getUrl() );
+ assertEquals( "http://archiva/repository/apache.snapshots",
manager.getMirror( "apache.snapshots" ).getUrl() );
+ }
+
public void testDefaultWagonManager()
throws Exception
{
Thanks,
Jason
----------------------------------------------------------
Jason van Zyl
Founder, Apache Maven
jason at sonatype dot com
----------------------------------------------------------
Simplex sigillum veri. (Simplicity is the seal of truth.)
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]