in src/main/java/org/apache/maven/plugins/scmpublish/AbstractScmPublishMojo.java [430:483]
private void checkCreateRemoteSvnPath() throws MojoExecutionException {
getLog().debug("AbstractSvnScmProvider used, so we can check if remote url exists and eventually create it.");
AbstractSvnScmProvider svnScmProvider = (AbstractSvnScmProvider) scmProvider;
try {
boolean remoteExists = svnScmProvider.remoteUrlExist(scmRepository.getProviderRepository(), null);
if (remoteExists) {
return;
}
} catch (ScmException e) {
throw new MojoExecutionException(e.getMessage(), e);
}
String remoteUrl = ((SvnScmProviderRepository) scmRepository.getProviderRepository()).getUrl();
if (!automaticRemotePathCreation) {
// olamy: return ?? that will fail during checkout IMHO :-)
logWarn("Remote svn url %s does not exist and automatic remote path creation disabled.", remoteUrl);
return;
}
logInfo("Remote svn url %s does not exist: creating.", remoteUrl);
File baseDir = null;
try {
// create a temporary directory for svnexec
baseDir = Files.createTempDirectory("scm").toFile();
// to prevent fileSet cannot be empty
ScmFileSet scmFileSet = new ScmFileSet(baseDir, new File(""));
CommandParameters commandParameters = new CommandParameters();
commandParameters.setString(CommandParameter.SCM_MKDIR_CREATE_IN_LOCAL, Boolean.FALSE.toString());
commandParameters.setString(CommandParameter.MESSAGE, "Automatic svn path creation: " + remoteUrl);
svnScmProvider.mkdir(scmRepository.getProviderRepository(), scmFileSet, commandParameters);
// new remote url so force checkout!
if (checkoutDirectory.exists()) {
FileUtils.deleteDirectory(checkoutDirectory);
}
} catch (IOException | ScmException e) {
throw new MojoExecutionException(e.getMessage(), e);
} finally {
if (baseDir != null) {
try {
FileUtils.forceDeleteOnExit(baseDir);
} catch (IOException e) {
throw new MojoExecutionException(e.getMessage(), e);
}
}
}
}