You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by ol...@apache.org on 2012/09/04 13:22:21 UTC
svn commit: r1380556 -
/maven/plugins/trunk/maven-scm-publish-plugin/src/main/java/org/apache/maven/plugins/scmpublish/AbstractScmPublishMojo.java
Author: olamy
Date: Tue Sep 4 11:22:21 2012
New Revision: 1380556
URL: http://svn.apache.org/viewvc?rev=1380556&view=rev
Log:
fix warning for automaticRemotePathCreation
Modified:
maven/plugins/trunk/maven-scm-publish-plugin/src/main/java/org/apache/maven/plugins/scmpublish/AbstractScmPublishMojo.java
Modified: maven/plugins/trunk/maven-scm-publish-plugin/src/main/java/org/apache/maven/plugins/scmpublish/AbstractScmPublishMojo.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-scm-publish-plugin/src/main/java/org/apache/maven/plugins/scmpublish/AbstractScmPublishMojo.java?rev=1380556&r1=1380555&r2=1380556&view=diff
==============================================================================
--- maven/plugins/trunk/maven-scm-publish-plugin/src/main/java/org/apache/maven/plugins/scmpublish/AbstractScmPublishMojo.java (original)
+++ maven/plugins/trunk/maven-scm-publish-plugin/src/main/java/org/apache/maven/plugins/scmpublish/AbstractScmPublishMojo.java Tue Sep 4 11:22:21 2012
@@ -262,33 +262,39 @@ public abstract class AbstractScmPublish
String remoteUrl = ( (SvnScmProviderRepository) scmRepository.getProviderRepository() ).getUrl();
boolean remoteExists = svnScmProvider.remoteUrlExist( scmRepository.getProviderRepository(), null );
- if ( !remoteExists && automaticRemotePatCreation )
+ if ( !remoteExists )
{
- logInfo( "remote url %s not exists so create it", remoteUrl );
- // create a temporary directory for svnexec
- baseDir = File.createTempFile( "scm", "tmp" );
- baseDir.delete();
- baseDir.mkdirs();
- // 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 path creation: " + remoteUrl );
- svnScmProvider.mkdir( scmRepository.getProviderRepository(), scmFileSet, commandParameters );
+ if ( automaticRemotePatCreation )
+ {
+ logInfo( "remote url %s not exists so create it", remoteUrl );
- // new remote url so force checkout !
- if ( checkoutDirectory.exists() )
+ // create a temporary directory for svnexec
+ baseDir = File.createTempFile( "scm", "tmp" );
+ baseDir.delete();
+ baseDir.mkdirs();
+ // 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 path creation: " + remoteUrl );
+ svnScmProvider.mkdir( scmRepository.getProviderRepository(), scmFileSet, commandParameters );
+
+ // new remote url so force checkout !
+ if ( checkoutDirectory.exists() )
+ {
+ FileUtils.deleteDirectory( checkoutDirectory );
+ }
+ }
+ else
{
- FileUtils.deleteDirectory( checkoutDirectory );
+ //olamy: return ?? that will fail during checkout IMHO :-)
+ logInfo( "remote url %s not exists and not create it as field %s configured to false",
+ remoteUrl, Boolean.toString( automaticRemotePatCreation ) );
}
}
- else
- {
- //olamy: return ?? that will fail during checkout IMHO :-)
- logInfo( "remote url %s not exists and not create it as field %s configured to false", remoteUrl,
- Boolean.toString( automaticRemotePatCreation ) );
- }
}
catch ( IOException e )
{
@@ -298,7 +304,9 @@ public abstract class AbstractScmPublish
{
throw new MojoExecutionException( e.getMessage(), e );
}
+
finally
+
{
if ( baseDir != null )
{
@@ -317,6 +325,7 @@ public abstract class AbstractScmPublish
logInfo( "%s the pub tree from %s ...", ( tryUpdate ? "Updating" : "Checking out" ), pubScmUrl );
if ( checkoutDirectory.exists() && !tryUpdate )
+
{
try
{
@@ -333,6 +342,7 @@ public abstract class AbstractScmPublish
boolean forceCheckout = false;
if ( !checkoutDirectory.exists() )
+
{
if ( tryUpdate )
{
@@ -345,6 +355,7 @@ public abstract class AbstractScmPublish
ScmResult scmResult;
try
+
{
ScmFileSet fileSet = new ScmFileSet( checkoutDirectory, includes, excludes );
if ( tryUpdate && !forceCheckout )
@@ -365,12 +376,14 @@ public abstract class AbstractScmPublish
}
}
}
+
catch ( ScmException e )
{
logError( e.getMessage() );
throw new MojoExecutionException( "An error is occurred in the checkout process: " + e.getMessage(), e );
}
+
catch ( IOException e )
{
logError( e.getMessage() );
@@ -379,6 +392,7 @@ public abstract class AbstractScmPublish
}
if ( !scmResult.isSuccess() )
+
{
logError( scmResult.getProviderMessage() );
@@ -386,6 +400,7 @@ public abstract class AbstractScmPublish
"Unable to checkout from SCM" + "\nProvider message:\n" + scmResult.getProviderMessage()
+ "\nCommand output:\n" + scmResult.getCommandOutput() );
}
+
}
public void execute()
@@ -435,7 +450,6 @@ public abstract class AbstractScmPublish
}
}
-
public abstract void scmPublishExecute()
throws MojoExecutionException, MojoFailureException;
}
\ No newline at end of file