Index: /trunk/pom.xml
===================================================================
--- /trunk/pom.xml	(revision 19681)
+++ /trunk/pom.xml	(revision 19682)
@@ -43,4 +43,6 @@
     <!-- Needed just in case something adds argLine for tests before we set it -->
     <argLine/>
+    <!-- Like `ant test-perf`, performance tests only run on request: -DskipPerformanceTests=false -->
+    <skipPerformanceTests>true</skipPerformanceTests>
   </properties>
   <packaging>jar</packaging>
@@ -494,8 +496,46 @@
         </executions>
       </plugin>
-      <!-- Configure the test plugin, specifically enable autodetection of global extensions -->
+      <!-- Compile test/functional and test/performance against the unit test classes, like `ant test-compile` -->
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-compiler-plugin</artifactId>
+        <executions>
+          <execution>
+            <id>functional-test-compile</id>
+            <phase>test-compile</phase>
+            <goals>
+              <goal>testCompile</goal>
+            </goals>
+            <configuration>
+              <compileSourceRoots>
+                <compileSourceRoot>${test.dir}/functional</compileSourceRoot>
+              </compileSourceRoots>
+              <outputDirectory>${project.build.directory}/functional-test-classes</outputDirectory>
+            </configuration>
+          </execution>
+          <execution>
+            <id>performance-test-compile</id>
+            <phase>test-compile</phase>
+            <goals>
+              <goal>testCompile</goal>
+            </goals>
+            <configuration>
+              <compileSourceRoots>
+                <compileSourceRoot>${test.dir}/performance</compileSourceRoot>
+              </compileSourceRoots>
+              <outputDirectory>${project.build.directory}/performance-test-classes</outputDirectory>
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
+      <!-- Configure the test plugin, specifically enable autodetection of global extensions.
+           `mvn test` runs the unit tests (default-test, like `ant test-unit`); `mvn integration-test` also runs
+           the functional tests and the unit/functional *TestIT (like `ant test` and `ant test-it`). -->
       <plugin>
         <artifactId>maven-surefire-plugin</artifactId>
         <configuration>
+          <includes>
+            <include>**/*Test</include>
+          </includes>
           <excludes>
             <exclude>**/*TestIT</exclude>
@@ -527,5 +567,5 @@
           </properties>
           <systemPropertyVariables>
-            <josm.home>${test.dir}/config/josm.home</josm.home>
+            <josm.home>${test.dir}/config/unit-josm.home</josm.home>
             <josm.test.data>${test.dir}/data</josm.test.data>
             <java.awt.headless>${test.headless}</java.awt.headless>
@@ -537,18 +577,14 @@
         <executions>
           <execution>
-            <id>default-tests</id>
-            <phase>test</phase>
+            <id>unit-it-tests</id>
+            <phase>integration-test</phase>
             <goals>
               <goal>test</goal>
             </goals>
-          </execution>
-          <execution>
-            <id>integration-tests</id>
-            <phase>integration-test</phase>
-            <goals>
-              <goal>test</goal>
-            </goals>
-            <configuration>
-              <includes>**/*TestIT</includes>
+            <configuration>
+              <includes combine.self="override">
+                <include>**/*TestIT</include>
+              </includes>
+              <excludes combine.self="override"/>
             </configuration>
           </execution>
@@ -560,5 +596,31 @@
             </goals>
             <configuration>
-              <testSourceDirectory>${test.dir}/functional</testSourceDirectory>
+              <testClassesDirectory>${project.build.directory}/functional-test-classes</testClassesDirectory>
+              <additionalClasspathElements>
+                <additionalClasspathElement>${project.build.testOutputDirectory}</additionalClasspathElement>
+              </additionalClasspathElements>
+              <systemPropertyVariables>
+                <josm.home>${test.dir}/config/functional-josm.home</josm.home>
+              </systemPropertyVariables>
+            </configuration>
+          </execution>
+          <execution>
+            <id>functional-it-tests</id>
+            <phase>integration-test</phase>
+            <goals>
+              <goal>test</goal>
+            </goals>
+            <configuration>
+              <testClassesDirectory>${project.build.directory}/functional-test-classes</testClassesDirectory>
+              <additionalClasspathElements>
+                <additionalClasspathElement>${project.build.testOutputDirectory}</additionalClasspathElement>
+              </additionalClasspathElements>
+              <systemPropertyVariables>
+                <josm.home>${test.dir}/config/functional-josm.home</josm.home>
+              </systemPropertyVariables>
+              <includes combine.self="override">
+                <include>**/*TestIT</include>
+              </includes>
+              <excludes combine.self="override"/>
             </configuration>
           </execution>
@@ -570,5 +632,12 @@
             </goals>
             <configuration>
-              <testSourceDirectory>${test.dir}/performance</testSourceDirectory>
+              <skip>${skipPerformanceTests}</skip>
+              <testClassesDirectory>${project.build.directory}/performance-test-classes</testClassesDirectory>
+              <additionalClasspathElements>
+                <additionalClasspathElement>${project.build.testOutputDirectory}</additionalClasspathElement>
+              </additionalClasspathElements>
+              <systemPropertyVariables>
+                <josm.home>${test.dir}/config/performance-josm.home</josm.home>
+              </systemPropertyVariables>
             </configuration>
           </execution>
