List of usage examples for org.apache.maven.artifact.manager WagonManager getAuthenticationInfo
AuthenticationInfo getAuthenticationInfo(String id);
From source file:com.google.dart.util.WagonUtils.java
License:Apache License
/** * Convenient method to create a wagon//from ww w .j a v a 2s . c o m * * @param id * @param url * @param wagonManager * @param settings * @param logger * @return * @throws MojoExecutionException */ public static Wagon createWagon(final String id, final String url, final WagonManager wagonManager, final Settings settings, final Log logger) throws WagonException, UnsupportedProtocolException, WagonConfigurationException { Wagon wagon = null; final Repository repository = new Repository(id, url); wagon = wagonManager.getWagon(repository); if (logger.isDebugEnabled()) { final Debug debug = new Debug(); wagon.addSessionListener(debug); wagon.addTransferListener(debug); } final ProxyInfo proxyInfo = getProxyInfo(settings); if (proxyInfo != null) { wagon.connect(repository, wagonManager.getAuthenticationInfo(repository.getId()), proxyInfo); } else { wagon.connect(repository, wagonManager.getAuthenticationInfo(repository.getId())); } return wagon; }
From source file:com.opoopress.maven.plugins.plugin.AbstractDeployMojo.java
License:Apache License
private static void push(final File inputDirectory, final Repository repository, final WagonManager manager, final Wagon wagon, final ProxyInfo proxyInfo, final String relativeDir, final Log log) throws MojoExecutionException { AuthenticationInfo authenticationInfo = manager.getAuthenticationInfo(repository.getId()); log.debug("authenticationInfo with id '" + repository.getId() + "': " + ((authenticationInfo == null) ? "-" : authenticationInfo.getUserName())); try {/*from w w w . j av a2s. c o m*/ Debug debug = new Debug(); wagon.addSessionListener(debug); wagon.addTransferListener(debug); if (proxyInfo != null) { log.debug("connect with proxyInfo"); wagon.connect(repository, authenticationInfo, proxyInfo); } else if (proxyInfo == null && authenticationInfo != null) { log.debug("connect with authenticationInfo and without proxyInfo"); wagon.connect(repository, authenticationInfo); } else { log.debug("connect without authenticationInfo and without proxyInfo"); wagon.connect(repository); } log.info("Pushing " + inputDirectory); // TODO: this also uploads the non-default locales, // is there a way to exclude directories in wagon? log.info(" >>> to " + repository.getUrl() + relativeDir); wagon.putDirectory(inputDirectory, relativeDir); } catch (ResourceDoesNotExistException e) { throw new MojoExecutionException("Error uploading site", e); } catch (TransferFailedException e) { throw new MojoExecutionException("Error uploading site", e); } catch (AuthorizationException e) { throw new MojoExecutionException("Error uploading site", e); } catch (ConnectionException e) { throw new MojoExecutionException("Error uploading site", e); } catch (AuthenticationException e) { throw new MojoExecutionException("Error uploading site", e); } }
From source file:org.codehaus.mojo.versions.utils.WagonUtils.java
License:Apache License
/** * Convenience method to create a wagon. * * @param serverId The serverId to use if the wagonManager needs help. * @param url The url to create a wagon for. * @param wagonManager The wgaon manager to use. * @param settings The settings to use. * @param logger The logger to use. * @return The wagon to connect to the url. * @throws org.apache.maven.wagon.UnsupportedProtocolException * if the protocol is not supported. * @throws org.apache.maven.artifact.manager.WagonConfigurationException * if the wagon cannot be configured. * @throws org.apache.maven.wagon.ConnectionException * If the connection cannot be established. * @throws org.apache.maven.wagon.authentication.AuthenticationException * If the connection cannot be authenticated. *//*from w w w .j a va2 s . c o m*/ public static Wagon createWagon(String serverId, String url, WagonManager wagonManager, Settings settings, Log logger) throws UnsupportedProtocolException, WagonConfigurationException, ConnectionException, AuthenticationException { Repository repository = new Repository(serverId, url); Wagon wagon = wagonManager.getWagon(repository); if (logger.isDebugEnabled()) { Debug debug = new Debug(); wagon.addSessionListener(debug); wagon.addTransferListener(debug); } ProxyInfo proxyInfo = getProxyInfo(settings); if (proxyInfo != null) { wagon.connect(repository, wagonManager.getAuthenticationInfo(repository.getId()), proxyInfo); } else { wagon.connect(repository, wagonManager.getAuthenticationInfo(repository.getId())); } return wagon; }
From source file:org.codehaus.mojo.wagon.shared.WagonUtils.java
License:Apache License
/** * Convenient method to create a wagon// w w w .j a v a 2s .c o m * * @param id * @param url * @param wagonManager * @param settings * @param logger * @return * @throws MojoExecutionException */ public static Wagon createWagon(String id, String url, WagonManager wagonManager, Settings settings, Log logger) throws WagonException, UnsupportedProtocolException, WagonConfigurationException { Wagon wagon = null; final Repository repository = new Repository(id, url); wagon = wagonManager.getWagon(repository); if (logger.isDebugEnabled()) { Debug debug = new Debug(); wagon.addSessionListener(debug); wagon.addTransferListener(debug); } ProxyInfo proxyInfo = getProxyInfo(settings); if (proxyInfo != null) { wagon.connect(repository, wagonManager.getAuthenticationInfo(repository.getId()), proxyInfo); } else { wagon.connect(repository, wagonManager.getAuthenticationInfo(repository.getId())); } return wagon; }