You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by sl...@apache.org on 2023/03/04 16:20:29 UTC
[maven-scm-publish-plugin] 02/02: [MSCMPUB-57] Reformat
This is an automated email from the ASF dual-hosted git repository.
slachiewicz pushed a commit to branch MSCMPUB-57
in repository https://gitbox.apache.org/repos/asf/maven-scm-publish-plugin.git
commit 361ff9b95bef0393e42195ad412d62ae643ccc7f
Author: Sylwester Lachiewicz <sl...@apache.org>
AuthorDate: Sat Mar 4 17:19:18 2023 +0100
[MSCMPUB-57] Reformat
---
pom.xml | 12 +-
.../plugins/scmpublish/AbstractScmPublishMojo.java | 564 +++++++++------------
.../scmpublish/ScmPublishPublishScmMojo.java | 279 +++++-----
3 files changed, 349 insertions(+), 506 deletions(-)
diff --git a/pom.xml b/pom.xml
index e3b620a..5c2fcb9 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1,5 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
-
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
@@ -18,7 +17,6 @@ KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
-
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
@@ -41,11 +39,15 @@ under the License.
</contributor>
</contributors>
+ <prerequisites>
+ <maven>${mavenVersion}</maven>
+ </prerequisites>
+
<scm>
<connection>scm:git:https://gitbox.apache.org/repos/asf/maven-scm-publish-plugin.git</connection>
<developerConnection>scm:git:https://gitbox.apache.org/repos/asf/maven-scm-publish-plugin.git</developerConnection>
- <url>https://github.com/apache/maven-scm-publish-plugin/tree/${project.scm.tag}</url>
<tag>HEAD</tag>
+ <url>https://github.com/apache/maven-scm-publish-plugin/tree/${project.scm.tag}</url>
</scm>
<issueManagement>
<system>JIRA</system>
@@ -72,10 +74,6 @@ under the License.
<svnkit-version>1.7.11</svnkit-version>
<project.build.outputTimestamp>2020-12-23T07:12:37Z</project.build.outputTimestamp>
</properties>
-
- <prerequisites>
- <maven>${mavenVersion}</maven>
- </prerequisites>
<dependencies>
<dependency>
diff --git a/src/main/java/org/apache/maven/plugins/scmpublish/AbstractScmPublishMojo.java b/src/main/java/org/apache/maven/plugins/scmpublish/AbstractScmPublishMojo.java
index e9822a0..d4689f9 100644
--- a/src/main/java/org/apache/maven/plugins/scmpublish/AbstractScmPublishMojo.java
+++ b/src/main/java/org/apache/maven/plugins/scmpublish/AbstractScmPublishMojo.java
@@ -1,5 +1,3 @@
-package org.apache.maven.plugins.scmpublish;
-
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -9,7 +7,7 @@ package org.apache.maven.plugins.scmpublish;
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
@@ -18,6 +16,7 @@ package org.apache.maven.plugins.scmpublish;
* specific language governing permissions and limitations
* under the License.
*/
+package org.apache.maven.plugins.scmpublish;
import java.io.File;
import java.io.IOException;
@@ -68,9 +67,7 @@ import org.apache.maven.shared.utils.logging.MessageUtils;
/**
* Base class for the scm-publish mojos.
*/
-public abstract class AbstractScmPublishMojo
- extends AbstractMojo
-{
+public abstract class AbstractScmPublishMojo extends AbstractMojo {
// CHECKSTYLE_OFF: LineLength
/**
* Location of the scm publication tree:
@@ -79,19 +76,21 @@ public abstract class AbstractScmPublishMojo
* <code>scm:svn:https://svn.apache.org/repos/infra/websites/production/maven/content/plugins/maven-scm-publish-plugin-LATEST/</code>
*/
// CHECKSTYLE_ON: LineLength
- @Parameter ( property = "scmpublish.pubScmUrl", defaultValue = "${project.distributionManagement.site.url}",
- required = true )
+ @Parameter(
+ property = "scmpublish.pubScmUrl",
+ defaultValue = "${project.distributionManagement.site.url}",
+ required = true)
protected String pubScmUrl;
/**
* If the checkout directory exists and this flag is activated, the plugin will try an SCM-update instead
* of delete then checkout.
*/
- @Parameter ( property = "scmpublish.tryUpdate", defaultValue = "false" )
+ @Parameter(property = "scmpublish.tryUpdate", defaultValue = "false")
protected boolean tryUpdate;
// CHECKSTYLE_OFF: LineLength
- /**
+ /**
* Location where the scm check-out is done. By default, scm checkout is done in build (target) directory,
* which is deleted on every <code>mvn clean</code>. To avoid this and get better performance, configure
* this location outside build structure and set <code>tryUpdate</code> to <code>true</code>.
@@ -99,21 +98,22 @@ public abstract class AbstractScmPublishMojo
* Improving SCM Checkout Performance</a> for more information.
*/
// CHECKSTYLE_ON: LineLength
- @Parameter ( property = "scmpublish.checkoutDirectory",
- defaultValue = "${project.build.directory}/scmpublish-checkout" )
+ @Parameter(
+ property = "scmpublish.checkoutDirectory",
+ defaultValue = "${project.build.directory}/scmpublish-checkout")
protected File checkoutDirectory;
/**
* Location where the content is published inside the <code>${checkoutDirectory}</code>.
* By default, content is copyed at the root of <code>${checkoutDirectory}</code>.
*/
- @Parameter ( property = "scmpublish.subDirectory" )
+ @Parameter(property = "scmpublish.subDirectory")
protected String subDirectory;
/**
* Display list of added, deleted, and changed files, but do not do any actual SCM operations.
*/
- @Parameter ( property = "scmpublish.dryRun" )
+ @Parameter(property = "scmpublish.dryRun")
private boolean dryRun;
/**
@@ -122,25 +122,25 @@ public abstract class AbstractScmPublishMojo
* @deprecated Please use {@link #skipDeployment}.
*/
@Deprecated
- @Parameter ( defaultValue = "false" )
+ @Parameter(defaultValue = "false")
private boolean skipDeployement;
/**
* Set this to 'true' to skip site deployment.
*/
- @Parameter ( property = "scmpublish.skipDeploy", alias = "maven.site.deploy.skip", defaultValue = "false" )
+ @Parameter(property = "scmpublish.skipDeploy", alias = "maven.site.deploy.skip", defaultValue = "false")
private boolean skipDeployment;
/**
* Run add and delete commands, but leave the actually checkin for the user to run manually.
*/
- @Parameter ( property = "scmpublish.skipCheckin" )
+ @Parameter(property = "scmpublish.skipCheckin")
private boolean skipCheckin;
/**
* SCM log/checkin comment for this publication.
*/
- @Parameter ( property = "scmpublish.checkinComment", defaultValue = "Site checkin for project ${project.name}" )
+ @Parameter(property = "scmpublish.checkinComment", defaultValue = "Site checkin for project ${project.name}")
private String checkinComment;
/**
@@ -186,13 +186,13 @@ public abstract class AbstractScmPublishMojo
/**
* The SCM username to use.
*/
- @Parameter ( property = "username" )
+ @Parameter(property = "username")
protected String username;
/**
* The SCM password to use.
*/
- @Parameter ( property = "password" )
+ @Parameter(property = "password")
protected String password;
/**
@@ -200,43 +200,42 @@ public abstract class AbstractScmPublishMojo
* <b>WARNING</b>: This will only work with distributed SCMs which support the file:// protocol.
* TODO: we should think about having the defaults for the various SCM providers provided via Modello!
*/
- @Parameter ( property = "localCheckout", defaultValue = "false" )
+ @Parameter(property = "localCheckout", defaultValue = "false")
protected boolean localCheckout;
/**
* The outputEncoding parameter of the site plugin. This plugin will corrupt your site
* if this does not match the value used by the site plugin.
*/
- @Parameter ( property = "outputEncoding", defaultValue = "${project.reporting.outputEncoding}" )
+ @Parameter(property = "outputEncoding", defaultValue = "${project.reporting.outputEncoding}")
protected String siteOutputEncoding;
/**
* Do not delete files to the scm
*/
- @Parameter ( property = "scmpublish.skipDeletedFiles", defaultValue = "false" )
+ @Parameter(property = "scmpublish.skipDeletedFiles", defaultValue = "false")
protected boolean skipDeletedFiles;
/**
* Add each directory in a separated SCM command: this can be necessary if SCM does not support
* adding subdirectories in one command.
*/
- @Parameter( defaultValue = "false" )
+ @Parameter(defaultValue = "false")
protected boolean addUniqueDirectory;
/**
*/
- @Parameter ( defaultValue = "${basedir}", readonly = true )
+ @Parameter(defaultValue = "${basedir}", readonly = true)
protected File basedir;
/**
*/
- @Parameter( defaultValue = "${settings}", readonly = true, required = true )
+ @Parameter(defaultValue = "${settings}", readonly = true, required = true)
protected Settings settings;
@Component
private SettingsDecrypter settingsDecrypter;
-
/**
* Collections of paths not to delete when checking content to delete.
* If your site has subdirectories published by an other mechanism/build
@@ -247,19 +246,19 @@ public abstract class AbstractScmPublishMojo
/**
* SCM branch to use. For github, you must configure with <code>gh-pages</code>.
*/
- @Parameter ( property = "scmpublish.scm.branch" )
+ @Parameter(property = "scmpublish.scm.branch")
protected String scmBranch;
/**
* Configure svn automatic remote url creation.
*/
- @Parameter ( property = "scmpublish.automaticRemotePathCreation", defaultValue = "true" )
+ @Parameter(property = "scmpublish.automaticRemotePathCreation", defaultValue = "true")
protected boolean automaticRemotePathCreation;
/**
* Filename extensions of files which need new line normalization.
*/
- private static final String[] NORMALIZE_EXTENSIONS = { "html", "css", "js" };
+ private static final String[] NORMALIZE_EXTENSIONS = {"html", "css", "js"};
/**
* Extra file extensions to normalize line ending (will be added to default
@@ -274,52 +273,41 @@ public abstract class AbstractScmPublishMojo
protected ScmRepository scmRepository;
- protected void logInfo( String format, Object... params )
- {
- getLog().info( String.format( format, params ) );
+ protected void logInfo(String format, Object... params) {
+ getLog().info(String.format(format, params));
}
- protected void logWarn( String format, Object... params )
- {
- getLog().warn( String.format( format, params ) );
+ protected void logWarn(String format, Object... params) {
+ getLog().warn(String.format(format, params));
}
- protected void logError( String format, Object... params )
- {
- getLog().error( String.format( format, params ) );
+ protected void logError(String format, Object... params) {
+ getLog().error(String.format(format, params));
}
- private File relativize( File base, File file )
- {
- return new File( base.toURI().relativize( file.toURI() ).getPath() );
+ private File relativize(File base, File file) {
+ return new File(base.toURI().relativize(file.toURI()).getPath());
}
- protected boolean requireNormalizeNewlines( File f )
- throws IOException
- {
- if ( normalizeExtensions == null )
- {
- normalizeExtensions = new HashSet<>( Arrays.asList( NORMALIZE_EXTENSIONS ) );
- if ( extraNormalizeExtensions != null )
- {
- normalizeExtensions.addAll( Arrays.asList( extraNormalizeExtensions ) );
+ protected boolean requireNormalizeNewlines(File f) throws IOException {
+ if (normalizeExtensions == null) {
+ normalizeExtensions = new HashSet<>(Arrays.asList(NORMALIZE_EXTENSIONS));
+ if (extraNormalizeExtensions != null) {
+ normalizeExtensions.addAll(Arrays.asList(extraNormalizeExtensions));
}
}
- return FilenameUtils.isExtension( f.getName(), normalizeExtensions );
+ return FilenameUtils.isExtension(f.getName(), normalizeExtensions);
}
- private ReleaseDescriptor setupScm()
- throws ScmRepositoryException, NoSuchScmProviderException
- {
+ private ReleaseDescriptor setupScm() throws ScmRepositoryException, NoSuchScmProviderException {
String scmUrl;
- if ( localCheckout )
- {
+ if (localCheckout) {
// in the release phase we have to change the checkout URL
// to do a local checkout instead of going over the network.
- String provider = ScmUrlUtils.getProvider( pubScmUrl );
- String delimiter = ScmUrlUtils.getDelimiter( pubScmUrl );
+ String provider = ScmUrlUtils.getProvider(pubScmUrl);
+ String delimiter = ScmUrlUtils.getDelimiter(pubScmUrl);
String providerPart = "scm:" + provider + delimiter;
@@ -327,34 +315,28 @@ public abstract class AbstractScmPublishMojo
// X TODO: in case our toplevel git directory has no pom.
// X TODO: fix pathname once I understand this.
scmUrl = providerPart + "file://" + "target/localCheckout";
- logInfo( "Performing a LOCAL checkout from " + scmUrl );
+ logInfo("Performing a LOCAL checkout from " + scmUrl);
}
ReleaseDescriptor releaseDescriptor = new ReleaseDescriptor();
- releaseDescriptor.setInteractive( settings.isInteractiveMode() );
+ releaseDescriptor.setInteractive(settings.isInteractiveMode());
- if ( username == null || password == null )
- {
- for ( Server server : settings.getServers() )
- {
- if ( server.getId().equals( serverId ) )
- {
- SettingsDecryptionRequest decryptionRequest = new DefaultSettingsDecryptionRequest( server );
+ if (username == null || password == null) {
+ for (Server server : settings.getServers()) {
+ if (server.getId().equals(serverId)) {
+ SettingsDecryptionRequest decryptionRequest = new DefaultSettingsDecryptionRequest(server);
- SettingsDecryptionResult decryptionResult = settingsDecrypter.decrypt( decryptionRequest );
+ SettingsDecryptionResult decryptionResult = settingsDecrypter.decrypt(decryptionRequest);
- if ( !decryptionResult.getProblems().isEmpty() )
- {
+ if (!decryptionResult.getProblems().isEmpty()) {
// todo throw exception?
}
- if ( username == null )
- {
+ if (username == null) {
username = decryptionResult.getServer().getUsername();
}
- if ( password == null )
- {
+ if (password == null) {
password = decryptionResult.getServer().getPassword();
}
@@ -363,238 +345,185 @@ public abstract class AbstractScmPublishMojo
}
}
- releaseDescriptor.setScmPassword( password );
- releaseDescriptor.setScmUsername( username );
+ releaseDescriptor.setScmPassword(password);
+ releaseDescriptor.setScmUsername(username);
- releaseDescriptor.setWorkingDirectory( basedir.getAbsolutePath() );
- releaseDescriptor.setLocalCheckout( localCheckout );
- releaseDescriptor.setScmSourceUrl( pubScmUrl );
+ releaseDescriptor.setWorkingDirectory(basedir.getAbsolutePath());
+ releaseDescriptor.setLocalCheckout(localCheckout);
+ releaseDescriptor.setScmSourceUrl(pubScmUrl);
- if ( providerImplementations != null )
- {
- for ( Map.Entry<String, String> providerEntry : providerImplementations.entrySet() )
- {
- logInfo( "Changing the default '%s' provider implementation to '%s'.", providerEntry.getKey(),
- providerEntry.getValue() );
- scmManager.setScmProviderImplementation( providerEntry.getKey(), providerEntry.getValue() );
+ if (providerImplementations != null) {
+ for (Map.Entry<String, String> providerEntry : providerImplementations.entrySet()) {
+ logInfo(
+ "Changing the default '%s' provider implementation to '%s'.",
+ providerEntry.getKey(), providerEntry.getValue());
+ scmManager.setScmProviderImplementation(providerEntry.getKey(), providerEntry.getValue());
}
}
- scmRepository = scmRepositoryConfigurator.getConfiguredRepository( releaseDescriptor, settings );
+ scmRepository = scmRepositoryConfigurator.getConfiguredRepository(releaseDescriptor, settings);
- scmProvider = scmRepositoryConfigurator.getRepositoryProvider( scmRepository );
+ scmProvider = scmRepositoryConfigurator.getRepositoryProvider(scmRepository);
return releaseDescriptor;
}
- protected void checkoutExisting()
- throws MojoExecutionException
- {
+ protected void checkoutExisting() throws MojoExecutionException {
- if ( scmProvider instanceof AbstractSvnScmProvider )
- {
+ if (scmProvider instanceof AbstractSvnScmProvider) {
checkCreateRemoteSvnPath();
}
- logInfo( MessageUtils.buffer().strong( "%s" ) + " the pub tree from " + MessageUtils.buffer().strong( "%s" )
- + " into %s", ( tryUpdate ? "Updating" : "Checking out" ), pubScmUrl, checkoutDirectory );
+ logInfo(
+ MessageUtils.buffer().strong("%s") + " the pub tree from "
+ + MessageUtils.buffer().strong("%s") + " into %s",
+ (tryUpdate ? "Updating" : "Checking out"),
+ pubScmUrl,
+ checkoutDirectory);
- if ( checkoutDirectory.exists() && !tryUpdate )
+ if (checkoutDirectory.exists() && !tryUpdate) {
- {
- try
- {
- FileUtils.deleteDirectory( checkoutDirectory );
- }
- catch ( IOException e )
- {
- logError( e.getMessage() );
+ try {
+ FileUtils.deleteDirectory(checkoutDirectory);
+ } catch (IOException e) {
+ logError(e.getMessage());
- throw new MojoExecutionException( "Unable to remove old checkout directory: " + e.getMessage(), e );
+ throw new MojoExecutionException("Unable to remove old checkout directory: " + e.getMessage(), e);
}
}
boolean forceCheckout = false;
- if ( !checkoutDirectory.exists() )
+ if (!checkoutDirectory.exists()) {
- {
- if ( tryUpdate )
- {
- logInfo( "TryUpdate is configured but no local copy currently available: forcing checkout." );
+ if (tryUpdate) {
+ logInfo("TryUpdate is configured but no local copy currently available: forcing checkout.");
}
checkoutDirectory.mkdirs();
forceCheckout = true;
}
- try
- {
- ScmFileSet fileSet = new ScmFileSet( checkoutDirectory, includes, excludes );
+ try {
+ ScmFileSet fileSet = new ScmFileSet(checkoutDirectory, includes, excludes);
- ScmBranch branch = ( scmBranch == null ) ? null : new ScmBranch( scmBranch );
+ ScmBranch branch = (scmBranch == null) ? null : new ScmBranch(scmBranch);
ScmResult scmResult = null;
- if ( tryUpdate && !forceCheckout )
- {
- scmResult = scmProvider.update( scmRepository, fileSet, branch );
- }
- else
- {
+ if (tryUpdate && !forceCheckout) {
+ scmResult = scmProvider.update(scmRepository, fileSet, branch);
+ } else {
int attempt = 0;
- while ( scmResult == null )
- {
- try
- {
- scmResult = scmProvider.checkOut( scmRepository, fileSet, branch );
- }
- catch ( ScmException e )
- {
+ while (scmResult == null) {
+ try {
+ scmResult = scmProvider.checkOut(scmRepository, fileSet, branch);
+ } catch (ScmException e) {
// give it max 2 times to retry
- if ( attempt++ < 2 )
- {
- try
- {
+ if (attempt++ < 2) {
+ try {
// wait 3 seconds
- Thread.sleep( 3 * 1000 );
- }
- catch ( InterruptedException ie )
- {
+ Thread.sleep(3 * 1000);
+ } catch (InterruptedException ie) {
// noop
}
- }
- else
- {
+ } else {
throw e;
}
}
}
}
- checkScmResult( scmResult, "check out from SCM" );
- }
- catch ( ScmException | IOException e )
- {
- logError( e.getMessage() );
+ checkScmResult(scmResult, "check out from SCM");
+ } catch (ScmException | IOException e) {
+ logError(e.getMessage());
- throw new MojoExecutionException( "An error occurred during the checkout process: " + e.getMessage(), e );
+ throw new MojoExecutionException("An error occurred during the checkout process: " + e.getMessage(), e);
}
}
- private void checkCreateRemoteSvnPath()
- throws MojoExecutionException
- {
- getLog().debug( "AbstractSvnScmProvider used, so we can check if remote url exists and eventually create it." );
+ 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 );
+ try {
+ boolean remoteExists = svnScmProvider.remoteUrlExist(scmRepository.getProviderRepository(), null);
- if ( remoteExists )
- {
+ if (remoteExists) {
return;
}
- }
- catch ( ScmException e )
- {
- throw new MojoExecutionException( e.getMessage(), e );
+ } catch (ScmException e) {
+ throw new MojoExecutionException(e.getMessage(), e);
}
- String remoteUrl = ( (SvnScmProviderRepository) scmRepository.getProviderRepository() ).getUrl();
+ String remoteUrl = ((SvnScmProviderRepository) scmRepository.getProviderRepository()).getUrl();
- if ( !automaticRemotePathCreation )
- {
+ 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 );
+ 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 );
+ logInfo("Remote svn url %s does not exist: creating.", remoteUrl);
File baseDir = null;
- try
- {
+ try {
// create a temporary directory for svnexec
- baseDir = Files.createTempDirectory( "scm" ).toFile();
+ baseDir = Files.createTempDirectory("scm").toFile();
// to prevent fileSet cannot be empty
- ScmFileSet scmFileSet = new ScmFileSet( baseDir, new File( "" ) );
+ 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 );
+ 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 );
+ 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 );
+ } 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);
}
}
}
}
- public void execute()
- throws MojoExecutionException, MojoFailureException
- {
- if ( skipDeployment || skipDeployement )
- {
- getLog().info( "scmpublish.skipDeploy = true: Skipping site deployment" );
+ public void execute() throws MojoExecutionException, MojoFailureException {
+ if (skipDeployment || skipDeployement) {
+ getLog().info("scmpublish.skipDeploy = true: Skipping site deployment");
return;
}
// setup the scm plugin with help from release plugin utilities
- try
- {
+ try {
setupScm();
- }
- catch ( ScmRepositoryException | NoSuchScmProviderException e )
- {
- throw new MojoExecutionException( e.getMessage(), e );
+ } catch (ScmRepositoryException | NoSuchScmProviderException e) {
+ throw new MojoExecutionException(e.getMessage(), e);
}
boolean tmpCheckout = false;
- if ( checkoutDirectory.getPath().contains( "${project." ) )
- {
- try
- {
+ if (checkoutDirectory.getPath().contains("${project.")) {
+ try {
tmpCheckout = true;
- checkoutDirectory = Files.createTempDirectory( "maven-scm-publish" + ".checkout" ).toFile();
- }
- catch ( IOException ioe )
- {
- throw new MojoExecutionException( ioe.getMessage(), ioe );
+ checkoutDirectory = Files.createTempDirectory("maven-scm-publish" + ".checkout")
+ .toFile();
+ } catch (IOException ioe) {
+ throw new MojoExecutionException(ioe.getMessage(), ioe);
}
}
- try
- {
+ try {
scmPublishExecute();
- }
- finally
- {
- if ( tmpCheckout )
- {
- FileUtils.deleteQuietly( checkoutDirectory );
+ } finally {
+ if (tmpCheckout) {
+ FileUtils.deleteQuietly(checkoutDirectory);
}
}
}
@@ -604,57 +533,47 @@ public abstract class AbstractScmPublishMojo
*
* @throws MojoExecutionException in case of issue
*/
- protected void checkinFiles()
- throws MojoExecutionException
- {
- if ( skipCheckin )
- {
+ protected void checkinFiles() throws MojoExecutionException {
+ if (skipCheckin) {
return;
}
- ScmFileSet updatedFileSet = new ScmFileSet( checkoutDirectory );
- try
- {
+ ScmFileSet updatedFileSet = new ScmFileSet(checkoutDirectory);
+ try {
long start = System.currentTimeMillis();
- CheckInScmResult checkinResult =
- checkScmResult( scmProvider.checkIn( scmRepository, updatedFileSet, new ScmBranch( scmBranch ),
- checkinComment ), "check-in files to SCM" );
+ CheckInScmResult checkinResult = checkScmResult(
+ scmProvider.checkIn(scmRepository, updatedFileSet, new ScmBranch(scmBranch), checkinComment),
+ "check-in files to SCM");
- logInfo( "Checked in %d file(s) to revision %s in %s", checkinResult.getCheckedInFiles().size(),
- checkinResult.getScmRevision(),
- DurationFormatUtils.formatPeriod( start, System.currentTimeMillis(), "H' h 'm' m 's' s'" ) );
- }
- catch ( ScmException e )
- {
- throw new MojoExecutionException( "Failed to perform SCM checkin", e );
+ logInfo(
+ "Checked in %d file(s) to revision %s in %s",
+ checkinResult.getCheckedInFiles().size(),
+ checkinResult.getScmRevision(),
+ DurationFormatUtils.formatPeriod(start, System.currentTimeMillis(), "H' h 'm' m 's' s'"));
+ } catch (ScmException e) {
+ throw new MojoExecutionException("Failed to perform SCM checkin", e);
}
}
- protected void deleteFiles( Collection<File> deleted )
- throws MojoExecutionException
- {
- if ( skipDeletedFiles )
- {
- logInfo( "Deleting files is skipped." );
+ protected void deleteFiles(Collection<File> deleted) throws MojoExecutionException {
+ if (skipDeletedFiles) {
+ logInfo("Deleting files is skipped.");
return;
}
List<File> deletedList = new ArrayList<>();
- for ( File f : deleted )
- {
- deletedList.add( relativize( checkoutDirectory, f ) );
+ for (File f : deleted) {
+ deletedList.add(relativize(checkoutDirectory, f));
}
- ScmFileSet deletedFileSet = new ScmFileSet( checkoutDirectory, deletedList );
- try
- {
- getLog().info( "Deleting files: " + deletedList );
+ ScmFileSet deletedFileSet = new ScmFileSet(checkoutDirectory, deletedList);
+ try {
+ getLog().info("Deleting files: " + deletedList);
- checkScmResult( scmProvider.remove( scmRepository, deletedFileSet, "Deleting obsolete site files." ),
- "delete files from SCM" );
- }
- catch ( ScmException e )
- {
- throw new MojoExecutionException( "Failed to delete removed files to SCM", e );
+ checkScmResult(
+ scmProvider.remove(scmRepository, deletedFileSet, "Deleting obsolete site files."),
+ "delete files from SCM");
+ } catch (ScmException e) {
+ throw new MojoExecutionException("Failed to delete removed files to SCM", e);
}
}
@@ -665,121 +584,90 @@ public abstract class AbstractScmPublishMojo
* @throws MojoFailureException in case of issue
* @throws MojoExecutionException in case of issue
*/
- protected void addFiles( Collection<File> added )
- throws MojoFailureException, MojoExecutionException
- {
+ protected void addFiles(Collection<File> added) throws MojoFailureException, MojoExecutionException {
List<File> addedList = new ArrayList<>();
Set<File> createdDirs = new HashSet<>();
Set<File> dirsToAdd = new TreeSet<>();
- createdDirs.add( relativize( checkoutDirectory, checkoutDirectory ) );
+ createdDirs.add(relativize(checkoutDirectory, checkoutDirectory));
- for ( File f : added )
- {
- for ( File dir = f.getParentFile(); !dir.equals( checkoutDirectory ); dir = dir.getParentFile() )
- {
- File relativized = relativize( checkoutDirectory, dir );
+ for (File f : added) {
+ for (File dir = f.getParentFile(); !dir.equals(checkoutDirectory); dir = dir.getParentFile()) {
+ File relativized = relativize(checkoutDirectory, dir);
// we do the best we can with the directories
- if ( createdDirs.add( relativized ) )
- {
- dirsToAdd.add( relativized );
- }
- else
- {
+ if (createdDirs.add(relativized)) {
+ dirsToAdd.add(relativized);
+ } else {
break;
}
}
- addedList.add( relativize( checkoutDirectory, f ) );
- }
-
- if ( addUniqueDirectory )
- { // add one directory at a time
- for ( File relativized : dirsToAdd )
- {
- try
- {
- ScmFileSet fileSet = new ScmFileSet( checkoutDirectory, relativized );
- getLog().info( "scm add directory: " + relativized );
- AddScmResult addDirResult = scmProvider.add( scmRepository, fileSet, "Adding directory" );
- if ( !addDirResult.isSuccess() )
- {
- getLog().warn( " Error adding directory " + relativized + ": "
- + addDirResult.getCommandOutput() );
+ addedList.add(relativize(checkoutDirectory, f));
+ }
+
+ if (addUniqueDirectory) { // add one directory at a time
+ for (File relativized : dirsToAdd) {
+ try {
+ ScmFileSet fileSet = new ScmFileSet(checkoutDirectory, relativized);
+ getLog().info("scm add directory: " + relativized);
+ AddScmResult addDirResult = scmProvider.add(scmRepository, fileSet, "Adding directory");
+ if (!addDirResult.isSuccess()) {
+ getLog().warn(" Error adding directory " + relativized + ": "
+ + addDirResult.getCommandOutput());
}
- }
- catch ( ScmException e )
- {
+ } catch (ScmException e) {
//
}
}
- }
- else
- { // add all directories in one command
- try
- {
- List<File> dirs = new ArrayList<>( dirsToAdd );
- ScmFileSet fileSet = new ScmFileSet( checkoutDirectory, dirs );
- getLog().info( "scm add directories: " + dirs );
- AddScmResult addDirResult = scmProvider.add( scmRepository, fileSet, "Adding directories" );
- if ( !addDirResult.isSuccess() )
- {
- getLog().warn( " Error adding directories " + dirs + ": " + addDirResult.getCommandOutput() );
+ } else { // add all directories in one command
+ try {
+ List<File> dirs = new ArrayList<>(dirsToAdd);
+ ScmFileSet fileSet = new ScmFileSet(checkoutDirectory, dirs);
+ getLog().info("scm add directories: " + dirs);
+ AddScmResult addDirResult = scmProvider.add(scmRepository, fileSet, "Adding directories");
+ if (!addDirResult.isSuccess()) {
+ getLog().warn(" Error adding directories " + dirs + ": " + addDirResult.getCommandOutput());
}
- }
- catch ( ScmException e )
- {
+ } catch (ScmException e) {
//
}
}
// remove directories already added !
- addedList.removeAll( dirsToAdd );
-
- ScmFileSet addedFileSet = new ScmFileSet( checkoutDirectory, addedList );
- getLog().info( "scm add files: " + addedList );
- try
- {
- CommandParameters commandParameters = new CommandParameters();
- commandParameters.setString( CommandParameter.MESSAGE, "Adding new site files." );
- commandParameters.setString( CommandParameter.FORCE_ADD, Boolean.TRUE.toString() );
- checkScmResult( scmProvider.add( scmRepository, addedFileSet, commandParameters ),
- "add new files to SCM" );
- }
- catch ( ScmException e )
- {
- throw new MojoExecutionException( "Failed to add new files to SCM", e );
+ addedList.removeAll(dirsToAdd);
+
+ ScmFileSet addedFileSet = new ScmFileSet(checkoutDirectory, addedList);
+ getLog().info("scm add files: " + addedList);
+ try {
+ CommandParameters commandParameters = new CommandParameters();
+ commandParameters.setString(CommandParameter.MESSAGE, "Adding new site files.");
+ commandParameters.setString(CommandParameter.FORCE_ADD, Boolean.TRUE.toString());
+ checkScmResult(scmProvider.add(scmRepository, addedFileSet, commandParameters), "add new files to SCM");
+ } catch (ScmException e) {
+ throw new MojoExecutionException("Failed to add new files to SCM", e);
}
}
- private <T extends ScmResult> T checkScmResult( T result, String failure )
- throws MojoExecutionException
- {
- if ( !result.isSuccess() )
- {
+ private <T extends ScmResult> T checkScmResult(T result, String failure) throws MojoExecutionException {
+ if (!result.isSuccess()) {
String msg = "Failed to " + failure + ": " + result.getProviderMessage() + " " + result.getCommandOutput();
- logError( msg );
- throw new MojoExecutionException( msg );
+ logError(msg);
+ throw new MojoExecutionException(msg);
}
return result;
}
- public boolean isDryRun()
- {
+ public boolean isDryRun() {
return dryRun;
}
- public abstract void scmPublishExecute()
- throws MojoExecutionException, MojoFailureException;
+ public abstract void scmPublishExecute() throws MojoExecutionException, MojoFailureException;
- public void setPubScmUrl( String pubScmUrl )
- {
+ public void setPubScmUrl(String pubScmUrl) {
// Fix required for Windows, which fit other OS as well
- if ( pubScmUrl.startsWith( "scm:svn:" ) )
- {
- pubScmUrl = pubScmUrl.replaceFirst( "file:/[/]*", "file:///" );
+ if (pubScmUrl.startsWith("scm:svn:")) {
+ pubScmUrl = pubScmUrl.replaceFirst("file:/[/]*", "file:///");
}
this.pubScmUrl = pubScmUrl;
}
-
}
diff --git a/src/main/java/org/apache/maven/plugins/scmpublish/ScmPublishPublishScmMojo.java b/src/main/java/org/apache/maven/plugins/scmpublish/ScmPublishPublishScmMojo.java
index 265d65a..36de21a 100644
--- a/src/main/java/org/apache/maven/plugins/scmpublish/ScmPublishPublishScmMojo.java
+++ b/src/main/java/org/apache/maven/plugins/scmpublish/ScmPublishPublishScmMojo.java
@@ -1,5 +1,3 @@
-package org.apache.maven.plugins.scmpublish;
-
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -9,7 +7,7 @@ package org.apache.maven.plugins.scmpublish;
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
@@ -18,6 +16,7 @@ package org.apache.maven.plugins.scmpublish;
* specific language governing permissions and limitations
* under the License.
*/
+package org.apache.maven.plugins.scmpublish;
import java.io.BufferedReader;
import java.io.File;
@@ -53,19 +52,17 @@ import org.codehaus.plexus.util.MatchPatterns;
* <code>${project.build.directory}/staging</code>.
* Can be used without project, so usable to update any SCM with any content.
*/
-@Mojo ( name = "publish-scm", aggregator = true, requiresProject = false )
-public class ScmPublishPublishScmMojo
- extends AbstractScmPublishMojo
-{
+@Mojo(name = "publish-scm", aggregator = true, requiresProject = false)
+public class ScmPublishPublishScmMojo extends AbstractScmPublishMojo {
/**
* The content to be published.
*/
- @Parameter ( property = "scmpublish.content", defaultValue = "${project.build.directory}/staging" )
+ @Parameter(property = "scmpublish.content", defaultValue = "${project.build.directory}/staging")
private File content;
/**
*/
- @Parameter( defaultValue = "${project}", readonly = true, required = true )
+ @Parameter(defaultValue = "${project}", readonly = true, required = true)
protected MavenProject project;
private List<File> deleted = new ArrayList<>();
@@ -87,90 +84,71 @@ public class ScmPublishPublishScmMojo
* used for modules, which content is available only when staging
* @throws IOException
*/
- private void update( File checkout, File dir, List<String> doNotDeleteDirs )
- throws IOException
- {
+ private void update(File checkout, File dir, List<String> doNotDeleteDirs) throws IOException {
String scmSpecificFilename = scmProvider.getScmSpecificFilename();
String[] files = scmSpecificFilename != null
- ? checkout.list( new NotFileFilter( new NameFileFilter( scmSpecificFilename ) ) )
- : checkout.list();
+ ? checkout.list(new NotFileFilter(new NameFileFilter(scmSpecificFilename)))
+ : checkout.list();
- Set<String> checkoutContent = new HashSet<>( Arrays.asList( files ) ) ;
- List<String> dirContent = ( dir != null ) ? Arrays.asList( dir.list() ) : Collections.emptyList();
+ Set<String> checkoutContent = new HashSet<>(Arrays.asList(files));
+ List<String> dirContent = (dir != null) ? Arrays.asList(dir.list()) : Collections.emptyList();
- Set<String> deleted = new HashSet<>( checkoutContent );
- deleted.removeAll( dirContent );
+ Set<String> deleted = new HashSet<>(checkoutContent);
+ deleted.removeAll(dirContent);
MatchPatterns ignoreDeleteMatchPatterns = null;
- List<String> pathsAsList = new ArrayList<>( 0 );
- if ( ignorePathsToDelete != null && ignorePathsToDelete.length > 0 )
- {
- ignoreDeleteMatchPatterns = MatchPatterns.from( ignorePathsToDelete );
- pathsAsList = Arrays.asList( ignorePathsToDelete );
+ List<String> pathsAsList = new ArrayList<>(0);
+ if (ignorePathsToDelete != null && ignorePathsToDelete.length > 0) {
+ ignoreDeleteMatchPatterns = MatchPatterns.from(ignorePathsToDelete);
+ pathsAsList = Arrays.asList(ignorePathsToDelete);
}
- for ( String name : deleted )
- {
- if ( ignoreDeleteMatchPatterns != null && ignoreDeleteMatchPatterns.matches( name, true ) )
- {
- getLog().debug(
- name + " match one of the patterns '" + pathsAsList + "': do not add to deleted files" );
+ for (String name : deleted) {
+ if (ignoreDeleteMatchPatterns != null && ignoreDeleteMatchPatterns.matches(name, true)) {
+ getLog().debug(name + " match one of the patterns '" + pathsAsList + "': do not add to deleted files");
continue;
}
- getLog().debug( "file marked for deletion: " + name );
- File file = new File( checkout, name );
+ getLog().debug("file marked for deletion: " + name);
+ File file = new File(checkout, name);
- if ( ( doNotDeleteDirs != null ) && file.isDirectory() && ( doNotDeleteDirs.contains( name ) ) )
- {
+ if ((doNotDeleteDirs != null) && file.isDirectory() && (doNotDeleteDirs.contains(name))) {
// ignore directory not available
continue;
}
- if ( file.isDirectory() )
- {
- update( file, null, null );
+ if (file.isDirectory()) {
+ update(file, null, null);
}
- this.deleted.add( file );
+ this.deleted.add(file);
}
- for ( String name : dirContent )
- {
- File file = new File( checkout, name );
- File source = new File( dir, name );
+ for (String name : dirContent) {
+ File file = new File(checkout, name);
+ File source = new File(dir, name);
- if ( Files.isSymbolicLink( source.toPath() ) )
- {
- if ( !checkoutContent.contains( name ) )
- {
- this.added.add( file );
+ if (Files.isSymbolicLink(source.toPath())) {
+ if (!checkoutContent.contains(name)) {
+ this.added.add(file);
}
// copy symbolic link (Java 7 only)
- copySymLink( source, file );
- }
- else if ( source.isDirectory() )
- {
+ copySymLink(source, file);
+ } else if (source.isDirectory()) {
directories++;
- if ( !checkoutContent.contains( name ) )
- {
- this.added.add( file );
+ if (!checkoutContent.contains(name)) {
+ this.added.add(file);
file.mkdir();
}
- update( file, source, null );
- }
- else
- {
- if ( checkoutContent.contains( name ) )
- {
- this.updated.add( file );
- }
- else
- {
- this.added.add( file );
+ update(file, source, null);
+ } else {
+ if (checkoutContent.contains(name)) {
+ this.updated.add(file);
+ } else {
+ this.added.add(file);
}
- copyFile( source, file );
+ copyFile(source, file);
}
}
}
@@ -180,13 +158,15 @@ public class ScmPublishPublishScmMojo
*
* @param srcFile the source file (expected to be a symbolic link)
* @param destFile the destination file (which will be a symbolic link)
- * @throws IOException
+ * @throws IOException
*/
- private void copySymLink( File srcFile, File destFile )
- throws IOException
- {
- Files.copy( srcFile.toPath(), destFile.toPath(), StandardCopyOption.REPLACE_EXISTING,
- StandardCopyOption.COPY_ATTRIBUTES, LinkOption.NOFOLLOW_LINKS );
+ private void copySymLink(File srcFile, File destFile) throws IOException {
+ Files.copy(
+ srcFile.toPath(),
+ destFile.toPath(),
+ StandardCopyOption.REPLACE_EXISTING,
+ StandardCopyOption.COPY_ATTRIBUTES,
+ LinkOption.NOFOLLOW_LINKS);
}
/**
@@ -197,16 +177,11 @@ public class ScmPublishPublishScmMojo
* @throws IOException
* @see #requireNormalizeNewlines(File)
*/
- private void copyFile( File srcFile, File destFile )
- throws IOException
- {
- if ( requireNormalizeNewlines( srcFile ) )
- {
- copyAndNormalizeNewlines( srcFile, destFile );
- }
- else
- {
- FileUtils.copyFile( srcFile, destFile );
+ private void copyFile(File srcFile, File destFile) throws IOException {
+ if (requireNormalizeNewlines(srcFile)) {
+ copyAndNormalizeNewlines(srcFile, destFile);
+ } else {
+ FileUtils.copyFile(srcFile, destFile);
}
files++;
size += destFile.length();
@@ -219,27 +194,18 @@ public class ScmPublishPublishScmMojo
* @param destFile the destination file
* @throws IOException
*/
- private void copyAndNormalizeNewlines( File srcFile, File destFile )
- throws IOException
- {
+ private void copyAndNormalizeNewlines(File srcFile, File destFile) throws IOException {
BufferedReader in = null;
PrintWriter out = null;
- try
- {
- in = new BufferedReader( new InputStreamReader( Files.newInputStream( srcFile.toPath() ),
- siteOutputEncoding ) );
- out = new PrintWriter( new OutputStreamWriter( Files.newOutputStream( destFile.toPath() ),
- siteOutputEncoding ) );
-
- for ( String line = in.readLine(); line != null; line = in.readLine() )
- {
- if ( in.ready() )
- {
- out.println( line );
- }
- else
- {
- out.print( line );
+ try {
+ in = new BufferedReader(new InputStreamReader(Files.newInputStream(srcFile.toPath()), siteOutputEncoding));
+ out = new PrintWriter(new OutputStreamWriter(Files.newOutputStream(destFile.toPath()), siteOutputEncoding));
+
+ for (String line = in.readLine(); line != null; line = in.readLine()) {
+ if (in.ready()) {
+ out.println(line);
+ } else {
+ out.print(line);
}
}
@@ -247,105 +213,96 @@ public class ScmPublishPublishScmMojo
out = null;
in.close();
in = null;
- }
- finally
- {
- IOUtils.closeQuietly( out );
- IOUtils.closeQuietly( in );
+ } finally {
+ IOUtils.closeQuietly(out);
+ IOUtils.closeQuietly(in);
}
}
- public void scmPublishExecute()
- throws MojoExecutionException, MojoFailureException
- {
- if ( siteOutputEncoding == null )
- {
- getLog().warn( "No output encoding, defaulting to UTF-8." );
+ public void scmPublishExecute() throws MojoExecutionException, MojoFailureException {
+ if (siteOutputEncoding == null) {
+ getLog().warn("No output encoding, defaulting to UTF-8.");
siteOutputEncoding = "utf-8";
}
- if ( !content.exists() )
- {
- throw new MojoExecutionException( "Configured content directory does not exist: " + content );
+ if (!content.exists()) {
+ throw new MojoExecutionException("Configured content directory does not exist: " + content);
}
- if ( !content.canRead() )
- {
- throw new MojoExecutionException( "Can't read content directory: " + content );
+ if (!content.canRead()) {
+ throw new MojoExecutionException("Can't read content directory: " + content);
}
checkoutExisting();
final File updateDirectory;
- if ( subDirectory == null )
- {
+ if (subDirectory == null) {
updateDirectory = checkoutDirectory;
- }
- else
- {
- updateDirectory = new File( checkoutDirectory, subDirectory );
+ } else {
+ updateDirectory = new File(checkoutDirectory, subDirectory);
// Security check for subDirectory with .. inside
- if ( !updateDirectory.toPath().normalize().startsWith( checkoutDirectory.toPath().normalize() ) )
- {
- logError( "Try to acces outside of the checkout directory with sub-directory: %s", subDirectory );
+ if (!updateDirectory
+ .toPath()
+ .normalize()
+ .startsWith(checkoutDirectory.toPath().normalize())) {
+ logError("Try to acces outside of the checkout directory with sub-directory: %s", subDirectory);
return;
}
- if ( !updateDirectory.exists() )
- {
+ if (!updateDirectory.exists()) {
updateDirectory.mkdirs();
}
- logInfo( "Will copy content in sub-directory: %s", subDirectory );
+ logInfo("Will copy content in sub-directory: %s", subDirectory);
}
- try
- {
- logInfo( "Updating checkout directory with actual content in %s", content );
- update( updateDirectory, content, ( project == null ) ? null : project.getModel().getModules() );
- String displaySize = org.apache.commons.io.FileUtils.byteCountToDisplaySize( size );
- logInfo( "Content consists of " + MessageUtils.buffer().strong( "%d directories and %d files = %s" ),
- directories, files, displaySize );
- }
- catch ( IOException ioe )
- {
- throw new MojoExecutionException( "Could not copy content to SCM checkout", ioe );
+ try {
+ logInfo("Updating checkout directory with actual content in %s", content);
+ update(
+ updateDirectory,
+ content,
+ (project == null) ? null : project.getModel().getModules());
+ String displaySize = org.apache.commons.io.FileUtils.byteCountToDisplaySize(size);
+ logInfo(
+ "Content consists of " + MessageUtils.buffer().strong("%d directories and %d files = %s"),
+ directories,
+ files,
+ displaySize);
+ } catch (IOException ioe) {
+ throw new MojoExecutionException("Could not copy content to SCM checkout", ioe);
}
- logInfo( "Publishing content to SCM will result in "
- + MessageUtils.buffer().strong( "%d addition(s), %d update(s), %d delete(s)" ), added.size(),
- updated.size(), deleted.size() );
+ logInfo(
+ "Publishing content to SCM will result in "
+ + MessageUtils.buffer().strong("%d addition(s), %d update(s), %d delete(s)"),
+ added.size(),
+ updated.size(),
+ deleted.size());
- if ( isDryRun() )
- {
+ if (isDryRun()) {
int pos = checkoutDirectory.getAbsolutePath().length() + 1;
- for ( File addedFile : added )
- {
- logInfo( "- addition %s", addedFile.getAbsolutePath().substring( pos ) );
+ for (File addedFile : added) {
+ logInfo("- addition %s", addedFile.getAbsolutePath().substring(pos));
}
- for ( File updatedFile : updated )
- {
- logInfo( "- update %s", updatedFile.getAbsolutePath().substring( pos ) );
+ for (File updatedFile : updated) {
+ logInfo("- update %s", updatedFile.getAbsolutePath().substring(pos));
}
- for ( File deletedFile : deleted )
- {
- logInfo( "- delete %s", deletedFile.getAbsolutePath().substring( pos ) );
+ for (File deletedFile : deleted) {
+ logInfo("- delete %s", deletedFile.getAbsolutePath().substring(pos));
}
return;
}
- if ( !added.isEmpty() )
- {
- addFiles( added );
+ if (!added.isEmpty()) {
+ addFiles(added);
}
- if ( !deleted.isEmpty() )
- {
- deleteFiles( deleted );
+ if (!deleted.isEmpty()) {
+ deleteFiles(deleted);
}
- logInfo( "Checking in SCM, starting at " + new Date() + "..." );
+ logInfo("Checking in SCM, starting at " + new Date() + "...");
checkinFiles();
}
}