You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by jv...@apache.org on 2009/07/16 19:50:30 UTC

svn commit: r794767 - in /maven/components/trunk: maven-compat/src/main/java/org/apache/maven/artifact/repository/ maven-compat/src/main/java/org/apache/maven/repository/ maven-compat/src/main/java/org/apache/maven/repository/legacy/ maven-embedder/src...

Author: jvanzyl
Date: Thu Jul 16 17:50:29 2009
New Revision: 794767

URL: http://svn.apache.org/viewvc?rev=794767&view=rev
Log:
o restoring auth

Added:
    maven/components/trunk/maven-compat/src/main/java/org/apache/maven/artifact/repository/Authentication.java
      - copied, changed from r794373, maven/components/trunk/maven-compat/src/main/java/org/apache/maven/repository/Authentication.java
Removed:
    maven/components/trunk/maven-compat/src/main/java/org/apache/maven/repository/Authentication.java
Modified:
    maven/components/trunk/maven-compat/src/main/java/org/apache/maven/artifact/repository/ArtifactRepository.java
    maven/components/trunk/maven-compat/src/main/java/org/apache/maven/artifact/repository/ArtifactRepositoryFactory.java
    maven/components/trunk/maven-compat/src/main/java/org/apache/maven/artifact/repository/DefaultArtifactRepository.java
    maven/components/trunk/maven-compat/src/main/java/org/apache/maven/artifact/repository/MavenArtifactRepository.java
    maven/components/trunk/maven-compat/src/main/java/org/apache/maven/repository/LegacyRepositorySystem.java
    maven/components/trunk/maven-compat/src/main/java/org/apache/maven/repository/RepositorySystem.java
    maven/components/trunk/maven-compat/src/main/java/org/apache/maven/repository/legacy/DefaultWagonManager.java
    maven/components/trunk/maven-embedder/src/main/java/org/apache/maven/embedder/execution/DefaultMavenExecutionRequestPopulator.java

Modified: maven/components/trunk/maven-compat/src/main/java/org/apache/maven/artifact/repository/ArtifactRepository.java
URL: http://svn.apache.org/viewvc/maven/components/trunk/maven-compat/src/main/java/org/apache/maven/artifact/repository/ArtifactRepository.java?rev=794767&r1=794766&r2=794767&view=diff
==============================================================================
--- maven/components/trunk/maven-compat/src/main/java/org/apache/maven/artifact/repository/ArtifactRepository.java (original)
+++ maven/components/trunk/maven-compat/src/main/java/org/apache/maven/artifact/repository/ArtifactRepository.java Thu Jul 16 17:50:29 2009
@@ -53,7 +53,12 @@
 
     String getKey();
     
+    //
     // New interface methods for the repository system. 
-    
+    //
     Artifact find( Artifact artifact );
+    
+    void setAuthentication( Authentication authentication );
+    
+    Authentication getAuthentication();
 }

Modified: maven/components/trunk/maven-compat/src/main/java/org/apache/maven/artifact/repository/ArtifactRepositoryFactory.java
URL: http://svn.apache.org/viewvc/maven/components/trunk/maven-compat/src/main/java/org/apache/maven/artifact/repository/ArtifactRepositoryFactory.java?rev=794767&r1=794766&r2=794767&view=diff
==============================================================================
--- maven/components/trunk/maven-compat/src/main/java/org/apache/maven/artifact/repository/ArtifactRepositoryFactory.java (original)
+++ maven/components/trunk/maven-compat/src/main/java/org/apache/maven/artifact/repository/ArtifactRepositoryFactory.java Thu Jul 16 17:50:29 2009
@@ -27,9 +27,11 @@
 
     String LOCAL_REPOSITORY_ID = "local";
 
+    @Deprecated
     ArtifactRepositoryLayout getLayout( String layoutId )
         throws UnknownRepositoryLayoutException;
 
+    @Deprecated
     ArtifactRepository createDeploymentArtifactRepository( String id, String url, String layoutId, boolean uniqueVersion )
         throws UnknownRepositoryLayoutException;
 

Copied: maven/components/trunk/maven-compat/src/main/java/org/apache/maven/artifact/repository/Authentication.java (from r794373, maven/components/trunk/maven-compat/src/main/java/org/apache/maven/repository/Authentication.java)
URL: http://svn.apache.org/viewvc/maven/components/trunk/maven-compat/src/main/java/org/apache/maven/artifact/repository/Authentication.java?p2=maven/components/trunk/maven-compat/src/main/java/org/apache/maven/artifact/repository/Authentication.java&p1=maven/components/trunk/maven-compat/src/main/java/org/apache/maven/repository/Authentication.java&r1=794373&r2=794767&rev=794767&view=diff
==============================================================================
--- maven/components/trunk/maven-compat/src/main/java/org/apache/maven/repository/Authentication.java (original)
+++ maven/components/trunk/maven-compat/src/main/java/org/apache/maven/artifact/repository/Authentication.java Thu Jul 16 17:50:29 2009
@@ -1,4 +1,4 @@
-package org.apache.maven.repository;
+package org.apache.maven.artifact.repository;
 
 /*
  * Licensed to the Apache Software Foundation (ASF) under one
@@ -20,7 +20,13 @@
  */
 
 public class Authentication
-{
+{    
+    public Authentication( String userName, String password )
+    {
+        this.userName = userName;
+        this.password = password;
+    }
+
     /**
      * Username used to login to the host
      */

Modified: maven/components/trunk/maven-compat/src/main/java/org/apache/maven/artifact/repository/DefaultArtifactRepository.java
URL: http://svn.apache.org/viewvc/maven/components/trunk/maven-compat/src/main/java/org/apache/maven/artifact/repository/DefaultArtifactRepository.java?rev=794767&r1=794766&r2=794767&view=diff
==============================================================================
--- maven/components/trunk/maven-compat/src/main/java/org/apache/maven/artifact/repository/DefaultArtifactRepository.java (original)
+++ maven/components/trunk/maven-compat/src/main/java/org/apache/maven/artifact/repository/DefaultArtifactRepository.java Thu Jul 16 17:50:29 2009
@@ -203,4 +203,17 @@
                 
         return artifact;
     }
+
+    //
+    // This implementation does not support authentication
+    //
+    public Authentication getAuthentication()
+    {
+        return null;
+    }
+
+    public void setAuthentication( Authentication authentication )
+    {
+        // do nothing
+    }
 }

Modified: maven/components/trunk/maven-compat/src/main/java/org/apache/maven/artifact/repository/MavenArtifactRepository.java
URL: http://svn.apache.org/viewvc/maven/components/trunk/maven-compat/src/main/java/org/apache/maven/artifact/repository/MavenArtifactRepository.java?rev=794767&r1=794766&r2=794767&view=diff
==============================================================================
--- maven/components/trunk/maven-compat/src/main/java/org/apache/maven/artifact/repository/MavenArtifactRepository.java (original)
+++ maven/components/trunk/maven-compat/src/main/java/org/apache/maven/artifact/repository/MavenArtifactRepository.java Thu Jul 16 17:50:29 2009
@@ -25,7 +25,6 @@
 import org.apache.maven.artifact.metadata.ArtifactMetadata;
 import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout;
 
-//TODO: http://jira.codehaus.org/browse/MNG-4215
 //TODO: completely separate local and remote artifact repositories
 public class MavenArtifactRepository
     implements ArtifactRepository
@@ -44,6 +43,8 @@
 
     private ArtifactRepositoryPolicy releases;
     
+    private Authentication authentication;
+    
     public MavenArtifactRepository()
     {
     }
@@ -343,4 +344,13 @@
         return s1 != null ? s1.equals( s2 ) : s2 == null;
     }
 
+    public Authentication getAuthentication()
+    {
+        return authentication;
+    }
+
+    public void setAuthentication( Authentication authentication )
+    {
+        this.authentication = authentication;        
+    }
 }

Modified: maven/components/trunk/maven-compat/src/main/java/org/apache/maven/repository/LegacyRepositorySystem.java
URL: http://svn.apache.org/viewvc/maven/components/trunk/maven-compat/src/main/java/org/apache/maven/repository/LegacyRepositorySystem.java?rev=794767&r1=794766&r2=794767&view=diff
==============================================================================
--- maven/components/trunk/maven-compat/src/main/java/org/apache/maven/repository/LegacyRepositorySystem.java (original)
+++ maven/components/trunk/maven-compat/src/main/java/org/apache/maven/repository/LegacyRepositorySystem.java Thu Jul 16 17:50:29 2009
@@ -1,28 +1,25 @@
 package org.apache.maven.repository;
 
 /*
- * 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.
+ * 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.
  */
 
 import java.io.File;
 import java.io.IOException;
 import java.util.ArrayList;
 import java.util.Collection;
+import java.util.HashMap;
 import java.util.LinkedHashMap;
 import java.util.List;
 import java.util.Map;
@@ -33,6 +30,7 @@
 import org.apache.maven.artifact.repository.ArtifactRepository;
 import org.apache.maven.artifact.repository.ArtifactRepositoryFactory;
 import org.apache.maven.artifact.repository.ArtifactRepositoryPolicy;
+import org.apache.maven.artifact.repository.Authentication;
 import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout;
 import org.apache.maven.artifact.resolver.ArtifactResolutionRequest;
 import org.apache.maven.artifact.resolver.ArtifactResolutionResult;
@@ -63,7 +61,7 @@
 /**
  * @author Jason van Zyl
  */
-@Component( role = RepositorySystem.class, hint = "default" )
+@Component(role = RepositorySystem.class, hint = "default")
 public class LegacyRepositorySystem
     implements RepositorySystem
 {
@@ -80,6 +78,9 @@
     private ArtifactRepositoryLayout defaultArtifactRepositoryLayout;
 
     @Requirement
+    private Map<String,ArtifactRepositoryLayout> layouts;
+    
+    @Requirement
     private MirrorBuilder mirrorBuilder;
 
     @Requirement
@@ -97,7 +98,7 @@
     {
         return artifactFactory.createBuildArtifact( groupId, artifactId, version, packaging );
     }
-    
+
     public Artifact createArtifactWithClassifier( String groupId, String artifactId, String version, String type, String classifier )
     {
         return artifactFactory.createArtifactWithClassifier( groupId, artifactId, version, type, classifier );
@@ -120,9 +121,7 @@
             return null;
         }
 
-        Artifact artifact =
-            artifactFactory.createDependencyArtifact( d.getGroupId(), d.getArtifactId(), versionRange, d.getType(),
-                                                      d.getClassifier(), d.getScope(), d.isOptional() );
+        Artifact artifact = artifactFactory.createDependencyArtifact( d.getGroupId(), d.getArtifactId(), versionRange, d.getType(), d.getClassifier(), d.getScope(), d.isOptional() );
 
         if ( Artifact.SCOPE_SYSTEM.equals( d.getScope() ) && d.getSystemPath() != null )
         {
@@ -179,27 +178,6 @@
         return artifactFactory.createPluginArtifact( plugin.getGroupId(), plugin.getArtifactId(), versionRange );
     }
 
-    public ArtifactRepository buildArtifactRepository( Repository repo )
-        throws InvalidRepositoryException
-    {
-        if ( repo != null )
-        {
-            String id = repo.getId();
-            
-            String url = repo.getUrl();
-            
-            ArtifactRepositoryPolicy snapshots = buildArtifactRepositoryPolicy( repo.getSnapshots() );
-
-            ArtifactRepositoryPolicy releases = buildArtifactRepositoryPolicy( repo.getReleases() );
-
-            return artifactRepositoryFactory.createArtifactRepository( id, url, repo.getLayout(), snapshots, releases );
-        }
-        else
-        {
-            return null;
-        }
-    }
-
     public ArtifactRepositoryPolicy buildArtifactRepositoryPolicy( RepositoryPolicy policy )
     {
         boolean enabled = true;
@@ -224,38 +202,31 @@
 
         return new ArtifactRepositoryPolicy( enabled, updatePolicy, checksumPolicy );
     }
-    
+
     public ArtifactRepository createDefaultLocalRepository()
         throws InvalidRepositoryException
     {
         return createLocalRepository( RepositorySystem.defaultUserLocalRepository );
     }
-    
+
     public ArtifactRepository createLocalRepository( File localRepository )
         throws InvalidRepositoryException
     {
-        return createRepository( "file://" + localRepository.toURI().getRawPath(),
-                                 RepositorySystem.DEFAULT_LOCAL_REPO_ID, true,
-                                 ArtifactRepositoryPolicy.UPDATE_POLICY_ALWAYS, true,
-                                 ArtifactRepositoryPolicy.UPDATE_POLICY_ALWAYS,
-                                 ArtifactRepositoryPolicy.CHECKSUM_POLICY_IGNORE );
+        return createRepository( "file://" + localRepository.toURI().getRawPath(), RepositorySystem.DEFAULT_LOCAL_REPO_ID, true, ArtifactRepositoryPolicy.UPDATE_POLICY_ALWAYS, true,
+                                 ArtifactRepositoryPolicy.UPDATE_POLICY_ALWAYS, ArtifactRepositoryPolicy.CHECKSUM_POLICY_IGNORE );
     }
 
     public ArtifactRepository createDefaultRemoteRepository()
         throws InvalidRepositoryException
     {
-        return createRepository( RepositorySystem.DEFAULT_REMOTE_REPO_URL, RepositorySystem.DEFAULT_REMOTE_REPO_ID,
-                                 true, ArtifactRepositoryPolicy.UPDATE_POLICY_NEVER, false,
-                                 ArtifactRepositoryPolicy.UPDATE_POLICY_DAILY,
-                                 ArtifactRepositoryPolicy.CHECKSUM_POLICY_WARN );
+        return createRepository( RepositorySystem.DEFAULT_REMOTE_REPO_URL, RepositorySystem.DEFAULT_REMOTE_REPO_ID, true, ArtifactRepositoryPolicy.UPDATE_POLICY_NEVER, false,
+                                 ArtifactRepositoryPolicy.UPDATE_POLICY_DAILY, ArtifactRepositoryPolicy.CHECKSUM_POLICY_WARN );
     }
-    
+
     public ArtifactRepository createLocalRepository( String url, String repositoryId )
         throws IOException
     {
-        return createRepository( canonicalFileUrl( url ), repositoryId, true,
-                                 ArtifactRepositoryPolicy.UPDATE_POLICY_ALWAYS, true,
-                                 ArtifactRepositoryPolicy.UPDATE_POLICY_ALWAYS,
+        return createRepository( canonicalFileUrl( url ), repositoryId, true, ArtifactRepositoryPolicy.UPDATE_POLICY_ALWAYS, true, ArtifactRepositoryPolicy.UPDATE_POLICY_ALWAYS,
                                  ArtifactRepositoryPolicy.CHECKSUM_POLICY_IGNORE );
     }
 
@@ -288,22 +259,6 @@
         return url;
     }
 
-    private ArtifactRepository createRepository( String url, String repositoryId, boolean releases,
-                                                 String releaseUpdates, boolean snapshots, String snapshotUpdates,
-                                                 String checksumPolicy )
-    {
-        ArtifactRepositoryPolicy snapshotsPolicy = new ArtifactRepositoryPolicy( snapshots, snapshotUpdates, checksumPolicy );
-
-        ArtifactRepositoryPolicy releasesPolicy = new ArtifactRepositoryPolicy( releases, releaseUpdates, checksumPolicy );
-
-        return artifactRepositoryFactory.createArtifactRepository( repositoryId, url, defaultArtifactRepositoryLayout, snapshotsPolicy, releasesPolicy );
-    }
-
-    public ArtifactRepository createArtifactRepository( String id, String url, ArtifactRepositoryLayout repositoryLayout, ArtifactRepositoryPolicy snapshots, ArtifactRepositoryPolicy releases )
-    {
-        return artifactRepositoryFactory.createArtifactRepository( id, url, repositoryLayout, snapshots, releases );
-    }
-    
     public ArtifactResolutionResult resolve( ArtifactResolutionRequest request )
     {
         /*
@@ -372,23 +327,7 @@
     }
     */
 
-    /*
-    public void addAuthenticationInfo( String repositoryId, String username, String password, String privateKey, String passphrase )
-    {
-        AuthenticationInfo authInfo = new AuthenticationInfo();
-        authInfo.setUserName( username );
-        authInfo.setPassword( password );
-        authInfo.setPrivateKey( privateKey );
-        authInfo.setPassphrase( passphrase );
-
-        authenticationInfoMap.put( repositoryId, authInfo );
-
-        wagonManager.addAuthenticationInfo( repositoryId, username, password, privateKey, passphrase );
-    }
-    */
-
     // Mirror 
-
     public void addMirror( String id, String mirrorOf, String url )
     {
         mirrorBuilder.addMirror( id, mirrorOf, url );
@@ -427,8 +366,7 @@
 
         for ( List<ArtifactRepository> aliasedRepos : reposByKey.values() )
         {
-            List<ArtifactRepositoryPolicy> releasePolicies =
-                new ArrayList<ArtifactRepositoryPolicy>( aliasedRepos.size() );
+            List<ArtifactRepositoryPolicy> releasePolicies = new ArrayList<ArtifactRepositoryPolicy>( aliasedRepos.size() );
 
             for ( ArtifactRepository aliasedRepo : aliasedRepos )
             {
@@ -437,8 +375,7 @@
 
             ArtifactRepositoryPolicy releasePolicy = getEffectivePolicy( releasePolicies );
 
-            List<ArtifactRepositoryPolicy> snapshotPolicies =
-                new ArrayList<ArtifactRepositoryPolicy>( aliasedRepos.size() );
+            List<ArtifactRepositoryPolicy> snapshotPolicies = new ArrayList<ArtifactRepositoryPolicy>( aliasedRepos.size() );
 
             for ( ArtifactRepository aliasedRepo : aliasedRepos )
             {
@@ -449,10 +386,8 @@
 
             ArtifactRepository aliasedRepo = aliasedRepos.get( 0 );
 
-            ArtifactRepository effectiveRepository =
-                artifactRepositoryFactory.createArtifactRepository( aliasedRepo.getId(), aliasedRepo.getUrl(),
-                                                                    aliasedRepo.getLayout(), snapshotPolicy,
-                                                                    releasePolicy );
+            ArtifactRepository effectiveRepository = 
+                createArtifactRepository( aliasedRepo.getId(), aliasedRepo.getUrl(), aliasedRepo.getLayout(), snapshotPolicy, releasePolicy );
 
             effectiveRepositories.add( effectiveRepository );
         }
@@ -468,9 +403,7 @@
         {
             if ( effectivePolicy == null )
             {
-                effectivePolicy =
-                    new ArtifactRepositoryPolicy( policy.isEnabled(), policy.getUpdatePolicy(),
-                                                  policy.getChecksumPolicy() );
+                effectivePolicy = new ArtifactRepositoryPolicy( policy.isEnabled(), policy.getUpdatePolicy(), policy.getChecksumPolicy() );
             }
             else
             {
@@ -533,17 +466,17 @@
     public MetadataResolutionResult resolveMetadata( MetadataResolutionRequest request )
     {
 
-//      ArtifactResolutionResult collect( Set<Artifact> artifacts,
-//      Artifact originatingArtifact,
-//      Map managedVersions,
-//      ArtifactRepository localRepository,
-//      List<ArtifactRepository> remoteRepositories,
-//      ArtifactMetadataSource source,
-//      ArtifactFilter filter,
-//      List<ResolutionListener> listeners,
-//      List<ConflictResolver> conflictResolvers )
-        
-//        ArtifactResolutionResult result = artifactCollector.
+        //      ArtifactResolutionResult collect( Set<Artifact> artifacts,
+        //      Artifact originatingArtifact,
+        //      Map managedVersions,
+        //      ArtifactRepository localRepository,
+        //      List<ArtifactRepository> remoteRepositories,
+        //      ArtifactMetadataSource source,
+        //      ArtifactFilter filter,
+        //      List<ResolutionListener> listeners,
+        //      List<ConflictResolver> conflictResolvers )
+
+        //        ArtifactResolutionResult result = artifactCollector.
         return null;
     }
 
@@ -558,4 +491,67 @@
     {
         wagonManager.putRemoteFile( repository, source, remotePath, downloadMonitor );
     }
+
+    private Map<String, Authentication> authentications = new HashMap<String, Authentication>();
+
+    //
+    // serverId = repository id
+    //
+    public void addAuthenticationForArtifactRepository( String repositoryId, String username, String password )
+    {
+        Authentication authentication = new Authentication( username, password );
+        authentications.put( repositoryId, authentication );
+    }
+
+    //
+    // Artifact Repository Creation
+    //
+    public ArtifactRepository buildArtifactRepository( Repository repo )
+        throws InvalidRepositoryException
+    {        
+        if ( repo != null )
+        {
+            String id = repo.getId();
+
+            String url = repo.getUrl();
+
+            ArtifactRepositoryPolicy snapshots = buildArtifactRepositoryPolicy( repo.getSnapshots() );
+
+            ArtifactRepositoryPolicy releases = buildArtifactRepositoryPolicy( repo.getReleases() );
+            
+            return createArtifactRepository( id, url, layouts.get( repo.getLayout() ), snapshots, releases );
+        }
+        else
+        {
+            return null;
+        }
+    }
+    
+    private ArtifactRepository createRepository( String url, String repositoryId, boolean releases, String releaseUpdates, boolean snapshots, String snapshotUpdates, String checksumPolicy )
+    {
+        ArtifactRepositoryPolicy snapshotsPolicy = new ArtifactRepositoryPolicy( snapshots, snapshotUpdates, checksumPolicy );
+
+        ArtifactRepositoryPolicy releasesPolicy = new ArtifactRepositoryPolicy( releases, releaseUpdates, checksumPolicy );
+
+        return createArtifactRepository( repositoryId, url, defaultArtifactRepositoryLayout, snapshotsPolicy, releasesPolicy );
+    }
+
+    public ArtifactRepository createArtifactRepository( String repositoryId, String url, ArtifactRepositoryLayout repositoryLayout, ArtifactRepositoryPolicy snapshots, ArtifactRepositoryPolicy releases )
+    {        
+        if ( repositoryLayout == null )
+        {
+            repositoryLayout = defaultArtifactRepositoryLayout;
+        }
+             
+        ArtifactRepository artifactRepository = artifactRepositoryFactory.createArtifactRepository( repositoryId, url, repositoryLayout, snapshots, releases );
+
+        Authentication authentication = authentications.get( repositoryId );
+        
+        if ( authentication != null )
+        {
+            artifactRepository.setAuthentication( authentication );
+        }
+        
+        return artifactRepository;
+    }   
 }

Modified: maven/components/trunk/maven-compat/src/main/java/org/apache/maven/repository/RepositorySystem.java
URL: http://svn.apache.org/viewvc/maven/components/trunk/maven-compat/src/main/java/org/apache/maven/repository/RepositorySystem.java?rev=794767&r1=794766&r2=794767&view=diff
==============================================================================
--- maven/components/trunk/maven-compat/src/main/java/org/apache/maven/repository/RepositorySystem.java (original)
+++ maven/components/trunk/maven-compat/src/main/java/org/apache/maven/repository/RepositorySystem.java Thu Jul 16 17:50:29 2009
@@ -112,5 +112,7 @@
         throws TransferFailedException;
     
     void retrieve( ArtifactRepository repository, File destination, String remotePath, TransferListener downloadMonitor )
-        throws TransferFailedException, ResourceDoesNotExistException;        
+        throws TransferFailedException, ResourceDoesNotExistException; 
+        
+    void addAuthenticationForArtifactRepository( String repositoryId, String username, String password );    
 }

Modified: maven/components/trunk/maven-compat/src/main/java/org/apache/maven/repository/legacy/DefaultWagonManager.java
URL: http://svn.apache.org/viewvc/maven/components/trunk/maven-compat/src/main/java/org/apache/maven/repository/legacy/DefaultWagonManager.java?rev=794767&r1=794766&r2=794767&view=diff
==============================================================================
--- maven/components/trunk/maven-compat/src/main/java/org/apache/maven/repository/legacy/DefaultWagonManager.java (original)
+++ maven/components/trunk/maven-compat/src/main/java/org/apache/maven/repository/legacy/DefaultWagonManager.java Thu Jul 16 17:50:29 2009
@@ -32,9 +32,11 @@
 import org.apache.maven.wagon.UnsupportedProtocolException;
 import org.apache.maven.wagon.Wagon;
 import org.apache.maven.wagon.authentication.AuthenticationException;
+import org.apache.maven.wagon.authentication.AuthenticationInfo;
 import org.apache.maven.wagon.authorization.AuthorizationException;
 import org.apache.maven.wagon.events.TransferListener;
 import org.apache.maven.wagon.observers.ChecksumObserver;
+import org.apache.maven.wagon.proxy.ProxyInfo;
 import org.apache.maven.wagon.repository.Repository;
 import org.codehaus.plexus.PlexusContainer;
 import org.codehaus.plexus.component.annotations.Component;
@@ -208,6 +210,38 @@
         getRemoteFile( repository, destination, remotePath, null, checksumPolicy, true );
     }
 
+    /**
+     * Deal with connecting to a wagon repository taking into account authentication and proxies.
+     * 
+     * @param wagon
+     * @param repository
+     * @throws ConnectionException
+     * @throws AuthenticationException
+     */
+    private void connectWagon( Wagon wagon, ArtifactRepository repository ) 
+        throws ConnectionException, AuthenticationException
+    {
+        if ( repository.getAuthentication() != null )
+        {
+            //
+            // We have authentication we have been asked to deal with.
+            //
+            AuthenticationInfo ai = new AuthenticationInfo();
+            ai.setUserName( repository.getAuthentication().getUserName() );
+            ai.setPassword( repository.getAuthentication().getPassword() );
+            
+            wagon.connect( new Repository( repository.getId(), repository.getUrl() ), ai );                    
+        }
+        else
+        {
+            wagon.connect( new Repository( repository.getId(), repository.getUrl() ) );                    
+        }
+        
+        //
+        // ProxyInfo proxyInfo = new ProxyInfo();
+        //        
+    }    
+    
     public void getRemoteFile( ArtifactRepository repository, File destination, String remotePath, TransferListener downloadMonitor, String checksumPolicy, boolean force )
         throws TransferFailedException, ResourceDoesNotExistException
     {
@@ -237,8 +271,8 @@
 
         try
         {
-            wagon.connect( new Repository( repository.getId(), repository.getUrl() ) );
-
+            connectWagon( wagon, repository );
+            
             boolean firstRun = true;
             boolean retry = true;
 
@@ -467,7 +501,7 @@
         {
             try
             {
-                wagon.connect( new Repository( repository.getId(), repository.getUrl() ) );
+                connectWagon( wagon, repository );
 
                 wagon.put( source, remotePath );
             }

Modified: maven/components/trunk/maven-embedder/src/main/java/org/apache/maven/embedder/execution/DefaultMavenExecutionRequestPopulator.java
URL: http://svn.apache.org/viewvc/maven/components/trunk/maven-embedder/src/main/java/org/apache/maven/embedder/execution/DefaultMavenExecutionRequestPopulator.java?rev=794767&r1=794766&r2=794767&view=diff
==============================================================================
--- maven/components/trunk/maven-embedder/src/main/java/org/apache/maven/embedder/execution/DefaultMavenExecutionRequestPopulator.java (original)
+++ maven/components/trunk/maven-embedder/src/main/java/org/apache/maven/embedder/execution/DefaultMavenExecutionRequestPopulator.java Thu Jul 16 17:50:29 2009
@@ -30,6 +30,7 @@
 import org.apache.maven.repository.RepositorySystem;
 import org.apache.maven.settings.MavenSettingsBuilder;
 import org.apache.maven.settings.Mirror;
+import org.apache.maven.settings.Server;
 import org.apache.maven.settings.Settings;
 import org.apache.maven.settings.SettingsUtils;
 import org.apache.maven.toolchain.ToolchainsBuilder;
@@ -199,27 +200,14 @@
 
             repositorySystem.addProxy( proxy.getProtocol(), proxy.getHost(), proxy.getPort(), proxy.getUsername(), proxy.getPassword(), proxy.getNonProxyHosts() );
         }
+        */
 
         for ( Server server : settings.getServers() )
         {
-            String password;
-            String passPhrase;
-            
-            try
-            {
-                password = securityDispatcher.decrypt( server.getPassword() );
-                passPhrase = securityDispatcher.decrypt( server.getPassphrase() );
-            }
-            catch ( SecDispatcherException e )
-            {
-                throw new MavenEmbedderException( "Error decrypting server password/passphrase.", e );
-            }
+            repositorySystem.addAuthenticationForArtifactRepository( server.getId(), server.getUsername(), server.getPassword() );
 
-            repositorySystem.addAuthenticationInfo( server.getId(), server.getUsername(), password, server.getPrivateKey(), passPhrase );
-
-            repositorySystem.addPermissionInfo( server.getId(), server.getFilePermissions(), server.getDirectoryPermissions() );
+            //repositorySystem.addPermissionInfo( server.getId(), server.getFilePermissions(), server.getDirectoryPermissions() );
         }
-        */
 
         for ( Mirror mirror : settings.getMirrors() )
         {