mirror of https://github.com/apache/maven.git
MNG-1884 - the wagon manager needs to be injects the proxy/mirror info, otherwise the readProject() calls don't get through the firewalls.
git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@434079 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
e165438db3
commit
625012b029
|
@ -617,6 +617,8 @@ public class DefaultMaven
|
|||
* them in. It doesn't feel quite right.
|
||||
* @todo [JC] we should at least provide a mapping of protocol-to-proxy for
|
||||
* the wagons, shouldn't we?
|
||||
* @todo [mkleint] as part of fix MNG-1884, I've copied this code into
|
||||
* MavenEmbedder. if rewritten, needs to be rewritten there too
|
||||
*/
|
||||
private void resolveParameters( Settings settings )
|
||||
throws ComponentLookupException, ComponentLifecycleException, SettingsConfigurationException
|
||||
|
|
|
@ -43,6 +43,9 @@ import org.apache.maven.project.MavenProject;
|
|||
import org.apache.maven.project.MavenProjectBuilder;
|
||||
import org.apache.maven.project.ProjectBuildingException;
|
||||
import org.apache.maven.reactor.MavenExecutionException;
|
||||
import org.apache.maven.settings.Mirror;
|
||||
import org.apache.maven.settings.Proxy;
|
||||
import org.apache.maven.settings.Server;
|
||||
import org.apache.maven.settings.Settings;
|
||||
import org.apache.maven.wagon.events.TransferListener;
|
||||
import org.codehaus.classworlds.ClassWorld;
|
||||
|
@ -55,6 +58,7 @@ import org.codehaus.plexus.configuration.PlexusConfiguration;
|
|||
import org.codehaus.plexus.configuration.PlexusConfigurationException;
|
||||
import org.codehaus.plexus.embed.Embedder;
|
||||
import org.codehaus.plexus.util.DirectoryScanner;
|
||||
import org.codehaus.plexus.util.xml.Xpp3Dom;
|
||||
import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
|
||||
|
||||
import java.io.File;
|
||||
|
@ -632,6 +636,8 @@ public class MavenEmbedder
|
|||
null );
|
||||
|
||||
profileManager.loadSettingsProfiles( settings );
|
||||
|
||||
resolveParameters( settings );
|
||||
|
||||
started = true;
|
||||
|
||||
|
@ -653,8 +659,59 @@ public class MavenEmbedder
|
|||
catch (SettingsConfigurationException e )
|
||||
{
|
||||
throw new MavenEmbedderException( "Cannot create settings configuration", e );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* MKLEINT: copied from DefaultMaven. the wagonManager was not injected with proxy info
|
||||
* when called in non-execute mode..
|
||||
*
|
||||
* @todo [BP] this might not be required if there is a better way to pass
|
||||
* them in. It doesn't feel quite right.
|
||||
* @todo [JC] we should at least provide a mapping of protocol-to-proxy for
|
||||
* the wagons, shouldn't we?
|
||||
*/
|
||||
private void resolveParameters( Settings settings )
|
||||
throws SettingsConfigurationException
|
||||
{
|
||||
|
||||
Proxy proxy = settings.getActiveProxy();
|
||||
|
||||
if ( proxy != null )
|
||||
{
|
||||
if ( proxy.getHost() == null )
|
||||
{
|
||||
throw new SettingsConfigurationException( "Proxy in settings.xml has no host" );
|
||||
}
|
||||
System.out.println("setting proxy to=" + proxy.getHost());
|
||||
wagonManager.addProxy( proxy.getProtocol(), proxy.getHost(), proxy.getPort(), proxy.getUsername(),
|
||||
proxy.getPassword(), proxy.getNonProxyHosts() );
|
||||
}
|
||||
|
||||
for ( Iterator i = settings.getServers().iterator(); i.hasNext(); )
|
||||
{
|
||||
Server server = (Server) i.next();
|
||||
|
||||
wagonManager.addAuthenticationInfo( server.getId(), server.getUsername(), server.getPassword(),
|
||||
server.getPrivateKey(), server.getPassphrase() );
|
||||
|
||||
wagonManager.addPermissionInfo( server.getId(), server.getFilePermissions(),
|
||||
server.getDirectoryPermissions() );
|
||||
|
||||
if ( server.getConfiguration() != null )
|
||||
{
|
||||
wagonManager.addConfiguration( server.getId(), (Xpp3Dom) server.getConfiguration() );
|
||||
}
|
||||
}
|
||||
|
||||
for ( Iterator i = settings.getMirrors().iterator(); i.hasNext(); )
|
||||
{
|
||||
Mirror mirror = (Mirror) i.next();
|
||||
|
||||
wagonManager.addMirror( mirror.getId(), mirror.getMirrorOf(), mirror.getUrl() );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
|
|
Loading…
Reference in New Issue