in src/main/java/org/apache/maven/plugins/site/deploy/AbstractDeployMojo.java [318:373]
private void push(
final File inputDirectory,
final Repository repository,
final Wagon wagon,
final ProxyInfo proxyInfo,
final List<Locale> localesList,
final String relativeDir)
throws MojoExecutionException {
AuthenticationInfo authenticationInfo = getAuthenticationInfo(repository.getId());
if (authenticationInfo != null) {
getLog().debug("authenticationInfo with id '" + repository.getId() + "'");
}
try {
if (getLog().isDebugEnabled()) {
Debug debug = new Debug();
wagon.addSessionListener(debug);
wagon.addTransferListener(debug);
}
if (proxyInfo != null) {
getLog().debug("connect with proxyInfo");
wagon.connect(repository, authenticationInfo, proxyInfo);
} else if (authenticationInfo != null) {
getLog().debug("connect with authenticationInfo and without proxyInfo");
wagon.connect(repository, authenticationInfo);
} else {
getLog().debug("connect without authenticationInfo and without proxyInfo");
wagon.connect(repository);
}
getLog().info("Pushing " + inputDirectory);
for (Locale locale : localesList) {
if (!locale.equals(SiteTool.DEFAULT_LOCALE)) {
getLog().info(" >>> to " + appendSlash(repository.getUrl()) + locale + "/" + relativeDir);
wagon.putDirectory(new File(inputDirectory, locale.toString()), locale + "/" + relativeDir);
} else {
// TODO: this also uploads the non-default locales,
// is there a way to exclude directories in wagon?
getLog().info(" >>> to " + appendSlash(repository.getUrl()) + relativeDir);
wagon.putDirectory(inputDirectory, relativeDir);
}
}
} catch (ResourceDoesNotExistException
| TransferFailedException
| AuthorizationException
| ConnectionException
| AuthenticationException e) {
throw new MojoExecutionException("Error uploading site", e);
}
}