Search in sources :

Example 1 with DefaultWagonManager

use of org.apache.maven.artifact.manager.DefaultWagonManager in project intellij-community by JetBrains.

the class MavenEmbedder method loadSettings.

private void loadSettings() {
    // copied from DefaultMaven.resolveParameters
    // copied because using original code spoils something in the container and configuration are get messed and not picked up.
    WagonManager wagonManager = getComponent(WagonManager.class);
    wagonManager.setOnline(!mySettings.isOffline());
    if (wagonManager instanceof DefaultWagonManager) {
        ((DefaultWagonManager) wagonManager).setHttpUserAgent("Apache-Maven/2.2");
    }
    Proxy proxy = mySettings.getActiveProxy();
    if (proxy != null && proxy.getHost() != null) {
        String pass = decrypt(proxy.getPassword());
        wagonManager.addProxy(proxy.getProtocol(), proxy.getHost(), proxy.getPort(), proxy.getUsername(), pass, proxy.getNonProxyHosts());
    }
    for (Object each : mySettings.getServers()) {
        Server server = (Server) each;
        String passWord = decrypt(server.getPassword());
        String passPhrase = decrypt(server.getPassphrase());
        wagonManager.addAuthenticationInfo(server.getId(), server.getUsername(), passWord, server.getPrivateKey(), passPhrase);
        wagonManager.addPermissionInfo(server.getId(), server.getFilePermissions(), server.getDirectoryPermissions());
        if (server.getConfiguration() != null) {
            wagonManager.addConfiguration(server.getId(), (Xpp3Dom) server.getConfiguration());
        }
    }
    for (Object each : mySettings.getMirrors()) {
        Mirror mirror = (Mirror) each;
        if (mirror.getUrl() == null)
            continue;
        wagonManager.addMirror(mirror.getId(), mirror.getMirrorOf(), mirror.getUrl());
    }
// end copied from DefaultMaven.resolveParameters
}
Also used : DefaultWagonManager(org.apache.maven.artifact.manager.DefaultWagonManager) WagonManager(org.apache.maven.artifact.manager.WagonManager) DefaultWagonManager(org.apache.maven.artifact.manager.DefaultWagonManager)

Aggregations

DefaultWagonManager (org.apache.maven.artifact.manager.DefaultWagonManager)1 WagonManager (org.apache.maven.artifact.manager.WagonManager)1