Author: fgiust
Date: Sat Nov 25 11:48:47 2006
New Revision: 479179

URL: http://svn.apache.org/viewvc?view=rev&rev=479179
Log:
make this test run without the need for a "maven.home" system property, that's 
pretty annoying when you run tests in eclipse

Modified:
    
maven/plugins/trunk/maven-eclipse-plugin/src/test/java/org/apache/maven/plugin/eclipse/AbstractEclipsePluginTestCase.java

Modified: 
maven/plugins/trunk/maven-eclipse-plugin/src/test/java/org/apache/maven/plugin/eclipse/AbstractEclipsePluginTestCase.java
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-eclipse-plugin/src/test/java/org/apache/maven/plugin/eclipse/AbstractEclipsePluginTestCase.java?view=diff&rev=479179&r1=479178&r2=479179
==============================================================================
--- 
maven/plugins/trunk/maven-eclipse-plugin/src/test/java/org/apache/maven/plugin/eclipse/AbstractEclipsePluginTestCase.java
 (original)
+++ 
maven/plugins/trunk/maven-eclipse-plugin/src/test/java/org/apache/maven/plugin/eclipse/AbstractEclipsePluginTestCase.java
 Sat Nov 25 11:48:47 2006
@@ -99,6 +99,26 @@
 
         projectTool = (ProjectTool) lookup( ProjectTool.ROLE, "default" );
 
+        String mavenHome = System.getProperty( "maven.home" );
+
+        // maven.home is set by surefire when the test is run with maven, but 
better make the test run in IDEs without
+        // the need of additional properties
+        if ( mavenHome == null )
+        {
+            String path = System.getProperty( "java.library.path" );
+            String[] paths = StringUtils.split( path, System.getProperty( 
"path.separator" ) );
+            for ( int j = 0; j < paths.length; j++ )
+            {
+                String pt = paths[j];
+                if ( new File( pt, "m2" ).exists() )
+                {
+                    System.setProperty( "maven.home", new File( pt 
).getParent() );
+                    break;
+                }
+
+            }
+        }
+
         synchronized ( AbstractEclipsePluginTestCase.class )
         {
             if ( !installed )


Reply via email to