You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by fg...@apache.org on 2006/04/02 10:43:50 UTC

svn commit: r390799 - in /maven/plugins/trunk/maven-eclipse-plugin/src: main/java/org/apache/maven/plugin/eclipse/EclipseCleanMojo.java test/projects/project-12/

Author: fgiust
Date: Sun Apr  2 00:43:48 2006
New Revision: 390799

URL: http://svn.apache.org/viewcvs?rev=390799&view=rev
Log:
MECLIPSE-71 eclipse:clean delets too much
don't remove .settings dir unless empty

Modified:
    maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/EclipseCleanMojo.java
    maven/plugins/trunk/maven-eclipse-plugin/src/test/projects/project-12/   (props changed)

Modified: maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/EclipseCleanMojo.java
URL: http://svn.apache.org/viewcvs/maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/EclipseCleanMojo.java?rev=390799&r1=390798&r2=390799&view=diff
==============================================================================
--- maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/EclipseCleanMojo.java (original)
+++ maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/EclipseCleanMojo.java Sun Apr  2 00:43:48 2006
@@ -48,11 +48,21 @@
     private static final String FILE_DOT_PROJECT = ".project"; //$NON-NLS-1$
 
     /**
-     * Web Project definition file for Eclipse Web Tools Project (Release 1.0RC5 compatible).
+     * Web Project definition file for Eclipse Web Tools Project (Release 1.0x).
      */
     private static final String DIR_DOT_SETTINGS = ".settings"; //$NON-NLS-1$
 
     /**
+     * File name where the WTP component settings will be stored for our Eclipse Project.
+     */
+    private static final String FILE_DOT_COMPONENT = ".settings/.component"; //$NON-NLS-1$
+
+    /**
+     * File name where Eclipse Project's Facet configuration will be stored.
+     */
+    private static final String FILE_FACET_CORE_XML = ".settings/org.eclipse.wst.common.project.facet.core.xml"; //$NON-NLS-1$
+
+    /**
      * Packaging for the current project.
      * @parameter expression="${project.packaging}"
      * @required
@@ -65,6 +75,9 @@
      */
     private File basedir;
 
+    /**
+     * @see org.apache.maven.plugin.AbstractMojo#execute()
+     */
     public void execute()
         throws MojoExecutionException
     {
@@ -79,16 +92,22 @@
         delete( new File( basedir, FILE_DOT_PROJECT ) );
         delete( new File( basedir, FILE_DOT_CLASSPATH ) );
         delete( new File( basedir, FILE_DOT_WTPMODULES ) );
-        delete( new File( basedir, DIR_DOT_SETTINGS ) );
+
+        delete( new File( basedir, FILE_DOT_COMPONENT ) );
+        delete( new File( basedir, FILE_FACET_CORE_XML ) );
+
+        File settingsDir = new File( basedir, DIR_DOT_SETTINGS );
+        if ( settingsDir.exists() && settingsDir.isDirectory() && settingsDir.list().length == 0 )
+        {
+            delete( settingsDir );
+        }
     }
 
     /**
      * Delete a file, handling log messages and exceptions
      * 
-     * @param f
-     *            File to be deleted
-     * @throws MojoExecutionException
-     *             only if a file exists and can't be deleted
+     * @param f File to be deleted
+     * @throws MojoExecutionException only if a file exists and can't be deleted
      */
     private void delete( File f )
         throws MojoExecutionException
@@ -118,11 +137,19 @@
         }
     }
 
+    /**
+     * Getter for <code>basedir</code>.
+     * @return Returns the basedir.
+     */
     public File getBasedir()
     {
-        return basedir;
+        return this.basedir;
     }
 
+    /**
+     * Setter for <code>basedir</code>.
+     * @param basedir The basedir to set.
+     */
     public void setBasedir( File basedir )
     {
         this.basedir = basedir;

Propchange: maven/plugins/trunk/maven-eclipse-plugin/src/test/projects/project-12/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Sun Apr  2 00:43:48 2006
@@ -0,0 +1 @@
+target