[MSHARED-250] added IT and fixed support for Maven 3.1-alpha-1/Eclipse Aether 0.9.0-M2 when using Maven 3.0.x (a lot easier to detect with this IT...)

git-svn-id: https://svn.apache.org/repos/asf/maven/shared/trunk@1467838 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/pom.xml b/pom.xml
index ec3399f..a75e95e 100644
--- a/pom.xml
+++ b/pom.xml
@@ -85,6 +85,12 @@
       <groupId>org.eclipse.aether</groupId>
       <artifactId>aether-util</artifactId>
       <version>0.9.0.M2</version>
+      <exclusions>
+        <exclusion>
+          <groupId>org.eclipse.aether</groupId>
+          <artifactId>aether-api</artifactId>
+        </exclusion>
+      </exclusions>
     </dependency>
 
     <dependency>
@@ -122,10 +128,36 @@
           </excludes>
         </configuration>
       </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-invoker-plugin</artifactId>
+        <configuration>
+          <debug>true</debug>
+          <projectsDirectory>src/it</projectsDirectory>
+          <cloneProjectsTo>${project.build.directory}/it</cloneProjectsTo>
+          <preBuildHookScript>setup</preBuildHookScript>
+          <postBuildHookScript>verify</postBuildHookScript>
+          <localRepositoryPath>${project.build.directory}/local-repo</localRepositoryPath>
+          <settingsFile>src/it/settings.xml</settingsFile>
+          <pomIncludes>
+            <pomInclude>*/pom.xml</pomInclude>
+          </pomIncludes>
+        </configuration>
+        <executions>
+          <execution>
+            <id>integration-test</id>
+            <goals>
+              <goal>install</goal>
+              <goal>integration-test</goal>
+              <goal>verify</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
     </plugins>
   </build>
-  <profiles>
 
+  <profiles>
     <profile>
       <id>reporting</id>
       <reporting>
diff --git a/src/it/maven-version/expected.txt b/src/it/maven-version/expected.txt
new file mode 100644
index 0000000..65e2f92
--- /dev/null
+++ b/src/it/maven-version/expected.txt
@@ -0,0 +1,14 @@
+org.apache.maven.its.dependency-tree:test:jar:1.0-SNAPSHOT
+\- org.apache.maven:maven-project:jar:2.0.6:compile
+   +- org.apache.maven:maven-settings:jar:2.0.6:compile
+   +- org.apache.maven:maven-profile:jar:2.0.6:compile
+   +- org.apache.maven:maven-model:jar:2.0.6:compile
+   +- org.apache.maven:maven-artifact-manager:jar:2.0.6:compile
+   |  +- org.apache.maven:maven-repository-metadata:jar:2.0.6:compile
+   |  \- org.apache.maven.wagon:wagon-provider-api:jar:1.0-beta-2:compile
+   +- org.apache.maven:maven-plugin-registry:jar:2.0.6:compile
+   +- org.codehaus.plexus:plexus-utils:jar:1.4.1:compile
+   +- org.apache.maven:maven-artifact:jar:2.0.6:compile
+   \- org.codehaus.plexus:plexus-container-default:jar:1.0-alpha-9-stable-1:compile
+      +- junit:junit:jar:3.8.1:compile
+      \- classworlds:classworlds:jar:1.1-alpha-2:compile
diff --git a/src/it/maven-version/invoker.properties b/src/it/maven-version/invoker.properties
new file mode 100644
index 0000000..6448eca
--- /dev/null
+++ b/src/it/maven-version/invoker.properties
@@ -0,0 +1 @@
+invoker.goals = dependency:tree
diff --git a/src/it/maven-version/pom.xml b/src/it/maven-version/pom.xml
new file mode 100644
index 0000000..5e17352
--- /dev/null
+++ b/src/it/maven-version/pom.xml
@@ -0,0 +1,65 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one
+  ~ or more contributor license agreements.  See the NOTICE file
+  ~ distributed with this work for additional information
+  ~ regarding copyright ownership.  The ASF licenses this file
+  ~ to you under the Apache License, Version 2.0 (the
+  ~ "License"); you may not use this file except in compliance
+  ~ with the License.  You may obtain a copy of the License at
+  ~
+  ~   http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing,
+  ~ software distributed under the License is distributed on an
+  ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  ~ KIND, either express or implied.  See the License for the
+  ~ specific language governing permissions and limitations
+  ~ under the License.
+  -->
+
+<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/xsd/maven-4.0.0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+
+  <groupId>org.apache.maven.its.dependency-tree</groupId>
+  <artifactId>test</artifactId>
+  <version>1.0-SNAPSHOT</version>
+
+  <name>Test</name>
+  <description>
+    Test dependency-tree with actual Maven version through dependency:tree (easier than shade, or MPIR:dependencies)
+  </description>
+
+  <properties>
+    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+  </properties>
+
+  <dependencies>
+    <dependency>
+      <groupId>org.apache.maven</groupId>
+      <artifactId>maven-project</artifactId>
+      <version>2.0.6</version>
+    </dependency>
+  </dependencies>
+
+  <build>
+    <pluginManagement>
+      <plugins>
+        <plugin>
+          <groupId>org.apache.maven.plugins</groupId>
+          <artifactId>maven-dependency-plugin</artifactId>
+          <version>2.6</version>
+          <dependencies>
+            <dependency>
+              <groupId>@project.groupId@</groupId>
+              <artifactId>@project.artifactId@</artifactId>
+              <version>@project.version@</version>
+            </dependency>
+          </dependencies>
+        </plugin>
+      </plugins>
+    </pluginManagement>
+  </build>
+</project>
diff --git a/src/it/maven-version/test.properties b/src/it/maven-version/test.properties
new file mode 100644
index 0000000..62752d7
--- /dev/null
+++ b/src/it/maven-version/test.properties
@@ -0,0 +1 @@
+outputFile = target/tree.txt
diff --git a/src/it/maven-version/verify.bsh b/src/it/maven-version/verify.bsh
new file mode 100644
index 0000000..8bad5d4
--- /dev/null
+++ b/src/it/maven-version/verify.bsh
@@ -0,0 +1,18 @@
+import java.io.*;
+
+import org.codehaus.plexus.util.*;
+
+String actual = FileUtils.fileRead( new File( basedir, "target/tree.txt" ) );
+String expected = FileUtils.fileRead( new File( basedir, "expected.txt" ) );
+
+actual = actual.replaceAll( "[\n\r]+", "\n" );
+expected = expected.replaceAll( "[\n\r]+", "\n" );
+
+System.out.println( "Checking dependency tree..." );
+
+if ( !actual.equals( expected ) )
+{
+    throw new Exception( "Unexpected dependency tree" );
+}
+
+return true;
diff --git a/src/it/settings.xml b/src/it/settings.xml
new file mode 100644
index 0000000..c8f77f0
--- /dev/null
+++ b/src/it/settings.xml
@@ -0,0 +1,55 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied.  See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+
+<settings>
+  <profiles>
+    <profile>
+      <id>it-repo</id>
+      <activation>
+        <activeByDefault>true</activeByDefault>
+      </activation>
+      <repositories>
+        <repository>
+          <id>local.central</id>
+          <url>@localRepositoryUrl@</url>
+          <releases>
+            <enabled>true</enabled>
+          </releases>
+          <snapshots>
+            <enabled>true</enabled>
+          </snapshots>
+        </repository>
+      </repositories>
+      <pluginRepositories>
+        <pluginRepository>
+          <id>local.central</id>
+          <url>@localRepositoryUrl@</url>
+          <releases>
+            <enabled>true</enabled>
+          </releases>
+          <snapshots>
+            <enabled>true</enabled>
+          </snapshots>
+        </pluginRepository>
+      </pluginRepositories>
+    </profile>
+  </profiles>
+</settings>