You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by hb...@apache.org on 2012/05/01 18:36:08 UTC

svn commit: r1332745 - in /maven/sandbox/trunk/plugins/maven-site-scm-publish-plugin/src: it/004-publish-scm/ it/004-publish-scm/src/ it/004-publish-scm/src/main/ it/004-publish-scm/src/main/java/ it/004-publish-scm/src/main/java/org/ it/004-publish-sc...

Author: hboutemy
Date: Tue May  1 16:36:07 2012
New Revision: 1332745

URL: http://svn.apache.org/viewvc?rev=1332745&view=rev
Log:
added publish-scm goal

Added:
    maven/sandbox/trunk/plugins/maven-site-scm-publish-plugin/src/it/004-publish-scm/
    maven/sandbox/trunk/plugins/maven-site-scm-publish-plugin/src/it/004-publish-scm/invoker.properties   (with props)
    maven/sandbox/trunk/plugins/maven-site-scm-publish-plugin/src/it/004-publish-scm/pom.xml   (with props)
    maven/sandbox/trunk/plugins/maven-site-scm-publish-plugin/src/it/004-publish-scm/setup.bsh   (with props)
    maven/sandbox/trunk/plugins/maven-site-scm-publish-plugin/src/it/004-publish-scm/src/
    maven/sandbox/trunk/plugins/maven-site-scm-publish-plugin/src/it/004-publish-scm/src/main/
    maven/sandbox/trunk/plugins/maven-site-scm-publish-plugin/src/it/004-publish-scm/src/main/java/
    maven/sandbox/trunk/plugins/maven-site-scm-publish-plugin/src/it/004-publish-scm/src/main/java/org/
    maven/sandbox/trunk/plugins/maven-site-scm-publish-plugin/src/it/004-publish-scm/src/main/java/org/apache/
    maven/sandbox/trunk/plugins/maven-site-scm-publish-plugin/src/it/004-publish-scm/src/main/java/org/apache/maven/
    maven/sandbox/trunk/plugins/maven-site-scm-publish-plugin/src/it/004-publish-scm/src/main/java/org/apache/maven/it/
    maven/sandbox/trunk/plugins/maven-site-scm-publish-plugin/src/it/004-publish-scm/src/main/java/org/apache/maven/it/ThisHasJavadoc.java   (with props)
    maven/sandbox/trunk/plugins/maven-site-scm-publish-plugin/src/it/004-publish-scm/src/site/
    maven/sandbox/trunk/plugins/maven-site-scm-publish-plugin/src/it/004-publish-scm/src/site/apt/
    maven/sandbox/trunk/plugins/maven-site-scm-publish-plugin/src/it/004-publish-scm/src/site/apt/index.apt   (with props)
    maven/sandbox/trunk/plugins/maven-site-scm-publish-plugin/src/it/004-publish-scm/src/site/resources/
    maven/sandbox/trunk/plugins/maven-site-scm-publish-plugin/src/it/004-publish-scm/src/site/resources/trunk/
    maven/sandbox/trunk/plugins/maven-site-scm-publish-plugin/src/it/004-publish-scm/src/site/resources/trunk/readme.txt   (with props)
    maven/sandbox/trunk/plugins/maven-site-scm-publish-plugin/src/it/004-publish-scm/src/site/site.xml   (with props)
    maven/sandbox/trunk/plugins/maven-site-scm-publish-plugin/src/main/java/org/apache/maven/plugins/scmpublish/ScmPublishPublishScmMojo.java   (with props)
Modified:
    maven/sandbox/trunk/plugins/maven-site-scm-publish-plugin/src/main/java/org/apache/maven/plugins/scmpublish/AbstractScmPublishMojo.java
    maven/sandbox/trunk/plugins/maven-site-scm-publish-plugin/src/main/java/org/apache/maven/plugins/scmpublish/ScmPublishInventory.java
    maven/sandbox/trunk/plugins/maven-site-scm-publish-plugin/src/main/java/org/apache/maven/plugins/scmpublish/ScmPublishInventoryMojo.java
    maven/sandbox/trunk/plugins/maven-site-scm-publish-plugin/src/main/java/org/apache/maven/plugins/scmpublish/ScmPublishPublishMojo.java

Added: maven/sandbox/trunk/plugins/maven-site-scm-publish-plugin/src/it/004-publish-scm/invoker.properties
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/plugins/maven-site-scm-publish-plugin/src/it/004-publish-scm/invoker.properties?rev=1332745&view=auto
==============================================================================
--- maven/sandbox/trunk/plugins/maven-site-scm-publish-plugin/src/it/004-publish-scm/invoker.properties (added)
+++ maven/sandbox/trunk/plugins/maven-site-scm-publish-plugin/src/it/004-publish-scm/invoker.properties Tue May  1 16:36:07 2012
@@ -0,0 +1 @@
+invoker.goals = site site:stage site-scm-publish:publish-scm

Propchange: maven/sandbox/trunk/plugins/maven-site-scm-publish-plugin/src/it/004-publish-scm/invoker.properties
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/sandbox/trunk/plugins/maven-site-scm-publish-plugin/src/it/004-publish-scm/invoker.properties
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: maven/sandbox/trunk/plugins/maven-site-scm-publish-plugin/src/it/004-publish-scm/invoker.properties
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: maven/sandbox/trunk/plugins/maven-site-scm-publish-plugin/src/it/004-publish-scm/pom.xml
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/plugins/maven-site-scm-publish-plugin/src/it/004-publish-scm/pom.xml?rev=1332745&view=auto
==============================================================================
--- maven/sandbox/trunk/plugins/maven-site-scm-publish-plugin/src/it/004-publish-scm/pom.xml (added)
+++ maven/sandbox/trunk/plugins/maven-site-scm-publish-plugin/src/it/004-publish-scm/pom.xml Tue May  1 16:36:07 2012
@@ -0,0 +1,77 @@
+<?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
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "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
+
+  Unless required by applicable law or agreed to in writing,
+  software distributed under the License is distributed on an
+  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  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>
+
+  <groupId>org.apache.maven.plugins</groupId>
+  <artifactId>maven-site-scm-publish-plugin-004-publish-scm</artifactId>
+  <version>1.0-SNAPSHOT</version>
+
+  <name>maven-site-scm-publish-plugin-004-publish-scm</name>
+  <url>http://people.apache.org/~bimargulies/site-test</url>
+
+  <distributionManagement>
+    <site>
+      <id>publish-scm-004</id>
+      <url>file:target/dummy</url>
+    </site>
+  </distributionManagement>
+
+  <build>
+    <pluginManagement>
+      <plugins>
+        <plugin>
+          <groupId>org.apache.maven.plugins</groupId>
+          <artifactId>maven-site-plugin</artifactId>
+          <version>3.0</version>
+        </plugin>
+        <plugin>
+          <groupId>org.apache.maven.plugins</groupId>
+          <artifactId>maven-site-scm-publish-plugin</artifactId>
+          <version>@pom.version@</version>
+          <configuration>
+            <pubScmUrl>scm:svn:file://${basedir}/target/svn-root</pubScmUrl>
+          </configuration>
+        </plugin>
+      </plugins>
+    </pluginManagement>
+  </build>
+
+  <reporting>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-project-info-reports-plugin</artifactId>
+        <version>2.4</version>
+        <configuration>
+          <dependencyDetailsEnabled>false</dependencyDetailsEnabled>
+          <dependencyLocationsEnabled>false</dependencyLocationsEnabled>
+        </configuration>
+      </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-javadoc-plugin</artifactId>
+        <version>2.8.1</version>
+        <configuration>
+        </configuration>
+      </plugin>
+      </plugins>
+  </reporting>
+</project>

Propchange: maven/sandbox/trunk/plugins/maven-site-scm-publish-plugin/src/it/004-publish-scm/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/sandbox/trunk/plugins/maven-site-scm-publish-plugin/src/it/004-publish-scm/pom.xml
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: maven/sandbox/trunk/plugins/maven-site-scm-publish-plugin/src/it/004-publish-scm/pom.xml
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: maven/sandbox/trunk/plugins/maven-site-scm-publish-plugin/src/it/004-publish-scm/setup.bsh
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/plugins/maven-site-scm-publish-plugin/src/it/004-publish-scm/setup.bsh?rev=1332745&view=auto
==============================================================================
--- maven/sandbox/trunk/plugins/maven-site-scm-publish-plugin/src/it/004-publish-scm/setup.bsh (added)
+++ maven/sandbox/trunk/plugins/maven-site-scm-publish-plugin/src/it/004-publish-scm/setup.bsh Tue May  1 16:36:07 2012
@@ -0,0 +1,6 @@
+import java.io.*;
+import org.apache.maven.scm.provider.svn.SvnScmTestUtils;
+
+SvnScmTestUtils.initializeRepository( new File( basedir, "target/svn-root" ) );
+
+return true;
\ No newline at end of file

Propchange: maven/sandbox/trunk/plugins/maven-site-scm-publish-plugin/src/it/004-publish-scm/setup.bsh
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/sandbox/trunk/plugins/maven-site-scm-publish-plugin/src/it/004-publish-scm/setup.bsh
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: maven/sandbox/trunk/plugins/maven-site-scm-publish-plugin/src/it/004-publish-scm/src/main/java/org/apache/maven/it/ThisHasJavadoc.java
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/plugins/maven-site-scm-publish-plugin/src/it/004-publish-scm/src/main/java/org/apache/maven/it/ThisHasJavadoc.java?rev=1332745&view=auto
==============================================================================
--- maven/sandbox/trunk/plugins/maven-site-scm-publish-plugin/src/it/004-publish-scm/src/main/java/org/apache/maven/it/ThisHasJavadoc.java (added)
+++ maven/sandbox/trunk/plugins/maven-site-scm-publish-plugin/src/it/004-publish-scm/src/main/java/org/apache/maven/it/ThisHasJavadoc.java Tue May  1 16:36:07 2012
@@ -0,0 +1,34 @@
+package org.apache.maven.it;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "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
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+/**
+ * This is a class with some javadoc.
+ **/
+public class ThisHasJavadoc
+{
+    /**
+     * This is the constructor.
+     */
+    public ThisHasJavadoc()
+    {
+	
+    }
+}
\ No newline at end of file

Propchange: maven/sandbox/trunk/plugins/maven-site-scm-publish-plugin/src/it/004-publish-scm/src/main/java/org/apache/maven/it/ThisHasJavadoc.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/sandbox/trunk/plugins/maven-site-scm-publish-plugin/src/it/004-publish-scm/src/main/java/org/apache/maven/it/ThisHasJavadoc.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: maven/sandbox/trunk/plugins/maven-site-scm-publish-plugin/src/it/004-publish-scm/src/main/java/org/apache/maven/it/ThisHasJavadoc.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: maven/sandbox/trunk/plugins/maven-site-scm-publish-plugin/src/it/004-publish-scm/src/site/apt/index.apt
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/plugins/maven-site-scm-publish-plugin/src/it/004-publish-scm/src/site/apt/index.apt?rev=1332745&view=auto
==============================================================================
--- maven/sandbox/trunk/plugins/maven-site-scm-publish-plugin/src/it/004-publish-scm/src/site/apt/index.apt (added)
+++ maven/sandbox/trunk/plugins/maven-site-scm-publish-plugin/src/it/004-publish-scm/src/site/apt/index.apt Tue May  1 16:36:07 2012
@@ -0,0 +1,3 @@
+Index
+
+    Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean ultrices magna quis arcu venenatis varius. Donec pellentesque fringilla mauris, eget convallis quam gravida nec. Sed sapien urna, dapibus sed fringilla nec, adipiscing vitae dui. Sed at vestibulum diam. Integer mattis, eros in congue imperdiet, enim sapien eleifend mauris, sit amet blandit turpis nibh quis lorem. Donec consectetur hendrerit velit. Nulla luctus, felis eget luctus pharetra, sem lectus dapibus ante, eget sodales lorem felis laoreet tortor. Sed nisi orci, commodo in tempus id, semper sed tellus. Aenean tellus augue, dapibus vitae fermentum commodo, dapibus quis ante. Ut tempus nunc ut erat rutrum sit amet eleifend justo imperdiet. Suspendisse euismod nibh sit amet eros faucibus eget iaculis erat aliquet.
\ No newline at end of file

Propchange: maven/sandbox/trunk/plugins/maven-site-scm-publish-plugin/src/it/004-publish-scm/src/site/apt/index.apt
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/sandbox/trunk/plugins/maven-site-scm-publish-plugin/src/it/004-publish-scm/src/site/apt/index.apt
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: maven/sandbox/trunk/plugins/maven-site-scm-publish-plugin/src/it/004-publish-scm/src/site/resources/trunk/readme.txt
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/plugins/maven-site-scm-publish-plugin/src/it/004-publish-scm/src/site/resources/trunk/readme.txt?rev=1332745&view=auto
==============================================================================
--- maven/sandbox/trunk/plugins/maven-site-scm-publish-plugin/src/it/004-publish-scm/src/site/resources/trunk/readme.txt (added)
+++ maven/sandbox/trunk/plugins/maven-site-scm-publish-plugin/src/it/004-publish-scm/src/site/resources/trunk/readme.txt Tue May  1 16:36:07 2012
@@ -0,0 +1,2 @@
+This file content is not the same as reference svn.
+Will check svn checkin.

Propchange: maven/sandbox/trunk/plugins/maven-site-scm-publish-plugin/src/it/004-publish-scm/src/site/resources/trunk/readme.txt
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/sandbox/trunk/plugins/maven-site-scm-publish-plugin/src/it/004-publish-scm/src/site/resources/trunk/readme.txt
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: maven/sandbox/trunk/plugins/maven-site-scm-publish-plugin/src/it/004-publish-scm/src/site/resources/trunk/readme.txt
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: maven/sandbox/trunk/plugins/maven-site-scm-publish-plugin/src/it/004-publish-scm/src/site/site.xml
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/plugins/maven-site-scm-publish-plugin/src/it/004-publish-scm/src/site/site.xml?rev=1332745&view=auto
==============================================================================
--- maven/sandbox/trunk/plugins/maven-site-scm-publish-plugin/src/it/004-publish-scm/src/site/site.xml (added)
+++ maven/sandbox/trunk/plugins/maven-site-scm-publish-plugin/src/it/004-publish-scm/src/site/site.xml Tue May  1 16:36:07 2012
@@ -0,0 +1,34 @@
+<?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
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"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
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+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/DECORATION/1.0.0"
+  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://maven.apache.org/DECORATION/1.0.0 http://maven.apache.org/xsd/decoration-1.0.0.xsd"
+  name="perform-002">
+  <publishDate position="right"/>
+  <version position="left"/>
+    <body>
+      <menu name="perform-002">
+        <item name="Home" href="index.html" />
+        <item name="Javadoc" href="/apidocs/index.html" />
+      </menu>
+      <menu ref="reports"/>
+  </body>
+</project>

Propchange: maven/sandbox/trunk/plugins/maven-site-scm-publish-plugin/src/it/004-publish-scm/src/site/site.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/sandbox/trunk/plugins/maven-site-scm-publish-plugin/src/it/004-publish-scm/src/site/site.xml
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: maven/sandbox/trunk/plugins/maven-site-scm-publish-plugin/src/it/004-publish-scm/src/site/site.xml
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: maven/sandbox/trunk/plugins/maven-site-scm-publish-plugin/src/main/java/org/apache/maven/plugins/scmpublish/AbstractScmPublishMojo.java
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/plugins/maven-site-scm-publish-plugin/src/main/java/org/apache/maven/plugins/scmpublish/AbstractScmPublishMojo.java?rev=1332745&r1=1332744&r2=1332745&view=diff
==============================================================================
--- maven/sandbox/trunk/plugins/maven-site-scm-publish-plugin/src/main/java/org/apache/maven/plugins/scmpublish/AbstractScmPublishMojo.java (original)
+++ maven/sandbox/trunk/plugins/maven-site-scm-publish-plugin/src/main/java/org/apache/maven/plugins/scmpublish/AbstractScmPublishMojo.java Tue May  1 16:36:07 2012
@@ -20,14 +20,19 @@ package org.apache.maven.plugins.scmpubl
  */
 
 import java.io.File;
+import java.io.IOException;
 import java.util.List;
 import java.util.Map;
 
+import org.apache.commons.io.FileUtils;
 import org.apache.maven.execution.MavenSession;
 import org.apache.maven.plugin.AbstractMojo;
 import org.apache.maven.plugin.MojoExecutionException;
 import org.apache.maven.plugin.MojoFailureException;
 import org.apache.maven.project.MavenProject;
+import org.apache.maven.scm.ScmException;
+import org.apache.maven.scm.ScmFileSet;
+import org.apache.maven.scm.command.checkout.CheckOutScmResult;
 import org.apache.maven.scm.manager.NoSuchScmProviderException;
 import org.apache.maven.scm.manager.ScmManager;
 import org.apache.maven.scm.provider.ScmProvider;
@@ -36,6 +41,8 @@ import org.apache.maven.scm.repository.S
 import org.apache.maven.settings.Settings;
 import org.apache.maven.shared.release.config.ReleaseDescriptor;
 import org.apache.maven.shared.release.scm.ScmRepositoryConfigurator;
+import org.apache.maven.shared.release.util.ReleaseUtil;
+import org.codehaus.plexus.util.StringUtils;
 
 /**
  * Base class for the site-scm-publish mojos.
@@ -235,6 +242,89 @@ public abstract class AbstractScmPublish
         return releaseDescriptor;
     }
 
+    protected void checkoutExisting()
+        throws MojoExecutionException
+    {
+        logInfo( "Checking out the pub tree ..." );
+
+        MavenProject rootProject = ReleaseUtil.getRootProject( reactorProjects );
+        if ( checkoutDirectory.exists() )
+        {
+            try
+            {
+                FileUtils.deleteDirectory( checkoutDirectory );
+            }
+            catch ( IOException e )
+            {
+                logError( e.getMessage() );
+
+                throw new MojoExecutionException( "Unable to remove old checkout directory: " + e.getMessage(), e );
+            }
+        }
+
+        checkoutDirectory.mkdirs();
+
+        CheckOutScmResult scmResult;
+
+        try
+        {
+            ScmFileSet fileSet = new ScmFileSet( checkoutDirectory, includes, excludes );
+            scmResult = scmProvider.checkOut( scmRepository, fileSet );
+        }
+        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() );
+
+            throw new MojoExecutionException( "An error is occurred in the checkout process: " + e.getMessage(), e );
+        }
+
+        String scmRelativePathProjectDirectory = scmResult.getRelativePathProjectDirectory();
+        if ( StringUtils.isEmpty( scmRelativePathProjectDirectory ) )
+        {
+            String basedir;
+            try
+            {
+                basedir = ReleaseUtil.getCommonBasedir( reactorProjects );
+            }
+            catch ( IOException e )
+            {
+                throw new MojoExecutionException( "Exception occurred while calculating common basedir: "
+                    + e.getMessage(), e );
+            }
+
+            String rootProjectBasedir = rootProject.getBasedir().getAbsolutePath();
+            try
+            {
+                if ( ReleaseUtil.isSymlink( rootProject.getBasedir() ) )
+                {
+                    rootProjectBasedir = rootProject.getBasedir().getCanonicalPath();
+                }
+            }
+            catch ( IOException e )
+            {
+                throw new MojoExecutionException( e.getMessage(), e );
+            }
+            if ( rootProjectBasedir.length() > basedir.length() )
+            {
+                scmRelativePathProjectDirectory = rootProjectBasedir.substring( basedir.length() + 1 );
+            }
+        }
+
+        if ( !scmResult.isSuccess() )
+        {
+            logError( scmResult.getProviderMessage() );
+
+            throw new MojoExecutionException( "Unable to checkout from SCM" + "\nProvider message:\n"
+                + scmResult.getProviderMessage() + "\nCommand output:\n" + scmResult.getCommandOutput() );
+        }
+    }
+
     public void execute()
         throws MojoExecutionException, MojoFailureException
     {

Modified: maven/sandbox/trunk/plugins/maven-site-scm-publish-plugin/src/main/java/org/apache/maven/plugins/scmpublish/ScmPublishInventory.java
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/plugins/maven-site-scm-publish-plugin/src/main/java/org/apache/maven/plugins/scmpublish/ScmPublishInventory.java?rev=1332745&r1=1332744&r2=1332745&view=diff
==============================================================================
--- maven/sandbox/trunk/plugins/maven-site-scm-publish-plugin/src/main/java/org/apache/maven/plugins/scmpublish/ScmPublishInventory.java (original)
+++ maven/sandbox/trunk/plugins/maven-site-scm-publish-plugin/src/main/java/org/apache/maven/plugins/scmpublish/ScmPublishInventory.java Tue May  1 16:36:07 2012
@@ -22,6 +22,7 @@ package org.apache.maven.plugins.scmpubl
 import java.io.File;
 import java.io.IOException;
 import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.Collections;
 import java.util.HashSet;
 import java.util.List;
@@ -58,6 +59,11 @@ public class ScmPublishInventory
 
     }
 
+    public static List<String> listInventory( File basedir )
+    {
+        return Arrays.asList( basedir.list( new DotFilter() ) );
+    }
+
     public static List<File> listInventoryFiles( File basedir )
     {
         List<File> inventory = new ArrayList<File>();

Modified: maven/sandbox/trunk/plugins/maven-site-scm-publish-plugin/src/main/java/org/apache/maven/plugins/scmpublish/ScmPublishInventoryMojo.java
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/plugins/maven-site-scm-publish-plugin/src/main/java/org/apache/maven/plugins/scmpublish/ScmPublishInventoryMojo.java?rev=1332745&r1=1332744&r2=1332745&view=diff
==============================================================================
--- maven/sandbox/trunk/plugins/maven-site-scm-publish-plugin/src/main/java/org/apache/maven/plugins/scmpublish/ScmPublishInventoryMojo.java (original)
+++ maven/sandbox/trunk/plugins/maven-site-scm-publish-plugin/src/main/java/org/apache/maven/plugins/scmpublish/ScmPublishInventoryMojo.java Tue May  1 16:36:07 2012
@@ -20,18 +20,11 @@ package org.apache.maven.plugins.scmpubl
  */
 
 import java.io.File;
-import java.io.IOException;
 import java.util.List;
 
 import org.apache.commons.io.FileUtils;
 import org.apache.maven.plugin.MojoExecutionException;
 import org.apache.maven.plugin.MojoFailureException;
-import org.apache.maven.project.MavenProject;
-import org.apache.maven.scm.ScmException;
-import org.apache.maven.scm.ScmFileSet;
-import org.apache.maven.scm.command.checkout.CheckOutScmResult;
-import org.apache.maven.shared.release.util.ReleaseUtil;
-import org.codehaus.plexus.util.StringUtils;
 
 /**
  * Prepare a directory for version-managed site generation. This checks out the specified directory from the SCM,
@@ -57,89 +50,6 @@ import org.codehaus.plexus.util.StringUt
 public class ScmPublishInventoryMojo
     extends AbstractScmPublishMojo
 {
-    private void checkoutExisting()
-        throws MojoExecutionException
-    {
-        logInfo( "Checking out the pub tree ..." );
-
-        MavenProject rootProject = ReleaseUtil.getRootProject( reactorProjects );
-        if ( checkoutDirectory.exists() )
-        {
-            try
-            {
-                FileUtils.deleteDirectory( checkoutDirectory );
-            }
-            catch ( IOException e )
-            {
-                logError( e.getMessage() );
-
-                throw new MojoExecutionException( "Unable to remove old checkout directory: " + e.getMessage(), e );
-            }
-        }
-
-        checkoutDirectory.mkdirs();
-
-        CheckOutScmResult scmResult;
-
-        try
-        {
-            ScmFileSet fileSet = new ScmFileSet( checkoutDirectory, includes, excludes );
-            scmResult = scmProvider.checkOut( scmRepository, fileSet );
-        }
-        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() );
-
-            throw new MojoExecutionException( "An error is occurred in the checkout process: " + e.getMessage(), e );
-        }
-
-        String scmRelativePathProjectDirectory = scmResult.getRelativePathProjectDirectory();
-        if ( StringUtils.isEmpty( scmRelativePathProjectDirectory ) )
-        {
-            String basedir;
-            try
-            {
-                basedir = ReleaseUtil.getCommonBasedir( reactorProjects );
-            }
-            catch ( IOException e )
-            {
-                throw new MojoExecutionException( "Exception occurred while calculating common basedir: "
-                    + e.getMessage(), e );
-            }
-
-            String rootProjectBasedir = rootProject.getBasedir().getAbsolutePath();
-            try
-            {
-                if ( ReleaseUtil.isSymlink( rootProject.getBasedir() ) )
-                {
-                    rootProjectBasedir = rootProject.getBasedir().getCanonicalPath();
-                }
-            }
-            catch ( IOException e )
-            {
-                throw new MojoExecutionException( e.getMessage(), e );
-            }
-            if ( rootProjectBasedir.length() > basedir.length() )
-            {
-                scmRelativePathProjectDirectory = rootProjectBasedir.substring( basedir.length() + 1 );
-            }
-        }
-
-        if ( !scmResult.isSuccess() )
-        {
-            logError( scmResult.getProviderMessage() );
-
-            throw new MojoExecutionException( "Unable to checkout from SCM" + "\nProvider message:\n"
-                + scmResult.getProviderMessage() + "\nCommand output:\n" + scmResult.getCommandOutput() );
-        }
-    }
-
     /**
      * Clear out the data, so we can tell what's left after the run of the site plugin.
      * For now, don't bother with deleting empty directories. They are fairly harmless,

Modified: maven/sandbox/trunk/plugins/maven-site-scm-publish-plugin/src/main/java/org/apache/maven/plugins/scmpublish/ScmPublishPublishMojo.java
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/plugins/maven-site-scm-publish-plugin/src/main/java/org/apache/maven/plugins/scmpublish/ScmPublishPublishMojo.java?rev=1332745&r1=1332744&r2=1332745&view=diff
==============================================================================
--- maven/sandbox/trunk/plugins/maven-site-scm-publish-plugin/src/main/java/org/apache/maven/plugins/scmpublish/ScmPublishPublishMojo.java (original)
+++ maven/sandbox/trunk/plugins/maven-site-scm-publish-plugin/src/main/java/org/apache/maven/plugins/scmpublish/ScmPublishPublishMojo.java Tue May  1 16:36:07 2012
@@ -86,7 +86,7 @@ public class ScmPublishPublishMojo
         return new File( base.toURI().relativize( file.toURI() ).getPath() );
     }
 
-    private boolean requireNormalizeNewlines( File f )
+    protected boolean requireNormalizeNewlines( File f )
         throws IOException
     {
         return FilenameUtils.isExtension( f.getName(), NORMALIZE_EXTENSIONS );
@@ -171,7 +171,7 @@ public class ScmPublishPublishMojo
         logInfo( "Publish files: %d addition(s), %d update(s), %d delete(s)", added.size(), updated.size(),
                  deleted.size() );
 
-        if ( dryRun )
+        if ( isDryRun() )
         {
             for ( File addedFile : added )
             {
@@ -202,15 +202,17 @@ public class ScmPublishPublishMojo
 
         normalizeNewLines( updated );
 
-        if ( !skipCheckin )
-        {
-            checkinFiles();
-        }
+        checkinFiles();
     }
 
-    private void checkinFiles()
+    protected void checkinFiles()
         throws MojoExecutionException
     {
+        if ( skipCheckin )
+        {
+            return;
+        }
+
         if ( checkinComment == null )
         {
             checkinComment = "Site checkin for project " + project.getName();
@@ -233,7 +235,7 @@ public class ScmPublishPublishMojo
         }
     }
 
-    private void deleteFiles( Set<File> deleted )
+    protected void deleteFiles( Collection<File> deleted )
         throws MojoExecutionException
     {
         List<File> deletedList = new ArrayList<File>();
@@ -260,7 +262,7 @@ public class ScmPublishPublishMojo
         }
     }
 
-    private void addFiles( Set<File> added )
+    protected void addFiles( Collection<File> added )
         throws MojoFailureException, MojoExecutionException
     {
         List<File> addedList = new ArrayList<File>();
@@ -321,4 +323,9 @@ public class ScmPublishPublishMojo
             throw new MojoExecutionException( "Failed to add new files to SCM", e );
         }
     }
+
+    public boolean isDryRun()
+    {
+        return dryRun;
+    }
 }

Added: maven/sandbox/trunk/plugins/maven-site-scm-publish-plugin/src/main/java/org/apache/maven/plugins/scmpublish/ScmPublishPublishScmMojo.java
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/plugins/maven-site-scm-publish-plugin/src/main/java/org/apache/maven/plugins/scmpublish/ScmPublishPublishScmMojo.java?rev=1332745&view=auto
==============================================================================
--- maven/sandbox/trunk/plugins/maven-site-scm-publish-plugin/src/main/java/org/apache/maven/plugins/scmpublish/ScmPublishPublishScmMojo.java (added)
+++ maven/sandbox/trunk/plugins/maven-site-scm-publish-plugin/src/main/java/org/apache/maven/plugins/scmpublish/ScmPublishPublishScmMojo.java Tue May  1 16:36:07 2012
@@ -0,0 +1,207 @@
+package org.apache.maven.plugins.scmpublish;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.io.OutputStreamWriter;
+import java.io.PrintWriter;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import org.apache.commons.io.FileUtils;
+import org.apache.commons.io.IOUtils;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugin.MojoFailureException;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "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
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+/**
+ * Publish a content to scm in one step. By default, site staging content is published.
+ * Could be extended to work without project, so usable to update any SCM with any content.
+ * 
+ * @goal publish-scm
+ * @aggregate
+ */
+public class ScmPublishPublishScmMojo
+    extends ScmPublishPublishMojo
+{
+    /**
+     * The content to be published.
+     * 
+     * @parameter expression="${scmpublish.content}" default-value="${project.build.directory}/staging"
+     */
+    private File content;
+
+    private List<File> deleted = new ArrayList<File>();
+    private List<File> added = new ArrayList<File>();
+    private List<File> updated = new ArrayList<File>();
+
+    private void update( File checkout, File dir )
+        throws IOException
+    {
+        Set<String> checkoutContent = new HashSet<String>( ScmPublishInventory.listInventory( checkout ) );
+        List<String> dirContent = ( dir != null ) ? Arrays.asList( dir.list() ) : Collections.<String>emptyList();
+
+        Set<String> deleted = new HashSet<String>( checkoutContent );
+        deleted.removeAll( dirContent );
+
+        for ( String name : deleted )
+        {
+            File file = new File( checkout, name );
+            if ( file.isDirectory() )
+            {
+                update( file, null );
+            }
+            this.deleted.add( file );
+        }
+
+        for ( String name : dirContent )
+        {
+            File file = new File( checkout, name );
+            File source = new File( dir, name );
+
+            if ( source.isDirectory() )
+            {
+                if ( !checkoutContent.contains( name ) )
+                {
+                    this.added.add( file );
+                    file.mkdir();
+                }
+
+                update( file, source );
+            }
+            else
+            {
+                if ( checkoutContent.contains( name ) )
+                {
+                    this.updated.add( file );
+                }
+                else
+                {
+                    this.added.add( file );
+                }
+
+                copyFile( source, file ); 
+            }
+        }
+    }
+
+    private void copyFile( File srcFile, File destFile )
+        throws IOException
+    {
+        if ( requireNormalizeNewlines( srcFile ) )
+        {
+            normalizeNewlines( srcFile, destFile );
+        }
+        else
+        {
+            FileUtils.copyFile( srcFile, destFile );
+        }
+    }
+
+    private void normalizeNewlines( File srcFile, File destFile )
+        throws IOException
+    {
+        BufferedReader in = null;
+        PrintWriter out = null;
+        try
+        {
+            in = new BufferedReader( new InputStreamReader( new FileInputStream( srcFile ), siteOutputEncoding ) );
+            out = new PrintWriter( new OutputStreamWriter( new FileOutputStream( destFile ), siteOutputEncoding ) );
+            String line;
+            while ( ( line = in.readLine() ) != null )
+            {
+                if ( in.ready() )
+                {
+                    out.println( line );
+                }
+                else
+                {
+                    out.print( line );
+                }
+            }
+        }
+        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." );
+            siteOutputEncoding = "utf-8";
+        }
+
+        checkoutExisting();
+
+        try
+        {
+            update( checkoutDirectory, content );
+        }
+        catch ( IOException ioe )
+        {
+            throw new MojoExecutionException( "could not copy content to scm checkout", ioe );
+        }
+
+        logInfo( "Publish files: %d addition(s), %d update(s), %d delete(s)", added.size(), updated.size(),
+                 deleted.size() );
+
+        if ( isDryRun() )
+        {
+            for ( File addedFile : added )
+            {
+                logInfo( "Added %s", addedFile.getAbsolutePath() );
+            }
+            for ( File deletedFile : deleted )
+            {
+                logInfo( "Deleted %s", deletedFile.getAbsolutePath() );
+            }
+            for ( File updatedFile : updated )
+            {
+                logInfo( "Updated %s", updatedFile.getAbsolutePath() );
+            }
+            return;
+        }
+
+        if ( !added.isEmpty() )
+        {
+            addFiles( added );
+        }
+
+        if ( !deleted.isEmpty() )
+        {
+            deleteFiles( deleted );
+        }
+
+        checkinFiles();
+    }
+}

Propchange: maven/sandbox/trunk/plugins/maven-site-scm-publish-plugin/src/main/java/org/apache/maven/plugins/scmpublish/ScmPublishPublishScmMojo.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/sandbox/trunk/plugins/maven-site-scm-publish-plugin/src/main/java/org/apache/maven/plugins/scmpublish/ScmPublishPublishScmMojo.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: maven/sandbox/trunk/plugins/maven-site-scm-publish-plugin/src/main/java/org/apache/maven/plugins/scmpublish/ScmPublishPublishScmMojo.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain