maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fgi...@apache.org
Subject svn commit: r423204 - in /maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse: EclipseCleanMojo.java writers/EclipseClasspathWriter.java
Date Tue, 18 Jul 2006 19:16:31 GMT
Author: fgiust
Date: Tue Jul 18 12:16:30 2006
New Revision: 423204

URL: http://svn.apache.org/viewvc?rev=423204&view=rev
Log:
fix absolute paths (should be relative to the project dir) in .classpath when operating in
PDE mode, as reported in MECLIPSE-92
Fix clean mojo to delete only jars in pdeLibDir directory; do not remove the dir if not 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/main/java/org/apache/maven/plugin/eclipse/writers/EclipseClasspathWriter.java

Modified: maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/EclipseCleanMojo.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/EclipseCleanMojo.java?rev=423204&r1=423203&r2=423204&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
Tue Jul 18 12:16:30 2006
@@ -17,6 +17,7 @@
  */
 
 import java.io.File;
+import java.io.FilenameFilter;
 import java.io.IOException;
 
 import org.apache.maven.plugin.AbstractMojo;
@@ -124,9 +125,31 @@
             delete( settingsDir );
         }
 
-        if ( pde )
+        if ( pde && pdeLibDir.isDirectory() )
         {
-            delete( pdeLibDir );
+
+            // delete all the jars in this directory, they have been copied here by the eclipse
plugin
+            File[] localArtifacts = pdeLibDir.listFiles( new FilenameFilter()
+            {
+
+                public boolean accept( File dir, String name )
+                {
+                    return name.endsWith( ".jar" );
+                }
+            } );
+
+            for ( int j = 0; j < localArtifacts.length; j++ )
+            {
+                File file = localArtifacts[j];
+                delete( file );
+            }
+
+            // only if the dir is empty, delete it. Don't delete it is there is still something
there (for example the
+            // directory could have been stored in svn and deleting the .svn control dir
could cause problems
+            if ( pdeLibDir.list().length == 0 )
+            {
+                delete( pdeLibDir );
+            }
         }
     }
 

Modified: maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/EclipseClasspathWriter.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/EclipseClasspathWriter.java?rev=423204&r1=423203&r2=423204&view=diff
==============================================================================
--- maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/EclipseClasspathWriter.java
(original)
+++ maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/EclipseClasspathWriter.java
Tue Jul 18 12:16:30 2006
@@ -261,7 +261,10 @@
                         throw new MojoExecutionException( Messages.getString( "EclipsePlugin.cantcopyartifact",
dep
                             .getArtifactId() ), e );
                     }
-                    path = pdeLibDir + "/" + dep.getFile().getName();
+
+                    File artifactFile = new File( pdeLibDir, dep.getFile().getName() );
+                    path = IdeUtils.toRelativeAndFixSeparator( getEclipseProjectDirectory(),
artifactFile, false );
+
                     kind = ATTR_LIB;
                 }
                 // running in PDE mode and the dependency is provided means, that it is provided
by
@@ -320,5 +323,4 @@
         writer.endElement();
 
     }
-
 }



Mime
View raw message