Author: ate Date: Mon Dec 21 12:27:34 2009 New Revision: 892796 URL: http://svn.apache.org/viewvc?rev=892796&view=rev Log: Making the jetspeed fileutils maven plugin SVN aware so it won't copy .svn meta information from our source tree
Modified: portals/jetspeed-2/portal/trunk/maven/jetspeed-fileutils-maven-plugin/pom.xml portals/jetspeed-2/portal/trunk/maven/jetspeed-fileutils-maven-plugin/src/main/java/org/apache/jetspeed/maven/fileutils/FileUtilsMojo.java Modified: portals/jetspeed-2/portal/trunk/maven/jetspeed-fileutils-maven-plugin/pom.xml URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/maven/jetspeed-fileutils-maven-plugin/pom.xml?rev=892796&r1=892795&r2=892796&view=diff ============================================================================== --- portals/jetspeed-2/portal/trunk/maven/jetspeed-fileutils-maven-plugin/pom.xml (original) +++ portals/jetspeed-2/portal/trunk/maven/jetspeed-fileutils-maven-plugin/pom.xml Mon Dec 21 12:27:34 2009 @@ -50,6 +50,11 @@ <version>2.0.7</version> <scope>provided</scope> </dependency> + <dependency> + <groupId>commons-io</groupId> + <artifactId>commons-io</artifactId> + <version>${commons-io.version}</version> + </dependency> </dependencies> <build> <plugins> Modified: portals/jetspeed-2/portal/trunk/maven/jetspeed-fileutils-maven-plugin/src/main/java/org/apache/jetspeed/maven/fileutils/FileUtilsMojo.java URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/maven/jetspeed-fileutils-maven-plugin/src/main/java/org/apache/jetspeed/maven/fileutils/FileUtilsMojo.java?rev=892796&r1=892795&r2=892796&view=diff ============================================================================== --- portals/jetspeed-2/portal/trunk/maven/jetspeed-fileutils-maven-plugin/src/main/java/org/apache/jetspeed/maven/fileutils/FileUtilsMojo.java (original) +++ portals/jetspeed-2/portal/trunk/maven/jetspeed-fileutils-maven-plugin/src/main/java/org/apache/jetspeed/maven/fileutils/FileUtilsMojo.java Mon Dec 21 12:27:34 2009 @@ -17,7 +17,11 @@ package org.apache.jetspeed.maven.fileutils; -import org.apache.jetspeed.maven.utils.FileSystemUtils; +import java.io.File; +import java.io.IOException; + +import org.apache.commons.io.FileUtils; +import org.apache.commons.io.filefilter.FileFilterUtils; import org.apache.maven.plugin.AbstractMojo; import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.plugin.MojoFailureException; @@ -48,21 +52,56 @@ * @required */ private String event; - + public void execute() throws MojoExecutionException, MojoFailureException { if (event.equals("copy")) { - FileSystemUtils.copy(srcDirectoryPath, destDirectoryPath); + copy(srcDirectoryPath, destDirectoryPath); } if (event.equals("move")) { - FileSystemUtils.copy(srcDirectoryPath, destDirectoryPath); - FileSystemUtils.delete(srcDirectoryPath); + move(srcDirectoryPath, destDirectoryPath); } else if (event.equals("delete")) { - FileSystemUtils.delete(srcDirectoryPath); + delete(srcDirectoryPath); + } + } + + private static void delete(String srcDirectoryPath) throws MojoExecutionException + { + try + { + FileUtils.deleteDirectory(new File(srcDirectoryPath)); + } + catch (IOException IOex) + { + throw new MojoExecutionException("Error in deleting the directory", IOex); + } + } + + private static void copy(String srcDirectoryPath, String destDir) throws MojoExecutionException + { + try + { + FileUtils.copyDirectory(new File(srcDirectoryPath), new File(destDir), FileFilterUtils.makeSVNAware(null)); + } + catch (IOException IOex) + { + throw new MojoExecutionException("Error in copying the directory", IOex); + } + } + + private static void move(String srcDirectoryPath, String destDir) throws MojoExecutionException + { + try + { + FileUtils.moveDirectory(new File(srcDirectoryPath), new File(destDir)); + } + catch (IOException IOex) + { + throw new MojoExecutionException("Error in moving the directory", IOex); } } } --------------------------------------------------------------------- To unsubscribe, e-mail: jetspeed-dev-unsubscr...@portals.apache.org For additional commands, e-mail: jetspeed-dev-h...@portals.apache.org