You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by be...@apache.org on 2008/09/06 21:41:57 UTC
svn commit: r692713 - in /maven/plugins/trunk/maven-clean-plugin/src:
it/exclude-default-dirs/ it/exclude-default-dirs/delete-me/
it/exclude-default-dirs/target/ it/exclude-default-dirs/target/classes/
it/exclude-default-dirs/target/site/ it/exclude-de...
Author: bentmann
Date: Sat Sep 6 12:41:56 2008
New Revision: 692713
URL: http://svn.apache.org/viewvc?rev=692713&view=rev
Log:
[MCLEAN-33] Cannot Supress Default clean while still cleaning
Added:
maven/plugins/trunk/maven-clean-plugin/src/it/exclude-default-dirs/
maven/plugins/trunk/maven-clean-plugin/src/it/exclude-default-dirs/delete-me/
maven/plugins/trunk/maven-clean-plugin/src/it/exclude-default-dirs/pom.xml (with props)
maven/plugins/trunk/maven-clean-plugin/src/it/exclude-default-dirs/target/
maven/plugins/trunk/maven-clean-plugin/src/it/exclude-default-dirs/target/classes/
maven/plugins/trunk/maven-clean-plugin/src/it/exclude-default-dirs/target/classes/main.properties (with props)
maven/plugins/trunk/maven-clean-plugin/src/it/exclude-default-dirs/target/site/
maven/plugins/trunk/maven-clean-plugin/src/it/exclude-default-dirs/target/site/index.html (with props)
maven/plugins/trunk/maven-clean-plugin/src/it/exclude-default-dirs/target/test-1.0-SNAPSHOT.jar (with props)
maven/plugins/trunk/maven-clean-plugin/src/it/exclude-default-dirs/target/test-classes/
maven/plugins/trunk/maven-clean-plugin/src/it/exclude-default-dirs/target/test-classes/test.properties (with props)
maven/plugins/trunk/maven-clean-plugin/src/it/exclude-default-dirs/verify.bsh (with props)
Modified:
maven/plugins/trunk/maven-clean-plugin/src/main/java/org/apache/maven/plugin/clean/CleanMojo.java
Added: maven/plugins/trunk/maven-clean-plugin/src/it/exclude-default-dirs/pom.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-clean-plugin/src/it/exclude-default-dirs/pom.xml?rev=692713&view=auto
==============================================================================
--- maven/plugins/trunk/maven-clean-plugin/src/it/exclude-default-dirs/pom.xml (added)
+++ maven/plugins/trunk/maven-clean-plugin/src/it/exclude-default-dirs/pom.xml Sat Sep 6 12:41:56 2008
@@ -0,0 +1,55 @@
+<?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/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <groupId>test</groupId>
+ <artifactId>exclude-default-dirs</artifactId>
+ <version>1.0-SNAPSHOT</version>
+
+ <description>Check for exclusion of default directories from cleaning if requested.</description>
+
+ <properties>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ </properties>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-clean-plugin</artifactId>
+ <version>@pom.version@</version>
+ <configuration>
+ <excludeDefaultDirectories>true</excludeDefaultDirectories>
+ <filesets>
+ <fileset>
+ <directory>delete-me</directory>
+ </fileset>
+ </filesets>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
Propchange: maven/plugins/trunk/maven-clean-plugin/src/it/exclude-default-dirs/pom.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/plugins/trunk/maven-clean-plugin/src/it/exclude-default-dirs/pom.xml
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Added: maven/plugins/trunk/maven-clean-plugin/src/it/exclude-default-dirs/target/classes/main.properties
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-clean-plugin/src/it/exclude-default-dirs/target/classes/main.properties?rev=692713&view=auto
==============================================================================
(empty)
Propchange: maven/plugins/trunk/maven-clean-plugin/src/it/exclude-default-dirs/target/classes/main.properties
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/plugins/trunk/maven-clean-plugin/src/it/exclude-default-dirs/target/classes/main.properties
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Added: maven/plugins/trunk/maven-clean-plugin/src/it/exclude-default-dirs/target/site/index.html
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-clean-plugin/src/it/exclude-default-dirs/target/site/index.html?rev=692713&view=auto
==============================================================================
(empty)
Propchange: maven/plugins/trunk/maven-clean-plugin/src/it/exclude-default-dirs/target/site/index.html
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/plugins/trunk/maven-clean-plugin/src/it/exclude-default-dirs/target/site/index.html
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Added: maven/plugins/trunk/maven-clean-plugin/src/it/exclude-default-dirs/target/test-1.0-SNAPSHOT.jar
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-clean-plugin/src/it/exclude-default-dirs/target/test-1.0-SNAPSHOT.jar?rev=692713&view=auto
==============================================================================
Binary file - no diff available.
Propchange: maven/plugins/trunk/maven-clean-plugin/src/it/exclude-default-dirs/target/test-1.0-SNAPSHOT.jar
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: maven/plugins/trunk/maven-clean-plugin/src/it/exclude-default-dirs/target/test-classes/test.properties
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-clean-plugin/src/it/exclude-default-dirs/target/test-classes/test.properties?rev=692713&view=auto
==============================================================================
(empty)
Propchange: maven/plugins/trunk/maven-clean-plugin/src/it/exclude-default-dirs/target/test-classes/test.properties
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/plugins/trunk/maven-clean-plugin/src/it/exclude-default-dirs/target/test-classes/test.properties
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Added: maven/plugins/trunk/maven-clean-plugin/src/it/exclude-default-dirs/verify.bsh
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-clean-plugin/src/it/exclude-default-dirs/verify.bsh?rev=692713&view=auto
==============================================================================
--- maven/plugins/trunk/maven-clean-plugin/src/it/exclude-default-dirs/verify.bsh (added)
+++ maven/plugins/trunk/maven-clean-plugin/src/it/exclude-default-dirs/verify.bsh Sat Sep 6 12:41:56 2008
@@ -0,0 +1,49 @@
+import java.io.*;
+import java.util.*;
+import java.util.jar.*;
+import java.util.regex.*;
+
+try
+{
+ String[] expected = {
+ "target",
+ "target/test-1.0-SNAPSHOT.jar",
+ "target/classes",
+ "target/classes/main.properties",
+ "target/test-classes",
+ "target/test-classes/test.properties",
+ "target/site",
+ "target/site/index.html",
+ };
+ for ( String path : expected )
+ {
+ File file = new File( basedir, path );
+ System.out.println( "Checking for existence of " + file );
+ if ( !file.exists() )
+ {
+ System.out.println( "FAILURE!" );
+ return false;
+ }
+ }
+
+ String[] unexpected = {
+ "delete-me",
+ };
+ for ( String path : unexpected )
+ {
+ File file = new File( basedir, path );
+ System.out.println( "Checking for absence of " + file );
+ if ( file.exists() )
+ {
+ System.out.println( "FAILURE!" );
+ return false;
+ }
+ }
+}
+catch( Throwable t )
+{
+ t.printStackTrace();
+ return false;
+}
+
+return true;
Propchange: maven/plugins/trunk/maven-clean-plugin/src/it/exclude-default-dirs/verify.bsh
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/plugins/trunk/maven-clean-plugin/src/it/exclude-default-dirs/verify.bsh
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Modified: maven/plugins/trunk/maven-clean-plugin/src/main/java/org/apache/maven/plugin/clean/CleanMojo.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-clean-plugin/src/main/java/org/apache/maven/plugin/clean/CleanMojo.java?rev=692713&r1=692712&r2=692713&view=diff
==============================================================================
--- maven/plugins/trunk/maven-clean-plugin/src/main/java/org/apache/maven/plugin/clean/CleanMojo.java (original)
+++ maven/plugins/trunk/maven-clean-plugin/src/main/java/org/apache/maven/plugin/clean/CleanMojo.java Sat Sep 6 12:41:56 2008
@@ -150,6 +150,15 @@
private boolean failOnError;
/**
+ * Disables the deletion of the default output directories configured for a project. If set to <code>true</code>,
+ * only the files/directories selected via the parameter {@link #filesets} will be deleted.
+ *
+ * @parameter expression="${clean.excludeDefaultDirectories}" default-value="false"
+ * @since 2.3
+ */
+ private boolean excludeDefaultDirectories;
+
+ /**
* Deletes file-sets in the following project build directory order:
* (source) directory, output directory, test directory, report directory,
* and then the additional file-sets.
@@ -170,10 +179,13 @@
{
fileSetManager = new FileSetManager( getLog(), isVerbose() );
- removeDirectory( directory );
- removeDirectory( outputDirectory );
- removeDirectory( testOutputDirectory );
- removeDirectory( reportDirectory );
+ if ( !excludeDefaultDirectories )
+ {
+ removeDirectory( directory );
+ removeDirectory( outputDirectory );
+ removeDirectory( testOutputDirectory );
+ removeDirectory( reportDirectory );
+ }
removeAdditionalFilesets();
}