Package org.apache.maven.settings

Examples of org.apache.maven.settings.Proxy


         }
         request.setRemoteRepositories(settingsRepos);
         request.setSystemProperties(System.getProperties());

         DefaultRepositorySystemSession repositorySession = MavenRepositorySystemUtils.newSession();
         Proxy activeProxy = settings.getActiveProxy();
         if (activeProxy != null)
         {
            DefaultProxySelector dps = new DefaultProxySelector();
            dps.add(RepositoryUtils.convertFromMavenProxy(activeProxy), activeProxy.getNonProxyHosts());
            repositorySession.setProxySelector(dps);
         }
         LocalRepository localRepo = new LocalRepository(settings.getLocalRepository());
         repositorySession.setLocalRepositoryManager(system.newLocalRepositoryManager(repositorySession, localRepo));
         repositorySession.setOffline(offline);
View Full Code Here


    {
        WagonManager wagonManager = (WagonManager) container.lookup( WagonManager.ROLE );

        try
        {
            Proxy proxy = settings.getActiveProxy();

            if ( proxy != null )
            {
                if ( proxy.getHost() == null )
                {
                    throw new SettingsConfigurationException( "Proxy in settings.xml has no host" );
                }

                wagonManager.addProxy( proxy.getProtocol(), proxy.getHost(), proxy.getPort(), proxy.getUsername(),
                                       proxy.getPassword(), proxy.getNonProxyHosts() );
            }

            for ( Iterator<Server> i = settings.getServers().iterator(); i.hasNext(); )
            {
                Server server = i.next();
View Full Code Here

    {
        WagonManager wagonManager = (WagonManager) container.lookup( WagonManager.ROLE );

        try
        {
            Proxy proxy = settings.getActiveProxy();

            if ( proxy != null )
            {
                if ( proxy.getHost() == null )
                {
                    throw new SettingsConfigurationException( "Proxy in settings.xml has no host" );
                }

                wagonManager.addProxy( proxy.getProtocol(), proxy.getHost(), proxy.getPort(), proxy.getUsername(),
                                       proxy.getPassword(), proxy.getNonProxyHosts() );
            }

            for ( Iterator<Server> i = settings.getServers().iterator(); i.hasNext(); )
            {
                Server server = i.next();
View Full Code Here

    }

    protected void configureProxyServerSettings() throws MojoExecutionException {

        Proxy proxy = mavenSession.getSettings().getActiveProxy();

        if (proxy != null) {

            getLog().info("Using proxy server configured in maven.");

            if (proxy.getHost() == null) {
                throw new MojoExecutionException("Proxy in settings.xml has no host");
            } else {
                System.setProperty("proxySet", "true");
                System.setProperty("proxyHost", proxy.getHost());
                System.setProperty("proxyPort", String.valueOf(proxy.getPort()));
            }

        }
    }
View Full Code Here

        Settings settings = getSettings( container, setting );

        try
        {
            Proxy proxy = settings.getActiveProxy();

            if ( proxy != null )
            {
                if ( proxy.getHost() == null )
                {
                    throw new IOException( "Proxy in settings.xml has no host" );
                }

                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();
View Full Code Here

    private void populateProxyCommands( List<String> commands, String commandFlag )
        throws MojoExecutionException
    {
        if ( proxy != null )
        {
            Proxy mProxy = getProxyFor( proxy.getId() );
            if ( mProxy != null )
            {
                getLog().debug( "NPANDAY-1300-003: Found proxy: ID = " + mProxy.getId() );
                String username = mProxy.getUsername();
                String password = mProxy.getPassword();
                boolean isHashed = proxy.isHashPassword();
                if ( !isEmpty( password ) && isHashed )
                {
                    String alg = proxy.getHashAlg();
                    if ( isEmpty( alg ) )
                    {
                        alg = "SHA1";
                    }
                    try
                    {
                        password = new String( MessageDigest.getInstance( alg ).digest( password.getBytes() ) );
                    }
                    catch ( NoSuchAlgorithmException e )
                    {
                        throw new MojoExecutionException(
                                                          "NPANDAY-1300-004: No Such Algorithm for hashing the password: "
                                                              + "Algorithm = " + alg, e );
                    }
                }
                String proxyHost = mProxy.getHost();
                int proxyPort = mProxy.getPort();
                String proxyProtocol = mProxy.getProtocol();

                StringBuffer proxyUrl = new StringBuffer();
                if ( !isEmpty( proxyProtocol ) )
                {
                    proxyUrl.append( proxyProtocol ).append( "://" );
View Full Code Here

    }

    protected void configureProxyServerSettings() throws MojoExecutionException {

        Proxy proxy = mavenSession.getSettings().getActiveProxy();

        if (proxy != null) {

            getLog().info("Using proxy server configured in maven.");

            if (proxy.getHost() == null) {
                throw new MojoExecutionException("Proxy in settings.xml has no host");
            } else {
                System.setProperty("proxySet", "true");
                System.setProperty("proxyHost", proxy.getHost());
                System.setProperty("proxyPort", String.valueOf(proxy.getPort()));
            }

        }
    }
View Full Code Here

        httpClient.getParams().setParameter( HttpMethodParams.USER_AGENT,
                                             "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)" );

        if ( settings != null && settings.getActiveProxy() != null )
        {
            Proxy activeProxy = settings.getActiveProxy();

            ProxyInfo proxyInfo = new ProxyInfo();
            proxyInfo.setNonProxyHosts( activeProxy.getNonProxyHosts() );

            if ( StringUtils.isNotEmpty( activeProxy.getHost() )
                && !ProxyUtils.validateNonProxyHosts( proxyInfo, url.getHost() ) )
            {
                httpClient.getHostConfiguration().setProxy( activeProxy.getHost(), activeProxy.getPort() );

                if ( StringUtils.isNotEmpty( activeProxy.getUsername() ) && activeProxy.getPassword() != null )
                {
                    Credentials credentials =
                        new UsernamePasswordCredentials( activeProxy.getUsername(), activeProxy.getPassword() );

                    httpClient.getState().setProxyCredentials( AuthScope.ANY, credentials );
                }
            }
        }
View Full Code Here

    }

    protected void configureProxyServerSettings() throws MojoExecutionException {

        Proxy proxy = mavenSession.getSettings().getActiveProxy();

        if (proxy != null) {

            getLog().info("Using proxy server configured in maven.");

            if (proxy.getHost() == null) {
                throw new MojoExecutionException("Proxy in settings.xml has no host");
            } else {
                System.setProperty("proxySet", "true");
                System.setProperty("proxyHost", proxy.getHost());
                System.setProperty("proxyPort", String.valueOf(proxy.getPort()));
            }

        }
    }
View Full Code Here

        if (originalProxyPassword != null) {
            System.setProperty(HTTP_PROXY_PASSWORD, originalProxyPassword);
        } else {
            System.getProperties().remove(HTTP_PROXY_PASSWORD);
        }
        Proxy proxy = mavenSession.getSettings().getActiveProxy();
        if (proxy != null && !StringUtils.isEmpty(proxy.getUsername())
            && !StringUtils.isEmpty(proxy.getPassword())) {
            Authenticator.setDefault(null);
        }
    }
View Full Code Here

TOP

Related Classes of org.apache.maven.settings.Proxy

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.