Author: fgiust
Date: Sun Apr 18 10:07:28 2010
New Revision: 935324

URL: http://svn.apache.org/viewvc?rev=935324&view=rev
Log:
MECLIPSE-561 Provide a way to switch .classpath ordering to test-last (with 
appropriate explanation and warnings)

Added:
    
maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-62-MECLIPSE-561/
    
maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-62-MECLIPSE-561/expected/
    
maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-62-MECLIPSE-561/expected/.classpath
    
maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-62-MECLIPSE-561/expected/.project
    
maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-62-MECLIPSE-561/pom.xml
   (with props)
    
maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-62-MECLIPSE-561/src/
    
maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-62-MECLIPSE-561/src/main/
    
maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-62-MECLIPSE-561/src/main/java/
    
maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-62-MECLIPSE-561/src/main/java/DummyClass.java
   (with props)
    
maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-62-MECLIPSE-561/src/main/resources/
    
maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-62-MECLIPSE-561/src/main/resources/main.properties
   (with props)
    
maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-62-MECLIPSE-561/src/test/
    
maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-62-MECLIPSE-561/src/test/java/
    
maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-62-MECLIPSE-561/src/test/java/DummyTest.java
   (with props)
    
maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-62-MECLIPSE-561/src/test/resources/
    
maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-62-MECLIPSE-561/src/test/resources/test.properties
   (with props)
Modified:
    
maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/EclipsePlugin.java
    
maven/plugins/trunk/maven-eclipse-plugin/src/test/java/org/apache/maven/plugin/eclipse/it/EclipsePluginIT.java

Modified: 
maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/EclipsePlugin.java
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/EclipsePlugin.java?rev=935324&r1=935323&r2=935324&view=diff
==============================================================================
--- 
maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/EclipsePlugin.java
 (original)
+++ 
maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/EclipsePlugin.java
 Sun Apr 18 10:07:28 2010
@@ -556,9 +556,23 @@ public class EclipsePlugin
      * useful in situations were you want to override resources found in 
classpath containers, will made JRE classes
      * loaded after 3rd party jars, so enabling it is not suggested.
      * 
+     * @since 2.9
      * @parameter expression="${eclipse.classpathContainersLast}" 
default-value="false"
      */
     protected boolean classpathContainersLast;
+    
+    /**
+     * Whether to place test resources after main resources. Note that the 
default behavior of Maven version 2.0.8 or 
+     * later is to have test dirs before main dirs in classpath so this is 
discouraged if you need to reproduce the
+     * maven behavior during tests. The default behavior is also changed in 
eclipse plugin version 2.6 in order to
+     * better match the maven one.
+     * Switching to "test source last" can anyway be useful if you need to run 
your application in eclipse, since there
+     * is no concept in eclipse of "phases" with different set of source dirs 
and dependencies like we have in maven.
+     * 
+     * @since 2.9
+     * @parameter expression="${eclipse.testSourcesLast}" default-value="false"
+     */
+    protected boolean testSourcesLast;
 
     protected final boolean isJavaProject()
     {
@@ -1562,6 +1576,12 @@ public class EclipsePlugin
 
         // NOTE: Since MNG-3118, test classes come before main classes
         boolean testBeforeMain = isMavenVersion( "[2.0.8,)" );
+        
+        // let users override this if needed, they need to simulate more than 
the test phase in eclipse
+        if (testSourcesLast)
+        {
+            testBeforeMain = false;
+        }
 
         if ( testBeforeMain )
         {

Modified: 
maven/plugins/trunk/maven-eclipse-plugin/src/test/java/org/apache/maven/plugin/eclipse/it/EclipsePluginIT.java
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-eclipse-plugin/src/test/java/org/apache/maven/plugin/eclipse/it/EclipsePluginIT.java?rev=935324&r1=935323&r2=935324&view=diff
==============================================================================
--- 
maven/plugins/trunk/maven-eclipse-plugin/src/test/java/org/apache/maven/plugin/eclipse/it/EclipsePluginIT.java
 (original)
+++ 
maven/plugins/trunk/maven-eclipse-plugin/src/test/java/org/apache/maven/plugin/eclipse/it/EclipsePluginIT.java
 Sun Apr 18 10:07:28 2010
@@ -726,6 +726,19 @@ public class EclipsePluginIT
         testProject( "project-61-MECLIPSE-548" );
     }
 
+    /**
+     * [MECLIPSE-561] Make "test sources last" configurable
+     * 
+     * @throws Exception
+     */
+    public void testProject62()
+        throws Exception
+    {
+        testProject( "project-62-MECLIPSE-561" );
+    }
+
+    
+    
     public void testJeeSimple()
         throws Exception
     {

Added: 
maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-62-MECLIPSE-561/expected/.classpath
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-62-MECLIPSE-561/expected/.classpath?rev=935324&view=auto
==============================================================================
--- 
maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-62-MECLIPSE-561/expected/.classpath
 (added)
+++ 
maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-62-MECLIPSE-561/expected/.classpath
 Sun Apr 18 10:07:28 2010
@@ -0,0 +1,8 @@
+<classpath>
+  <classpathentry kind="src" path="src/main/java" including="**/*.java"/>
+  <classpathentry kind="src" path="src/main/resources" excluding="**/*.java"/>
+  <classpathentry kind="src" path="src/test/java" output="target/test-classes" 
including="**/*.java"/>
+  <classpathentry kind="src" path="src/test/resources" 
output="target/test-classes" excluding="**/*.java"/>
+  <classpathentry kind="output" path="target/classes"/>
+  <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+</classpath>
\ No newline at end of file

Added: 
maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-62-MECLIPSE-561/expected/.project
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-62-MECLIPSE-561/expected/.project?rev=935324&view=auto
==============================================================================
--- 
maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-62-MECLIPSE-561/expected/.project
 (added)
+++ 
maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-62-MECLIPSE-561/expected/.project
 Sun Apr 18 10:07:28 2010
@@ -0,0 +1,13 @@
+<projectDescription>
+  <name>maven-eclipse-plugin-test-project-62</name>
+  <comment>NO_M2ECLIPSE_SUPPORT: Project files created with the 
maven-eclipse-plugin are not supported in M2Eclipse.</comment>
+  <projects/>
+  <buildSpec>
+    <buildCommand>
+      <name>org.eclipse.jdt.core.javabuilder</name>
+    </buildCommand>
+  </buildSpec>
+  <natures>
+    <nature>org.eclipse.jdt.core.javanature</nature>
+  </natures>
+</projectDescription>
\ No newline at end of file

Added: 
maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-62-MECLIPSE-561/pom.xml
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-62-MECLIPSE-561/pom.xml?rev=935324&view=auto
==============================================================================
--- 
maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-62-MECLIPSE-561/pom.xml
 (added)
+++ 
maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-62-MECLIPSE-561/pom.xml
 Sun Apr 18 10:07:28 2010
@@ -0,0 +1,20 @@
+<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>eclipse</groupId>
+  <artifactId>maven-eclipse-plugin-test-project-62</artifactId>
+  <version>25</version>
+  <name>maven-eclipse-plugin-test-project-62</name>
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-eclipse-plugin</artifactId>
+        <version>test</version>
+        <configuration>
+          <testSourcesLast>true</testSourcesLast>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+</project>

Propchange: 
maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-62-MECLIPSE-561/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-62-MECLIPSE-561/pom.xml
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: 
maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-62-MECLIPSE-561/pom.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: 
maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-62-MECLIPSE-561/src/main/java/DummyClass.java
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-62-MECLIPSE-561/src/main/java/DummyClass.java?rev=935324&view=auto
==============================================================================
--- 
maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-62-MECLIPSE-561/src/main/java/DummyClass.java
 (added)
+++ 
maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-62-MECLIPSE-561/src/main/java/DummyClass.java
 Sun Apr 18 10:07:28 2010
@@ -0,0 +1,3 @@
+public class DummyClass
+{
+}

Propchange: 
maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-62-MECLIPSE-561/src/main/java/DummyClass.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-62-MECLIPSE-561/src/main/java/DummyClass.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: 
maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-62-MECLIPSE-561/src/main/java/DummyClass.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: 
maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-62-MECLIPSE-561/src/main/resources/main.properties
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-62-MECLIPSE-561/src/main/resources/main.properties?rev=935324&view=auto
==============================================================================
    (empty)

Propchange: 
maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-62-MECLIPSE-561/src/main/resources/main.properties
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-62-MECLIPSE-561/src/main/resources/main.properties
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: 
maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-62-MECLIPSE-561/src/main/resources/main.properties
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: 
maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-62-MECLIPSE-561/src/test/java/DummyTest.java
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-62-MECLIPSE-561/src/test/java/DummyTest.java?rev=935324&view=auto
==============================================================================
--- 
maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-62-MECLIPSE-561/src/test/java/DummyTest.java
 (added)
+++ 
maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-62-MECLIPSE-561/src/test/java/DummyTest.java
 Sun Apr 18 10:07:28 2010
@@ -0,0 +1,3 @@
+public class DummyTest
+{
+}

Propchange: 
maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-62-MECLIPSE-561/src/test/java/DummyTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-62-MECLIPSE-561/src/test/java/DummyTest.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: 
maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-62-MECLIPSE-561/src/test/java/DummyTest.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: 
maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-62-MECLIPSE-561/src/test/resources/test.properties
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-62-MECLIPSE-561/src/test/resources/test.properties?rev=935324&view=auto
==============================================================================
    (empty)

Propchange: 
maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-62-MECLIPSE-561/src/test/resources/test.properties
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-62-MECLIPSE-561/src/test/resources/test.properties
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: 
maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-62-MECLIPSE-561/src/test/resources/test.properties
------------------------------------------------------------------------------
    svn:mime-type = text/plain


Reply via email to