You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by sj...@apache.org on 2022/02/16 19:27:50 UTC

[maven-dependency-analyzer] branch MSHARED-1035 created (now b94fcff)

This is an automated email from the ASF dual-hosted git repository.

sjaranowski pushed a change to branch MSHARED-1035
in repository https://gitbox.apache.org/repos/asf/maven-dependency-analyzer.git.


      at b94fcff  [MSHARED-1035] Get rid of maven-plugin-testing-tools for IT test

This branch includes the following new commits:

     new b94fcff  [MSHARED-1035] Get rid of maven-plugin-testing-tools for IT test

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


[maven-dependency-analyzer] 01/01: [MSHARED-1035] Get rid of maven-plugin-testing-tools for IT test

Posted by sj...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

sjaranowski pushed a commit to branch MSHARED-1035
in repository https://gitbox.apache.org/repos/asf/maven-dependency-analyzer.git

commit b94fcffda9530128b07e268af30d82fd9044ca49
Author: Slawomir Jaranowski <s....@gmail.com>
AuthorDate: Wed Feb 16 20:26:05 2022 +0100

    [MSHARED-1035] Get rid of maven-plugin-testing-tools for IT test
    
    IT tests will be executed by maven-invoker-plugin
---
 pom.xml                                            |  89 ++--
 .../inlinedStaticReference/pom.xml                 |  18 +
 .../main/java/inlinedStaticReference/Project.java  |   0
 .../inlinedStaticReference/verify.groovy}          |  23 +-
 .../jarWithClassInUnnamedPackage/pom.xml           |   0
 .../jarWithClassInUnnamedPackage/project1/pom.xml  |   0
 .../project1/src/main/java/coffee.java             |   0
 .../jarWithClassInUnnamedPackage/project2/pom.xml  |  18 +
 .../project2/src/main/java/project2/Project.java   |   0
 .../jarWithClassInUnnamedPackage/verify.groovy}    |  25 +-
 .../jarWithCompileDependency/pom.xml               |   0
 .../jarWithCompileDependency/project1/pom.xml      |   0
 .../project1/Project1.java                         |   0
 .../jarWithCompileDependency/project2/pom.xml      |  29 +-
 .../project2/Project2.java                         |   0
 .../project2/Project2Test.java                     |   0
 .../jarWithCompileDependency/verify.groovy}        |  26 +-
 .../jarWithCompileScopedTestDependency/pom.xml     |   0
 .../project1/pom.xml                               |   0
 .../jarWithTestDependency/project1/Project1.java   |   0
 .../project2/pom.xml                               |  30 +-
 .../jarWithTestDependency/project2/Project2.java   |   0
 .../verify.groovy}                                 |  27 +-
 .../resources => it}/jarWithNoDependencies/pom.xml |  19 +-
 .../main/java/jarWithNoDependencies/Project.java   |   0
 .../jarWithNoDependencies/verify.groovy}           |  22 +-
 .../jarWithRuntimeScopedTestDependency/pom.xml     |   0
 .../project1/pom.xml                               |   0
 .../jarWithTestDependency/project1/Project1.java   |   0
 .../project2/pom.xml                               |  30 +-
 .../jarWithTestDependency/project2/Project2.java   |   0
 .../verify.groovy}                                 |  26 +-
 .../resources => it}/jarWithTestDependency/pom.xml |   0
 .../jarWithTestDependency/project1/pom.xml         |   0
 .../jarWithTestDependency/project1/Project1.java   |   0
 .../jarWithTestDependency/project2/pom.xml         |  34 +-
 .../jarWithTestDependency/project2/Project2.java   |   0
 .../jarWithTestDependency/verify.groovy}           |  26 +-
 .../jarWithXmlTransitiveDependency/pom.xml         |  18 +
 .../jarWithXmlTransitiveDependency/Project.java    |   0
 .../jarWithXmlTransitiveDependency/verify.groovy}  |  27 +-
 src/{test/resources => it}/java8methodRefs/pom.xml |  17 +-
 .../main/java/inlinedStaticReference/Project.java  |   0
 .../Main.java => it/java8methodRefs/verify.groovy} |  24 +-
 .../multimoduleProject/module1/pom.xml             |   0
 .../module1/src/main/java/foo/Main.java            |   0
 .../multimoduleProject/module2/pom.xml             |  18 +
 .../module2/src/main/java/bar/Main.java            |   0
 .../resources => it}/multimoduleProject/pom.xml    |   4 -
 .../multimoduleProject/verify.groovy}              |  23 +-
 src/{test/resources => it}/pom/pom.xml             |  18 +-
 .../java/bar/Main.java => it/pom/verify.groovy}    |  22 +-
 src/it/settings.xml                                |  54 +++
 src/it/setup-mock-plugin/invoker.properties        |  18 +
 src/it/setup-mock-plugin/pom.xml                   |  73 +++
 .../src/main/java/it/test/MockAnalyzeMojo.java     | 104 +++++
 .../typeUseAnnotationDependency/annotation/pom.xml |   0
 .../annotation/Annotation.java                     |   0
 .../typeUseAnnotationDependency/pom.xml            |   0
 .../typeUseAnnotationDependency/usage/pom.xml      |  18 +
 .../typeUseAnnotationDependency/usage/Usage.java   |   0
 .../usageLocalVar/pom.xml                          |  18 +
 .../usageLocalVar/UsageLocalVar.java               |   0
 .../typeUseAnnotationDependency/verify.groovy}     |  42 +-
 .../unnamedPackageClassReference/pom.xml           |  18 +
 .../java/unnamedPackageClassReference/Project.java |   0
 .../unnamedPackageClassReference/verify.groovy}    |  23 +-
 .../usedUndeclaredReference/pom.xml                |  18 +
 .../main/java/usedUndeclaredReference/Project.java |   0
 .../usedUndeclaredReference/verify.groovy}         |  27 +-
 .../DefaultProjectDependencyAnalyzerTest.java      | 499 ---------------------
 .../analyzer/ProjectDependencyAnalysisTest.java    |  45 +-
 72 files changed, 810 insertions(+), 760 deletions(-)

diff --git a/pom.xml b/pom.xml
index 5a09270..936827c 100644
--- a/pom.xml
+++ b/pom.xml
@@ -65,16 +65,6 @@
     <project.build.outputTimestamp>2022-01-24T19:57:26Z</project.build.outputTimestamp>
   </properties>
 
-  <dependencyManagement>
-    <dependencies>
-      <dependency>
-        <groupId>org.apache.maven.shared</groupId>
-        <artifactId>maven-invoker</artifactId>
-        <version>3.1.0</version>
-      </dependency>
-    </dependencies>
-  </dependencyManagement>
-
   <dependencies>
     <dependency>
       <groupId>org.ow2.asm</groupId>
@@ -112,12 +102,8 @@
       <artifactId>maven-artifact</artifactId>
       <version>${mavenVersion}</version>
     </dependency>
-    <dependency>
-      <groupId>org.apache.maven.plugin-testing</groupId>
-      <artifactId>maven-plugin-testing-tools</artifactId>
-      <version>1.3</version>
-      <scope>test</scope>
-    </dependency>
+
+    <!-- testing support -->
     <dependency>
       <groupId>junit</groupId>
       <artifactId>junit</artifactId>
@@ -145,38 +131,9 @@
         </plugin>
       </plugins>
     </pluginManagement>
+
     <plugins>
       <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-enforcer-plugin</artifactId>
-        <executions>
-          <execution>
-            <!-- remove after MSHARED-916 -->
-            <id>enforce-max-maven-version</id>
-            <goals>
-              <goal>enforce</goal>
-            </goals>
-            <configuration>
-              <rules>
-                <requireMavenVersion>
-                  <version>(,3.6.3]</version>
-                </requireMavenVersion>
-              </rules>
-            </configuration>
-          </execution>
-        </executions>
-      </plugin>
-      <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-surefire-plugin</artifactId>
-        <configuration>
-          <systemPropertyVariables>
-            <maven.home>${maven.home}</maven.home>
-            <local.repo>${project.build.directory}/local-repo</local.repo>
-          </systemPropertyVariables>
-        </configuration>
-      </plugin>
-      <plugin>
         <groupId>org.codehaus.plexus</groupId>
         <artifactId>plexus-component-metadata</artifactId>
         <executions>
@@ -192,24 +149,34 @@
 
   <profiles>
     <profile>
-      <id>maven-repo-local</id>
-      <activation>
-        <property>
-          <name>maven.repo.local</name>
-        </property>
-      </activation>
+      <id>run-its</id>
       <build>
         <plugins>
-         <plugin>
-            <artifactId>maven-surefire-plugin</artifactId>
+          <plugin>
+            <groupId>org.apache.maven.plugins</groupId>
+            <artifactId>maven-invoker-plugin</artifactId>
+            <executions>
+              <execution>
+                <goals>
+                  <goal>install</goal>
+                  <goal>integration-test</goal>
+                  <goal>verify</goal>
+                </goals>
+              </execution>
+            </executions>
             <configuration>
-              <systemProperties combine.children="append">
-                <property>
-                  <!-- Pass this through to the tests (if set!) to have them pick the right repository -->
-                  <name>maven.repo.local</name>
-                  <value>${maven.repo.local}</value>
-                </property>
-              </systemProperties>
+              <cloneProjectsTo>${project.build.directory}/it</cloneProjectsTo>
+              <localRepositoryPath>target/local-repo</localRepositoryPath>
+              <settingsFile>src/it/settings.xml</settingsFile>
+              <postBuildHookScript>verify</postBuildHookScript>
+              <goals>
+                <goal>verify</goal>
+              </goals>
+              <properties>
+                <maven.compiler.source>${java.specification.version}</maven.compiler.source>
+                <maven.compiler.target>${java.specification.version}</maven.compiler.target>
+                <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+              </properties>
             </configuration>
           </plugin>
         </plugins>
diff --git a/src/test/resources/inlinedStaticReference/pom.xml b/src/it/inlinedStaticReference/pom.xml
similarity index 78%
rename from src/test/resources/inlinedStaticReference/pom.xml
rename to src/it/inlinedStaticReference/pom.xml
index 7c14d9d..9bfdaaa 100644
--- a/src/test/resources/inlinedStaticReference/pom.xml
+++ b/src/it/inlinedStaticReference/pom.xml
@@ -38,4 +38,22 @@
       <version>1.6.1</version>
     </dependency>
   </dependencies>
+
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.shared.dependency-analyzer.tests</groupId>
+        <artifactId>maven-mock-plugin</artifactId>
+        <version>1.0</version>
+        <executions>
+          <execution>
+            <goals>
+              <goal>mock-analyze</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
+  </build>
+
 </project>
diff --git a/src/test/resources/inlinedStaticReference/src/main/java/inlinedStaticReference/Project.java b/src/it/inlinedStaticReference/src/main/java/inlinedStaticReference/Project.java
similarity index 100%
rename from src/test/resources/inlinedStaticReference/src/main/java/inlinedStaticReference/Project.java
rename to src/it/inlinedStaticReference/src/main/java/inlinedStaticReference/Project.java
diff --git a/src/test/resources/multimoduleProject/module2/src/main/java/bar/Main.java b/src/it/inlinedStaticReference/verify.groovy
similarity index 74%
copy from src/test/resources/multimoduleProject/module2/src/main/java/bar/Main.java
copy to src/it/inlinedStaticReference/verify.groovy
index be9a400..088383c 100644
--- a/src/test/resources/multimoduleProject/module2/src/main/java/bar/Main.java
+++ b/src/it/inlinedStaticReference/verify.groovy
@@ -6,9 +6,9 @@
  * 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
@@ -16,9 +16,18 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package bar;
 
-public class Main
-{
-    public foo.Main dummy = null;
-}
+def analysis = new File( basedir, 'target/analysis.txt' ).text
+
+def expected = '''
+UsedDeclaredArtifacts:
+ dom4j:dom4j:jar:1.6.1:compile
+
+UsedUndeclaredArtifactsWithClasses:
+
+UnusedDeclaredArtifacts:
+
+TestArtifactsWithNonTestScope:
+'''
+
+assert analysis == expected
diff --git a/src/test/resources/jarWithClassInUnnamedPackage/pom.xml b/src/it/jarWithClassInUnnamedPackage/pom.xml
similarity index 100%
rename from src/test/resources/jarWithClassInUnnamedPackage/pom.xml
rename to src/it/jarWithClassInUnnamedPackage/pom.xml
diff --git a/src/test/resources/jarWithClassInUnnamedPackage/project1/pom.xml b/src/it/jarWithClassInUnnamedPackage/project1/pom.xml
similarity index 100%
rename from src/test/resources/jarWithClassInUnnamedPackage/project1/pom.xml
rename to src/it/jarWithClassInUnnamedPackage/project1/pom.xml
diff --git a/src/test/resources/jarWithClassInUnnamedPackage/project1/src/main/java/coffee.java b/src/it/jarWithClassInUnnamedPackage/project1/src/main/java/coffee.java
similarity index 100%
rename from src/test/resources/jarWithClassInUnnamedPackage/project1/src/main/java/coffee.java
rename to src/it/jarWithClassInUnnamedPackage/project1/src/main/java/coffee.java
diff --git a/src/test/resources/jarWithClassInUnnamedPackage/project2/pom.xml b/src/it/jarWithClassInUnnamedPackage/project2/pom.xml
similarity index 74%
rename from src/test/resources/jarWithClassInUnnamedPackage/project2/pom.xml
rename to src/it/jarWithClassInUnnamedPackage/project2/pom.xml
index c2aad12..03b7210 100644
--- a/src/test/resources/jarWithClassInUnnamedPackage/project2/pom.xml
+++ b/src/it/jarWithClassInUnnamedPackage/project2/pom.xml
@@ -37,4 +37,22 @@
             <version>1.0</version>
         </dependency>
     </dependencies>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.maven.shared.dependency-analyzer.tests</groupId>
+                <artifactId>maven-mock-plugin</artifactId>
+                <version>1.0</version>
+                <executions>
+                    <execution>
+                        <goals>
+                            <goal>mock-analyze</goal>
+                        </goals>
+                    </execution>
+                </executions>
+            </plugin>
+        </plugins>
+    </build>
+
 </project>
diff --git a/src/test/resources/jarWithClassInUnnamedPackage/project2/src/main/java/project2/Project.java b/src/it/jarWithClassInUnnamedPackage/project2/src/main/java/project2/Project.java
similarity index 100%
rename from src/test/resources/jarWithClassInUnnamedPackage/project2/src/main/java/project2/Project.java
rename to src/it/jarWithClassInUnnamedPackage/project2/src/main/java/project2/Project.java
diff --git a/src/test/resources/multimoduleProject/module1/src/main/java/foo/Main.java b/src/it/jarWithClassInUnnamedPackage/verify.groovy
similarity index 70%
copy from src/test/resources/multimoduleProject/module1/src/main/java/foo/Main.java
copy to src/it/jarWithClassInUnnamedPackage/verify.groovy
index 7ca91f7..50d914a 100644
--- a/src/test/resources/multimoduleProject/module1/src/main/java/foo/Main.java
+++ b/src/it/jarWithClassInUnnamedPackage/verify.groovy
@@ -6,9 +6,9 @@
  * 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
@@ -16,17 +16,18 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package foo;
 
-import org.apache.maven.artifact.Artifact;
-import org.apache.maven.artifact.repository.metadata.Metadata;
-import org.apache.maven.model.Model;
+def analysis = new File( basedir, 'project2/target/analysis.txt' ).text
 
-public class Main
-{
-    public static final String SCOPE_COMPILE = Artifact.SCOPE_COMPILE;
+def expected = '''
+UsedDeclaredArtifacts:
 
-    public Model model = null;
+UsedUndeclaredArtifactsWithClasses:
 
-    public Metadata metadata = null;
-}
+UnusedDeclaredArtifacts:
+ org.apache.maven.shared.dependency-analyzer.tests:jarWithClassInUnnamedPackage1:jar:1.0:compile
+
+TestArtifactsWithNonTestScope:
+'''
+
+assert analysis == expected
diff --git a/src/test/resources/jarWithCompileDependency/pom.xml b/src/it/jarWithCompileDependency/pom.xml
similarity index 100%
rename from src/test/resources/jarWithCompileDependency/pom.xml
rename to src/it/jarWithCompileDependency/pom.xml
diff --git a/src/test/resources/jarWithCompileDependency/project1/pom.xml b/src/it/jarWithCompileDependency/project1/pom.xml
similarity index 100%
rename from src/test/resources/jarWithCompileDependency/project1/pom.xml
rename to src/it/jarWithCompileDependency/project1/pom.xml
diff --git a/src/test/resources/jarWithCompileDependency/project1/src/main/java/jarWithCompileDependency/project1/Project1.java b/src/it/jarWithCompileDependency/project1/src/main/java/jarWithCompileDependency/project1/Project1.java
similarity index 100%
rename from src/test/resources/jarWithCompileDependency/project1/src/main/java/jarWithCompileDependency/project1/Project1.java
rename to src/it/jarWithCompileDependency/project1/src/main/java/jarWithCompileDependency/project1/Project1.java
diff --git a/src/test/resources/jarWithCompileDependency/project2/pom.xml b/src/it/jarWithCompileDependency/project2/pom.xml
similarity index 75%
rename from src/test/resources/jarWithCompileDependency/project2/pom.xml
rename to src/it/jarWithCompileDependency/project2/pom.xml
index bc920b8..3376251 100644
--- a/src/test/resources/jarWithCompileDependency/project2/pom.xml
+++ b/src/it/jarWithCompileDependency/project2/pom.xml
@@ -37,10 +37,27 @@
 			<version>1.0</version>
 		</dependency>
 		<dependency>
-            <groupId>com.google.guava</groupId>
-            <artifactId>guava</artifactId>
-            <version>30.1.1-android</version>
-        </dependency>
-	</dependencies>	
-	
+			<groupId>com.google.guava</groupId>
+			<artifactId>guava</artifactId>
+			<version>30.1.1-android</version>
+		</dependency>
+	</dependencies>
+
+	<build>
+		<plugins>
+			<plugin>
+				<groupId>org.apache.maven.shared.dependency-analyzer.tests</groupId>
+				<artifactId>maven-mock-plugin</artifactId>
+				<version>1.0</version>
+				<executions>
+					<execution>
+						<goals>
+							<goal>mock-analyze</goal>
+						</goals>
+					</execution>
+				</executions>
+			</plugin>
+		</plugins>
+	</build>
+
 </project>
diff --git a/src/test/resources/jarWithCompileDependency/project2/src/main/java/jarWithCompileDependency/project2/Project2.java b/src/it/jarWithCompileDependency/project2/src/main/java/jarWithCompileDependency/project2/Project2.java
similarity index 100%
rename from src/test/resources/jarWithCompileDependency/project2/src/main/java/jarWithCompileDependency/project2/Project2.java
rename to src/it/jarWithCompileDependency/project2/src/main/java/jarWithCompileDependency/project2/Project2.java
diff --git a/src/test/resources/jarWithCompileDependency/project2/src/test/java/jarWithCompileDependency/project2/Project2Test.java b/src/it/jarWithCompileDependency/project2/src/test/java/jarWithCompileDependency/project2/Project2Test.java
similarity index 100%
rename from src/test/resources/jarWithCompileDependency/project2/src/test/java/jarWithCompileDependency/project2/Project2Test.java
rename to src/it/jarWithCompileDependency/project2/src/test/java/jarWithCompileDependency/project2/Project2Test.java
diff --git a/src/test/resources/multimoduleProject/module1/src/main/java/foo/Main.java b/src/it/jarWithCompileDependency/verify.groovy
similarity index 67%
copy from src/test/resources/multimoduleProject/module1/src/main/java/foo/Main.java
copy to src/it/jarWithCompileDependency/verify.groovy
index 7ca91f7..d31d9cd 100644
--- a/src/test/resources/multimoduleProject/module1/src/main/java/foo/Main.java
+++ b/src/it/jarWithCompileDependency/verify.groovy
@@ -6,9 +6,9 @@
  * 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
@@ -16,17 +16,19 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package foo;
 
-import org.apache.maven.artifact.Artifact;
-import org.apache.maven.artifact.repository.metadata.Metadata;
-import org.apache.maven.model.Model;
+def analysis = new File( basedir, 'project2/target/analysis.txt' ).text
 
-public class Main
-{
-    public static final String SCOPE_COMPILE = Artifact.SCOPE_COMPILE;
+def expected = '''
+UsedDeclaredArtifacts:
+ org.apache.maven.shared.dependency-analyzer.tests:jarWithCompileDependency1:jar:1.0:compile
+ com.google.guava:guava:jar:30.1.1-android:compile
 
-    public Model model = null;
+UsedUndeclaredArtifactsWithClasses:
 
-    public Metadata metadata = null;
-}
+UnusedDeclaredArtifacts:
+
+TestArtifactsWithNonTestScope:
+'''
+
+assert analysis == expected
diff --git a/src/test/resources/jarWithCompileScopedTestDependency/pom.xml b/src/it/jarWithCompileScopedTestDependency/pom.xml
similarity index 100%
rename from src/test/resources/jarWithCompileScopedTestDependency/pom.xml
rename to src/it/jarWithCompileScopedTestDependency/pom.xml
diff --git a/src/test/resources/jarWithCompileScopedTestDependency/project1/pom.xml b/src/it/jarWithCompileScopedTestDependency/project1/pom.xml
similarity index 100%
rename from src/test/resources/jarWithCompileScopedTestDependency/project1/pom.xml
rename to src/it/jarWithCompileScopedTestDependency/project1/pom.xml
diff --git a/src/test/resources/jarWithRuntimeScopedTestDependency/project1/src/main/java/jarWithTestDependency/project1/Project1.java b/src/it/jarWithCompileScopedTestDependency/project1/src/main/java/jarWithTestDependency/project1/Project1.java
similarity index 100%
rename from src/test/resources/jarWithRuntimeScopedTestDependency/project1/src/main/java/jarWithTestDependency/project1/Project1.java
rename to src/it/jarWithCompileScopedTestDependency/project1/src/main/java/jarWithTestDependency/project1/Project1.java
diff --git a/src/test/resources/jarWithCompileScopedTestDependency/project2/pom.xml b/src/it/jarWithCompileScopedTestDependency/project2/pom.xml
similarity index 81%
rename from src/test/resources/jarWithCompileScopedTestDependency/project2/pom.xml
rename to src/it/jarWithCompileScopedTestDependency/project2/pom.xml
index d2dd865..f6f6b1e 100644
--- a/src/test/resources/jarWithCompileScopedTestDependency/project2/pom.xml
+++ b/src/it/jarWithCompileScopedTestDependency/project2/pom.xml
@@ -30,18 +30,6 @@
   <packaging>jar</packaging>
   <version>1.0</version>
 
-  <build>
-    <pluginManagement>
-      <plugins>
-        <plugin>
-          <groupId>org.apache.maven.plugins</groupId>
-          <artifactId>maven-surefire-plugin</artifactId>
-          <version>2.3.1</version>
-        </plugin>
-      </plugins>
-    </pluginManagement>
-  </build>
-
   <dependencies>
     <dependency>
       <groupId>org.apache.maven.shared.dependency-analyzer.tests</groupId>
@@ -55,7 +43,23 @@
       <artifactId>junit</artifactId>
       <version>3.8.1</version>
     </dependency>
-
   </dependencies>
 
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.shared.dependency-analyzer.tests</groupId>
+        <artifactId>maven-mock-plugin</artifactId>
+        <version>1.0</version>
+        <executions>
+          <execution>
+            <goals>
+              <goal>mock-analyze</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
+  </build>
+
 </project>
diff --git a/src/test/resources/jarWithCompileScopedTestDependency/project2/src/test/java/jarWithTestDependency/project2/Project2.java b/src/it/jarWithCompileScopedTestDependency/project2/src/test/java/jarWithTestDependency/project2/Project2.java
similarity index 100%
rename from src/test/resources/jarWithCompileScopedTestDependency/project2/src/test/java/jarWithTestDependency/project2/Project2.java
rename to src/it/jarWithCompileScopedTestDependency/project2/src/test/java/jarWithTestDependency/project2/Project2.java
diff --git a/src/test/resources/multimoduleProject/module1/src/main/java/foo/Main.java b/src/it/jarWithCompileScopedTestDependency/verify.groovy
similarity index 66%
copy from src/test/resources/multimoduleProject/module1/src/main/java/foo/Main.java
copy to src/it/jarWithCompileScopedTestDependency/verify.groovy
index 7ca91f7..86e0069 100644
--- a/src/test/resources/multimoduleProject/module1/src/main/java/foo/Main.java
+++ b/src/it/jarWithCompileScopedTestDependency/verify.groovy
@@ -6,9 +6,9 @@
  * 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
@@ -16,17 +16,20 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package foo;
 
-import org.apache.maven.artifact.Artifact;
-import org.apache.maven.artifact.repository.metadata.Metadata;
-import org.apache.maven.model.Model;
+def analysis = new File( basedir, 'project2/target/analysis.txt' ).text
 
-public class Main
-{
-    public static final String SCOPE_COMPILE = Artifact.SCOPE_COMPILE;
+def expected = '''
+UsedDeclaredArtifacts:
+ org.apache.maven.shared.dependency-analyzer.tests:jarWithCompileScopedTestDependency1:jar:1.0:test
+ junit:junit:jar:3.8.1:compile
 
-    public Model model = null;
+UsedUndeclaredArtifactsWithClasses:
 
-    public Metadata metadata = null;
-}
+UnusedDeclaredArtifacts:
+
+TestArtifactsWithNonTestScope:
+ junit:junit:jar:3.8.1:compile
+'''
+
+assert analysis == expected
diff --git a/src/test/resources/jarWithNoDependencies/pom.xml b/src/it/jarWithNoDependencies/pom.xml
similarity index 78%
rename from src/test/resources/jarWithNoDependencies/pom.xml
rename to src/it/jarWithNoDependencies/pom.xml
index 12fb6b3..38b911f 100644
--- a/src/test/resources/jarWithNoDependencies/pom.xml
+++ b/src/it/jarWithNoDependencies/pom.xml
@@ -29,5 +29,22 @@
 	<artifactId>jarWithNoDependencies</artifactId>
 	<packaging>jar</packaging>
 	<version>1.0</version>
-	
+
+	<build>
+		<plugins>
+			<plugin>
+				<groupId>org.apache.maven.shared.dependency-analyzer.tests</groupId>
+				<artifactId>maven-mock-plugin</artifactId>
+				<version>1.0</version>
+				<executions>
+					<execution>
+						<goals>
+							<goal>mock-analyze</goal>
+						</goals>
+					</execution>
+				</executions>
+			</plugin>
+		</plugins>
+	</build>
+
 </project>
diff --git a/src/test/resources/jarWithNoDependencies/src/main/java/jarWithNoDependencies/Project.java b/src/it/jarWithNoDependencies/src/main/java/jarWithNoDependencies/Project.java
similarity index 100%
rename from src/test/resources/jarWithNoDependencies/src/main/java/jarWithNoDependencies/Project.java
rename to src/it/jarWithNoDependencies/src/main/java/jarWithNoDependencies/Project.java
diff --git a/src/test/resources/multimoduleProject/module2/src/main/java/bar/Main.java b/src/it/jarWithNoDependencies/verify.groovy
similarity index 76%
copy from src/test/resources/multimoduleProject/module2/src/main/java/bar/Main.java
copy to src/it/jarWithNoDependencies/verify.groovy
index be9a400..e545857 100644
--- a/src/test/resources/multimoduleProject/module2/src/main/java/bar/Main.java
+++ b/src/it/jarWithNoDependencies/verify.groovy
@@ -6,9 +6,9 @@
  * 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
@@ -16,9 +16,17 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package bar;
 
-public class Main
-{
-    public foo.Main dummy = null;
-}
+def analysis = new File( basedir, 'target/analysis.txt' ).text
+
+def expected = '''
+UsedDeclaredArtifacts:
+
+UsedUndeclaredArtifactsWithClasses:
+
+UnusedDeclaredArtifacts:
+
+TestArtifactsWithNonTestScope:
+'''
+
+assert analysis == expected
diff --git a/src/test/resources/jarWithRuntimeScopedTestDependency/pom.xml b/src/it/jarWithRuntimeScopedTestDependency/pom.xml
similarity index 100%
rename from src/test/resources/jarWithRuntimeScopedTestDependency/pom.xml
rename to src/it/jarWithRuntimeScopedTestDependency/pom.xml
diff --git a/src/test/resources/jarWithRuntimeScopedTestDependency/project1/pom.xml b/src/it/jarWithRuntimeScopedTestDependency/project1/pom.xml
similarity index 100%
rename from src/test/resources/jarWithRuntimeScopedTestDependency/project1/pom.xml
rename to src/it/jarWithRuntimeScopedTestDependency/project1/pom.xml
diff --git a/src/test/resources/jarWithCompileScopedTestDependency/project1/src/main/java/jarWithTestDependency/project1/Project1.java b/src/it/jarWithRuntimeScopedTestDependency/project1/src/main/java/jarWithTestDependency/project1/Project1.java
similarity index 100%
rename from src/test/resources/jarWithCompileScopedTestDependency/project1/src/main/java/jarWithTestDependency/project1/Project1.java
rename to src/it/jarWithRuntimeScopedTestDependency/project1/src/main/java/jarWithTestDependency/project1/Project1.java
diff --git a/src/test/resources/jarWithRuntimeScopedTestDependency/project2/pom.xml b/src/it/jarWithRuntimeScopedTestDependency/project2/pom.xml
similarity index 82%
rename from src/test/resources/jarWithRuntimeScopedTestDependency/project2/pom.xml
rename to src/it/jarWithRuntimeScopedTestDependency/project2/pom.xml
index bfe9fc2..538aacd 100644
--- a/src/test/resources/jarWithRuntimeScopedTestDependency/project2/pom.xml
+++ b/src/it/jarWithRuntimeScopedTestDependency/project2/pom.xml
@@ -30,18 +30,6 @@
   <packaging>jar</packaging>
   <version>1.0</version>
 
-  <build>
-    <pluginManagement>
-      <plugins>
-        <plugin>
-          <groupId>org.apache.maven.plugins</groupId>
-          <artifactId>maven-surefire-plugin</artifactId>
-          <version>2.3.1</version>
-        </plugin>
-      </plugins>
-    </pluginManagement>
-  </build>
-
   <dependencies>
     <dependency>
       <groupId>org.apache.maven.shared.dependency-analyzer.tests</groupId>
@@ -56,7 +44,23 @@
       <version>3.8.1</version>
       <scope>runtime</scope>
     </dependency>
-
   </dependencies>
 
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.shared.dependency-analyzer.tests</groupId>
+        <artifactId>maven-mock-plugin</artifactId>
+        <version>1.0</version>
+        <executions>
+          <execution>
+            <goals>
+              <goal>mock-analyze</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
+  </build>
+
 </project>
diff --git a/src/test/resources/jarWithTestDependency/project2/src/test/java/jarWithTestDependency/project2/Project2.java b/src/it/jarWithRuntimeScopedTestDependency/project2/src/test/java/jarWithTestDependency/project2/Project2.java
similarity index 100%
rename from src/test/resources/jarWithTestDependency/project2/src/test/java/jarWithTestDependency/project2/Project2.java
rename to src/it/jarWithRuntimeScopedTestDependency/project2/src/test/java/jarWithTestDependency/project2/Project2.java
diff --git a/src/test/resources/multimoduleProject/module1/src/main/java/foo/Main.java b/src/it/jarWithRuntimeScopedTestDependency/verify.groovy
similarity index 68%
copy from src/test/resources/multimoduleProject/module1/src/main/java/foo/Main.java
copy to src/it/jarWithRuntimeScopedTestDependency/verify.groovy
index 7ca91f7..1144c86 100644
--- a/src/test/resources/multimoduleProject/module1/src/main/java/foo/Main.java
+++ b/src/it/jarWithRuntimeScopedTestDependency/verify.groovy
@@ -6,9 +6,9 @@
  * 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
@@ -16,17 +16,19 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package foo;
 
-import org.apache.maven.artifact.Artifact;
-import org.apache.maven.artifact.repository.metadata.Metadata;
-import org.apache.maven.model.Model;
+def analysis = new File( basedir, 'project2/target/analysis.txt' ).text
 
-public class Main
-{
-    public static final String SCOPE_COMPILE = Artifact.SCOPE_COMPILE;
+def expected = '''
+UsedDeclaredArtifacts:
+ org.apache.maven.shared.dependency-analyzer.tests:jarWithRuntimeScopedTestDependency1:jar:1.0:test
+ junit:junit:jar:3.8.1:runtime
 
-    public Model model = null;
+UsedUndeclaredArtifactsWithClasses:
 
-    public Metadata metadata = null;
-}
+UnusedDeclaredArtifacts:
+
+TestArtifactsWithNonTestScope:
+'''
+
+assert analysis == expected
diff --git a/src/test/resources/jarWithTestDependency/pom.xml b/src/it/jarWithTestDependency/pom.xml
similarity index 100%
rename from src/test/resources/jarWithTestDependency/pom.xml
rename to src/it/jarWithTestDependency/pom.xml
diff --git a/src/test/resources/jarWithTestDependency/project1/pom.xml b/src/it/jarWithTestDependency/project1/pom.xml
similarity index 100%
rename from src/test/resources/jarWithTestDependency/project1/pom.xml
rename to src/it/jarWithTestDependency/project1/pom.xml
diff --git a/src/test/resources/jarWithTestDependency/project1/src/main/java/jarWithTestDependency/project1/Project1.java b/src/it/jarWithTestDependency/project1/src/main/java/jarWithTestDependency/project1/Project1.java
similarity index 100%
rename from src/test/resources/jarWithTestDependency/project1/src/main/java/jarWithTestDependency/project1/Project1.java
rename to src/it/jarWithTestDependency/project1/src/main/java/jarWithTestDependency/project1/Project1.java
diff --git a/src/test/resources/jarWithTestDependency/project2/pom.xml b/src/it/jarWithTestDependency/project2/pom.xml
similarity index 82%
rename from src/test/resources/jarWithTestDependency/project2/pom.xml
rename to src/it/jarWithTestDependency/project2/pom.xml
index aae3501..2575461 100644
--- a/src/test/resources/jarWithTestDependency/project2/pom.xml
+++ b/src/it/jarWithTestDependency/project2/pom.xml
@@ -29,18 +29,6 @@
 	<artifactId>jarWithTestDependency2</artifactId>
 	<packaging>jar</packaging>
 	<version>1.0</version>
-	
-	<build>
-		<pluginManagement>
-			<plugins>
-				<plugin>
-					<groupId>org.apache.maven.plugins</groupId>
-					<artifactId>maven-surefire-plugin</artifactId>
-					<version>2.3.1</version>
-				</plugin>
-			</plugins>
-		</pluginManagement>
-	</build>
 
 	<dependencies>
 		<dependency>
@@ -56,7 +44,23 @@
 			<version>3.8.1</version>
 			<scope>test</scope>
 		</dependency>
-		
-	</dependencies>	
-	
+	</dependencies>
+
+	<build>
+		<plugins>
+			<plugin>
+				<groupId>org.apache.maven.shared.dependency-analyzer.tests</groupId>
+				<artifactId>maven-mock-plugin</artifactId>
+				<version>1.0</version>
+				<executions>
+					<execution>
+						<goals>
+							<goal>mock-analyze</goal>
+						</goals>
+					</execution>
+				</executions>
+			</plugin>
+		</plugins>
+	</build>
+
 </project>
diff --git a/src/test/resources/jarWithRuntimeScopedTestDependency/project2/src/test/java/jarWithTestDependency/project2/Project2.java b/src/it/jarWithTestDependency/project2/src/test/java/jarWithTestDependency/project2/Project2.java
similarity index 100%
rename from src/test/resources/jarWithRuntimeScopedTestDependency/project2/src/test/java/jarWithTestDependency/project2/Project2.java
rename to src/it/jarWithTestDependency/project2/src/test/java/jarWithTestDependency/project2/Project2.java
diff --git a/src/test/resources/multimoduleProject/module1/src/main/java/foo/Main.java b/src/it/jarWithTestDependency/verify.groovy
similarity index 69%
copy from src/test/resources/multimoduleProject/module1/src/main/java/foo/Main.java
copy to src/it/jarWithTestDependency/verify.groovy
index 7ca91f7..18b3be2 100644
--- a/src/test/resources/multimoduleProject/module1/src/main/java/foo/Main.java
+++ b/src/it/jarWithTestDependency/verify.groovy
@@ -6,9 +6,9 @@
  * 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
@@ -16,17 +16,19 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package foo;
 
-import org.apache.maven.artifact.Artifact;
-import org.apache.maven.artifact.repository.metadata.Metadata;
-import org.apache.maven.model.Model;
+def analysis = new File( basedir, 'project2/target/analysis.txt' ).text
 
-public class Main
-{
-    public static final String SCOPE_COMPILE = Artifact.SCOPE_COMPILE;
+def expected = '''
+UsedDeclaredArtifacts:
+ org.apache.maven.shared.dependency-analyzer.tests:jarWithTestDependency1:jar:1.0:test
+ junit:junit:jar:3.8.1:test
 
-    public Model model = null;
+UsedUndeclaredArtifactsWithClasses:
 
-    public Metadata metadata = null;
-}
+UnusedDeclaredArtifacts:
+
+TestArtifactsWithNonTestScope:
+'''
+
+assert analysis == expected
diff --git a/src/test/resources/jarWithXmlTransitiveDependency/pom.xml b/src/it/jarWithXmlTransitiveDependency/pom.xml
similarity index 78%
rename from src/test/resources/jarWithXmlTransitiveDependency/pom.xml
rename to src/it/jarWithXmlTransitiveDependency/pom.xml
index 6d1c83a..db423a9 100644
--- a/src/test/resources/jarWithXmlTransitiveDependency/pom.xml
+++ b/src/it/jarWithXmlTransitiveDependency/pom.xml
@@ -38,4 +38,22 @@
       <version>1.6.1</version>
     </dependency>
   </dependencies>
+
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.shared.dependency-analyzer.tests</groupId>
+        <artifactId>maven-mock-plugin</artifactId>
+        <version>1.0</version>
+        <executions>
+          <execution>
+            <goals>
+              <goal>mock-analyze</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
+  </build>
+
 </project>
diff --git a/src/test/resources/jarWithXmlTransitiveDependency/src/main/java/jarWithXmlTransitiveDependency/Project.java b/src/it/jarWithXmlTransitiveDependency/src/main/java/jarWithXmlTransitiveDependency/Project.java
similarity index 100%
rename from src/test/resources/jarWithXmlTransitiveDependency/src/main/java/jarWithXmlTransitiveDependency/Project.java
rename to src/it/jarWithXmlTransitiveDependency/src/main/java/jarWithXmlTransitiveDependency/Project.java
diff --git a/src/test/resources/multimoduleProject/module1/src/main/java/foo/Main.java b/src/it/jarWithXmlTransitiveDependency/verify.groovy
similarity index 71%
copy from src/test/resources/multimoduleProject/module1/src/main/java/foo/Main.java
copy to src/it/jarWithXmlTransitiveDependency/verify.groovy
index 7ca91f7..4d7483a 100644
--- a/src/test/resources/multimoduleProject/module1/src/main/java/foo/Main.java
+++ b/src/it/jarWithXmlTransitiveDependency/verify.groovy
@@ -6,9 +6,9 @@
  * 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
@@ -16,17 +16,20 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package foo;
 
-import org.apache.maven.artifact.Artifact;
-import org.apache.maven.artifact.repository.metadata.Metadata;
-import org.apache.maven.model.Model;
+def analysis = new File( basedir, 'target/analysis.txt' ).text
 
-public class Main
-{
-    public static final String SCOPE_COMPILE = Artifact.SCOPE_COMPILE;
+def expected = '''
+UsedDeclaredArtifacts:
+ dom4j:dom4j:jar:1.6.1:compile
 
-    public Model model = null;
+UsedUndeclaredArtifactsWithClasses:
+ xml-apis:xml-apis:jar:1.0.b2:compile
+  org.xml.sax.Parser
 
-    public Metadata metadata = null;
-}
+UnusedDeclaredArtifacts:
+
+TestArtifactsWithNonTestScope:
+'''
+
+assert analysis == expected
diff --git a/src/test/resources/java8methodRefs/pom.xml b/src/it/java8methodRefs/pom.xml
similarity index 80%
rename from src/test/resources/java8methodRefs/pom.xml
rename to src/it/java8methodRefs/pom.xml
index 261e8f0..7516ba9 100644
--- a/src/test/resources/java8methodRefs/pom.xml
+++ b/src/it/java8methodRefs/pom.xml
@@ -47,13 +47,18 @@
     <build>
         <plugins>
             <plugin>
-                <groupId>org.apache.maven.plugins</groupId>
-                <artifactId>maven-compiler-plugin</artifactId>
-                <configuration>
-                    <source>1.8</source>
-                    <target>1.8</target>
-                </configuration>
+                <groupId>org.apache.maven.shared.dependency-analyzer.tests</groupId>
+                <artifactId>maven-mock-plugin</artifactId>
+                <version>1.0</version>
+                <executions>
+                    <execution>
+                        <goals>
+                            <goal>mock-analyze</goal>
+                        </goals>
+                    </execution>
+                </executions>
             </plugin>
         </plugins>
     </build>
+
 </project>
diff --git a/src/test/resources/java8methodRefs/src/main/java/inlinedStaticReference/Project.java b/src/it/java8methodRefs/src/main/java/inlinedStaticReference/Project.java
similarity index 100%
rename from src/test/resources/java8methodRefs/src/main/java/inlinedStaticReference/Project.java
rename to src/it/java8methodRefs/src/main/java/inlinedStaticReference/Project.java
diff --git a/src/test/resources/multimoduleProject/module2/src/main/java/bar/Main.java b/src/it/java8methodRefs/verify.groovy
similarity index 71%
copy from src/test/resources/multimoduleProject/module2/src/main/java/bar/Main.java
copy to src/it/java8methodRefs/verify.groovy
index be9a400..8fcd177 100644
--- a/src/test/resources/multimoduleProject/module2/src/main/java/bar/Main.java
+++ b/src/it/java8methodRefs/verify.groovy
@@ -6,9 +6,9 @@
  * 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
@@ -16,9 +16,19 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package bar;
 
-public class Main
-{
-    public foo.Main dummy = null;
-}
+def analysis = new File( basedir, 'target/analysis.txt' ).text
+
+def expected = '''
+UsedDeclaredArtifacts:
+ commons-io:commons-io:jar:2.4:compile
+ commons-lang:commons-lang:jar:2.6:compile
+
+UsedUndeclaredArtifactsWithClasses:
+
+UnusedDeclaredArtifacts:
+
+TestArtifactsWithNonTestScope:
+'''
+
+assert analysis == expected
diff --git a/src/test/resources/multimoduleProject/module1/pom.xml b/src/it/multimoduleProject/module1/pom.xml
similarity index 100%
rename from src/test/resources/multimoduleProject/module1/pom.xml
rename to src/it/multimoduleProject/module1/pom.xml
diff --git a/src/test/resources/multimoduleProject/module1/src/main/java/foo/Main.java b/src/it/multimoduleProject/module1/src/main/java/foo/Main.java
similarity index 100%
copy from src/test/resources/multimoduleProject/module1/src/main/java/foo/Main.java
copy to src/it/multimoduleProject/module1/src/main/java/foo/Main.java
diff --git a/src/test/resources/multimoduleProject/module2/pom.xml b/src/it/multimoduleProject/module2/pom.xml
similarity index 78%
rename from src/test/resources/multimoduleProject/module2/pom.xml
rename to src/it/multimoduleProject/module2/pom.xml
index 7a0e8c8..e73d685 100644
--- a/src/test/resources/multimoduleProject/module2/pom.xml
+++ b/src/it/multimoduleProject/module2/pom.xml
@@ -38,4 +38,22 @@
       <version>${project.version}</version>
     </dependency>
   </dependencies>
+
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.shared.dependency-analyzer.tests</groupId>
+        <artifactId>maven-mock-plugin</artifactId>
+        <version>1.0</version>
+        <executions>
+          <execution>
+            <goals>
+              <goal>mock-analyze</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
+  </build>
+
 </project>
diff --git a/src/test/resources/multimoduleProject/module2/src/main/java/bar/Main.java b/src/it/multimoduleProject/module2/src/main/java/bar/Main.java
similarity index 100%
copy from src/test/resources/multimoduleProject/module2/src/main/java/bar/Main.java
copy to src/it/multimoduleProject/module2/src/main/java/bar/Main.java
diff --git a/src/test/resources/multimoduleProject/pom.xml b/src/it/multimoduleProject/pom.xml
similarity index 93%
rename from src/test/resources/multimoduleProject/pom.xml
rename to src/it/multimoduleProject/pom.xml
index af2d351..06b8423 100644
--- a/src/test/resources/multimoduleProject/pom.xml
+++ b/src/it/multimoduleProject/pom.xml
@@ -33,10 +33,6 @@
     Test dependency:analyze on a multi-module project
   </description>
 
-  <properties>
-    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
-  </properties>
-  
   <modules>
     <module>module1</module>
     <module>module2</module>
diff --git a/src/test/resources/multimoduleProject/module2/src/main/java/bar/Main.java b/src/it/multimoduleProject/verify.groovy
similarity index 72%
copy from src/test/resources/multimoduleProject/module2/src/main/java/bar/Main.java
copy to src/it/multimoduleProject/verify.groovy
index be9a400..2463702 100644
--- a/src/test/resources/multimoduleProject/module2/src/main/java/bar/Main.java
+++ b/src/it/multimoduleProject/verify.groovy
@@ -6,9 +6,9 @@
  * 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
@@ -16,9 +16,18 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package bar;
 
-public class Main
-{
-    public foo.Main dummy = null;
-}
+def analysis = new File( basedir, 'module2/target/analysis.txt' ).text
+
+def expected = '''
+UsedDeclaredArtifacts:
+ org.apache.maven.its.dependency:test-module1:jar:1.0:compile
+
+UsedUndeclaredArtifactsWithClasses:
+
+UnusedDeclaredArtifacts:
+
+TestArtifactsWithNonTestScope:
+'''
+
+assert analysis == expected
diff --git a/src/test/resources/pom/pom.xml b/src/it/pom/pom.xml
similarity index 78%
rename from src/test/resources/pom/pom.xml
rename to src/it/pom/pom.xml
index a99afa0..403770a 100644
--- a/src/test/resources/pom/pom.xml
+++ b/src/it/pom/pom.xml
@@ -29,5 +29,21 @@
 	<artifactId>pom</artifactId>
 	<packaging>pom</packaging>
 	<version>1.0</version>
-	
+
+	<build>
+		<plugins>
+			<plugin>
+				<groupId>org.apache.maven.shared.dependency-analyzer.tests</groupId>
+				<artifactId>maven-mock-plugin</artifactId>
+				<version>1.0</version>
+				<executions>
+					<execution>
+						<goals>
+							<goal>mock-analyze</goal>
+						</goals>
+					</execution>
+				</executions>
+			</plugin>
+		</plugins>
+	</build>
 </project>
diff --git a/src/test/resources/multimoduleProject/module2/src/main/java/bar/Main.java b/src/it/pom/verify.groovy
similarity index 76%
copy from src/test/resources/multimoduleProject/module2/src/main/java/bar/Main.java
copy to src/it/pom/verify.groovy
index be9a400..e545857 100644
--- a/src/test/resources/multimoduleProject/module2/src/main/java/bar/Main.java
+++ b/src/it/pom/verify.groovy
@@ -6,9 +6,9 @@
  * 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
@@ -16,9 +16,17 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package bar;
 
-public class Main
-{
-    public foo.Main dummy = null;
-}
+def analysis = new File( basedir, 'target/analysis.txt' ).text
+
+def expected = '''
+UsedDeclaredArtifacts:
+
+UsedUndeclaredArtifactsWithClasses:
+
+UnusedDeclaredArtifacts:
+
+TestArtifactsWithNonTestScope:
+'''
+
+assert analysis == expected
diff --git a/src/it/settings.xml b/src/it/settings.xml
new file mode 100644
index 0000000..fee53c1
--- /dev/null
+++ b/src/it/settings.xml
@@ -0,0 +1,54 @@
+<?xml version="1.0"?>
+<!--
+* 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>
diff --git a/src/it/setup-mock-plugin/invoker.properties b/src/it/setup-mock-plugin/invoker.properties
new file mode 100644
index 0000000..d5d6ca5
--- /dev/null
+++ b/src/it/setup-mock-plugin/invoker.properties
@@ -0,0 +1,18 @@
+# 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.
+
+invoker.goals = install
diff --git a/src/it/setup-mock-plugin/pom.xml b/src/it/setup-mock-plugin/pom.xml
new file mode 100644
index 0000000..467795f
--- /dev/null
+++ b/src/it/setup-mock-plugin/pom.xml
@@ -0,0 +1,73 @@
+<?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.shared.dependency-analyzer.tests</groupId>
+  <artifactId>maven-mock-plugin</artifactId>
+  <packaging>maven-plugin</packaging>
+  <version>1.0</version>
+
+  <dependencies>
+    <dependency>
+      <groupId>javax.inject</groupId>
+      <artifactId>javax.inject</artifactId>
+      <version>1</version>
+      <scope>provided</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.maven</groupId>
+      <artifactId>maven-core</artifactId>
+      <version>3.2.5</version>
+      <scope>provided</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.maven</groupId>
+      <artifactId>maven-plugin-api</artifactId>
+      <version>3.2.5</version>
+      <scope>provided</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.maven.plugin-tools</groupId>
+      <artifactId>maven-plugin-tools-annotations</artifactId>
+      <version>3.6.4</version>
+      <scope>provided</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.maven.shared</groupId>
+      <artifactId>maven-dependency-analyzer</artifactId>
+      <version>@project.version@</version>
+    </dependency>
+  </dependencies>
+
+  <build>
+    <pluginManagement>
+      <plugins>
+        <plugin>
+          <groupId>org.apache.maven.plugins</groupId>
+          <artifactId>maven-plugin-plugin</artifactId>
+          <version>3.6.4</version>
+        </plugin>
+      </plugins>
+    </pluginManagement>
+  </build>
+
+</project>
diff --git a/src/it/setup-mock-plugin/src/main/java/it/test/MockAnalyzeMojo.java b/src/it/setup-mock-plugin/src/main/java/it/test/MockAnalyzeMojo.java
new file mode 100644
index 0000000..e76adeb
--- /dev/null
+++ b/src/it/setup-mock-plugin/src/main/java/it/test/MockAnalyzeMojo.java
@@ -0,0 +1,104 @@
+package it.test;
+/*
+ * 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.
+ */
+
+import javax.inject.Inject;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.PrintWriter;
+import java.nio.file.Files;
+
+import org.apache.maven.plugin.AbstractMojo;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugin.MojoFailureException;
+import org.apache.maven.plugins.annotations.LifecyclePhase;
+import org.apache.maven.plugins.annotations.Mojo;
+import org.apache.maven.plugins.annotations.Parameter;
+import org.apache.maven.plugins.annotations.ResolutionScope;
+import org.apache.maven.project.MavenProject;
+import org.apache.maven.shared.dependency.analyzer.ProjectDependencyAnalysis;
+import org.apache.maven.shared.dependency.analyzer.ProjectDependencyAnalyzer;
+
+@Mojo( name = "mock-analyze", requiresDependencyResolution = ResolutionScope.TEST,
+       defaultPhase = LifecyclePhase.VERIFY )
+public class MockAnalyzeMojo extends AbstractMojo
+{
+    class UnixPrintWiter extends PrintWriter
+    {
+        public UnixPrintWiter( File file ) throws FileNotFoundException
+        {
+            super( file );
+        }
+
+        @Override
+        public void println()
+        {
+            write( '\n' );
+        }
+    }
+
+    @Inject
+    private ProjectDependencyAnalyzer analyzer;
+
+    @Inject
+    private MavenProject project;
+
+    @Parameter( defaultValue = "${project.build.directory}/analysis.txt", readonly = true )
+    private File output;
+
+    @Override
+    public void execute() throws MojoExecutionException, MojoFailureException
+    {
+        try
+        {
+            ProjectDependencyAnalysis analysis = analyzer.analyze( project );
+
+            Files.createDirectories( output.toPath().getParent() );
+            try ( PrintWriter printWriter = new UnixPrintWiter( output ) )
+            {
+                printWriter.println();
+
+                printWriter.println("UsedDeclaredArtifacts:");
+                analysis.getUsedDeclaredArtifacts().forEach( a -> printWriter.println( " " + a ) );
+                printWriter.println();
+
+                printWriter.println("UsedUndeclaredArtifactsWithClasses:");
+                analysis.getUsedUndeclaredArtifactsWithClasses().forEach( (a, c) -> {
+                    printWriter.println( " " + a );
+                    c.forEach( i -> printWriter.println( "  " + i ) );
+                } );
+                printWriter.println();
+
+                printWriter.println("UnusedDeclaredArtifacts:");
+                analysis.getUnusedDeclaredArtifacts().forEach( a -> printWriter.println( " " + a ) );
+                printWriter.println();
+
+                printWriter.println("TestArtifactsWithNonTestScope:");
+                analysis.getTestArtifactsWithNonTestScope().forEach( a -> printWriter.println( " " + a ) );
+            }
+        }
+        catch ( Exception e )
+        {
+            throw new MojoExecutionException("analyze failed", e);
+        }
+
+        getLog().info( "Analyze done" );
+    }
+}
diff --git a/src/test/resources/typeUseAnnotationDependency/annotation/pom.xml b/src/it/typeUseAnnotationDependency/annotation/pom.xml
similarity index 100%
rename from src/test/resources/typeUseAnnotationDependency/annotation/pom.xml
rename to src/it/typeUseAnnotationDependency/annotation/pom.xml
diff --git a/src/test/resources/typeUseAnnotationDependency/annotation/src/main/java/typeUseAnnotationDependency/annotation/Annotation.java b/src/it/typeUseAnnotationDependency/annotation/src/main/java/typeUseAnnotationDependency/annotation/Annotation.java
similarity index 100%
rename from src/test/resources/typeUseAnnotationDependency/annotation/src/main/java/typeUseAnnotationDependency/annotation/Annotation.java
rename to src/it/typeUseAnnotationDependency/annotation/src/main/java/typeUseAnnotationDependency/annotation/Annotation.java
diff --git a/src/test/resources/typeUseAnnotationDependency/pom.xml b/src/it/typeUseAnnotationDependency/pom.xml
similarity index 100%
rename from src/test/resources/typeUseAnnotationDependency/pom.xml
rename to src/it/typeUseAnnotationDependency/pom.xml
diff --git a/src/test/resources/typeUseAnnotationDependency/usage/pom.xml b/src/it/typeUseAnnotationDependency/usage/pom.xml
similarity index 81%
rename from src/test/resources/typeUseAnnotationDependency/usage/pom.xml
rename to src/it/typeUseAnnotationDependency/usage/pom.xml
index 6c46e6b..a2479a1 100644
--- a/src/test/resources/typeUseAnnotationDependency/usage/pom.xml
+++ b/src/it/typeUseAnnotationDependency/usage/pom.xml
@@ -37,4 +37,22 @@
 			<version>1.0</version>
 		</dependency>
 	</dependencies>
+
+	<build>
+		<plugins>
+			<plugin>
+				<groupId>org.apache.maven.shared.dependency-analyzer.tests</groupId>
+				<artifactId>maven-mock-plugin</artifactId>
+				<version>1.0</version>
+				<executions>
+					<execution>
+						<goals>
+							<goal>mock-analyze</goal>
+						</goals>
+					</execution>
+				</executions>
+			</plugin>
+		</plugins>
+	</build>
+
 </project>
diff --git a/src/test/resources/typeUseAnnotationDependency/usage/src/main/java/typeUseAnnotationDependency/usage/Usage.java b/src/it/typeUseAnnotationDependency/usage/src/main/java/typeUseAnnotationDependency/usage/Usage.java
similarity index 100%
rename from src/test/resources/typeUseAnnotationDependency/usage/src/main/java/typeUseAnnotationDependency/usage/Usage.java
rename to src/it/typeUseAnnotationDependency/usage/src/main/java/typeUseAnnotationDependency/usage/Usage.java
diff --git a/src/test/resources/typeUseAnnotationDependency/usageLocalVar/pom.xml b/src/it/typeUseAnnotationDependency/usageLocalVar/pom.xml
similarity index 81%
rename from src/test/resources/typeUseAnnotationDependency/usageLocalVar/pom.xml
rename to src/it/typeUseAnnotationDependency/usageLocalVar/pom.xml
index 26f42b7..161c6c8 100644
--- a/src/test/resources/typeUseAnnotationDependency/usageLocalVar/pom.xml
+++ b/src/it/typeUseAnnotationDependency/usageLocalVar/pom.xml
@@ -37,4 +37,22 @@
 			<version>1.0</version>
 		</dependency>
 	</dependencies>
+
+	<build>
+		<plugins>
+			<plugin>
+				<groupId>org.apache.maven.shared.dependency-analyzer.tests</groupId>
+				<artifactId>maven-mock-plugin</artifactId>
+				<version>1.0</version>
+				<executions>
+					<execution>
+						<goals>
+							<goal>mock-analyze</goal>
+						</goals>
+					</execution>
+				</executions>
+			</plugin>
+		</plugins>
+	</build>
+
 </project>
diff --git a/src/test/resources/typeUseAnnotationDependency/usageLocalVar/src/main/java/typeUseAnnotationDependency/usageLocalVar/UsageLocalVar.java b/src/it/typeUseAnnotationDependency/usageLocalVar/src/main/java/typeUseAnnotationDependency/usageLocalVar/UsageLocalVar.java
similarity index 100%
rename from src/test/resources/typeUseAnnotationDependency/usageLocalVar/src/main/java/typeUseAnnotationDependency/usageLocalVar/UsageLocalVar.java
rename to src/it/typeUseAnnotationDependency/usageLocalVar/src/main/java/typeUseAnnotationDependency/usageLocalVar/UsageLocalVar.java
diff --git a/src/test/resources/multimoduleProject/module1/src/main/java/foo/Main.java b/src/it/typeUseAnnotationDependency/verify.groovy
similarity index 50%
copy from src/test/resources/multimoduleProject/module1/src/main/java/foo/Main.java
copy to src/it/typeUseAnnotationDependency/verify.groovy
index 7ca91f7..1b372f6 100644
--- a/src/test/resources/multimoduleProject/module1/src/main/java/foo/Main.java
+++ b/src/it/typeUseAnnotationDependency/verify.groovy
@@ -6,9 +6,9 @@
  * 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
@@ -16,17 +16,35 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package foo;
 
-import org.apache.maven.artifact.Artifact;
-import org.apache.maven.artifact.repository.metadata.Metadata;
-import org.apache.maven.model.Model;
+def analysisUsage = new File( basedir, 'usage/target/analysis.txt' ).text
 
-public class Main
-{
-    public static final String SCOPE_COMPILE = Artifact.SCOPE_COMPILE;
+def expectedUsage = '''
+UsedDeclaredArtifacts:
+ org.apache.maven.shared.dependency-analyzer.tests:typeUseAnnotationDependencyAnnotation:jar:1.0:compile
+
+UsedUndeclaredArtifactsWithClasses:
+
+UnusedDeclaredArtifacts:
+
+TestArtifactsWithNonTestScope:
+'''
+
+assert analysisUsage == expectedUsage
+
+def analysisUsageLocalVar = new File( basedir, 'usageLocalVar/target/analysis.txt' ).text
+
+def expectedUsageLocalVar = '''
+UsedDeclaredArtifacts:
+ org.apache.maven.shared.dependency-analyzer.tests:typeUseAnnotationDependencyAnnotation:jar:1.0:compile
+
+UsedUndeclaredArtifactsWithClasses:
+
+UnusedDeclaredArtifacts:
+
+TestArtifactsWithNonTestScope:
+'''
+
+assert analysisUsageLocalVar == expectedUsageLocalVar
 
-    public Model model = null;
 
-    public Metadata metadata = null;
-}
diff --git a/src/test/resources/unnamedPackageClassReference/pom.xml b/src/it/unnamedPackageClassReference/pom.xml
similarity index 78%
rename from src/test/resources/unnamedPackageClassReference/pom.xml
rename to src/it/unnamedPackageClassReference/pom.xml
index bd79056..73fc4a3 100644
--- a/src/test/resources/unnamedPackageClassReference/pom.xml
+++ b/src/it/unnamedPackageClassReference/pom.xml
@@ -38,4 +38,22 @@
       <version>2.1.8</version>
     </dependency>
   </dependencies>
+
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.shared.dependency-analyzer.tests</groupId>
+        <artifactId>maven-mock-plugin</artifactId>
+        <version>1.0</version>
+        <executions>
+          <execution>
+            <goals>
+              <goal>mock-analyze</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
+  </build>
+
 </project>
diff --git a/src/test/resources/unnamedPackageClassReference/src/main/java/unnamedPackageClassReference/Project.java b/src/it/unnamedPackageClassReference/src/main/java/unnamedPackageClassReference/Project.java
similarity index 100%
rename from src/test/resources/unnamedPackageClassReference/src/main/java/unnamedPackageClassReference/Project.java
rename to src/it/unnamedPackageClassReference/src/main/java/unnamedPackageClassReference/Project.java
diff --git a/src/test/resources/multimoduleProject/module2/src/main/java/bar/Main.java b/src/it/unnamedPackageClassReference/verify.groovy
similarity index 74%
rename from src/test/resources/multimoduleProject/module2/src/main/java/bar/Main.java
rename to src/it/unnamedPackageClassReference/verify.groovy
index be9a400..c55639a 100644
--- a/src/test/resources/multimoduleProject/module2/src/main/java/bar/Main.java
+++ b/src/it/unnamedPackageClassReference/verify.groovy
@@ -6,9 +6,9 @@
  * 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
@@ -16,9 +16,18 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package bar;
 
-public class Main
-{
-    public foo.Main dummy = null;
-}
+def analysis = new File( basedir, 'target/analysis.txt' ).text
+
+def expected = '''
+UsedDeclaredArtifacts:
+
+UsedUndeclaredArtifactsWithClasses:
+
+UnusedDeclaredArtifacts:
+ dnsjava:dnsjava:jar:2.1.8:compile
+
+TestArtifactsWithNonTestScope:
+'''
+
+assert analysis == expected
diff --git a/src/test/resources/usedUndeclaredReference/pom.xml b/src/it/usedUndeclaredReference/pom.xml
similarity index 78%
rename from src/test/resources/usedUndeclaredReference/pom.xml
rename to src/it/usedUndeclaredReference/pom.xml
index 2a8e652..996addf 100644
--- a/src/test/resources/usedUndeclaredReference/pom.xml
+++ b/src/it/usedUndeclaredReference/pom.xml
@@ -38,4 +38,22 @@
       <version>1.6.1</version>
     </dependency>
   </dependencies>
+
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.shared.dependency-analyzer.tests</groupId>
+        <artifactId>maven-mock-plugin</artifactId>
+        <version>1.0</version>
+        <executions>
+          <execution>
+            <goals>
+              <goal>mock-analyze</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
+  </build>
+
 </project>
diff --git a/src/test/resources/usedUndeclaredReference/src/main/java/usedUndeclaredReference/Project.java b/src/it/usedUndeclaredReference/src/main/java/usedUndeclaredReference/Project.java
similarity index 100%
rename from src/test/resources/usedUndeclaredReference/src/main/java/usedUndeclaredReference/Project.java
rename to src/it/usedUndeclaredReference/src/main/java/usedUndeclaredReference/Project.java
diff --git a/src/test/resources/multimoduleProject/module1/src/main/java/foo/Main.java b/src/it/usedUndeclaredReference/verify.groovy
similarity index 70%
rename from src/test/resources/multimoduleProject/module1/src/main/java/foo/Main.java
rename to src/it/usedUndeclaredReference/verify.groovy
index 7ca91f7..ea59292 100644
--- a/src/test/resources/multimoduleProject/module1/src/main/java/foo/Main.java
+++ b/src/it/usedUndeclaredReference/verify.groovy
@@ -6,9 +6,9 @@
  * 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
@@ -16,17 +16,20 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package foo;
 
-import org.apache.maven.artifact.Artifact;
-import org.apache.maven.artifact.repository.metadata.Metadata;
-import org.apache.maven.model.Model;
+def analysis = new File( basedir, 'target/analysis.txt' ).text
 
-public class Main
-{
-    public static final String SCOPE_COMPILE = Artifact.SCOPE_COMPILE;
+def expected = '''
+UsedDeclaredArtifacts:
 
-    public Model model = null;
+UsedUndeclaredArtifactsWithClasses:
+ xml-apis:xml-apis:jar:1.0.b2:compile
+  org.apache.xmlcommons.Version
 
-    public Metadata metadata = null;
-}
+UnusedDeclaredArtifacts:
+ dom4j:dom4j:jar:1.6.1:compile
+
+TestArtifactsWithNonTestScope:
+'''
+
+assert analysis == expected
diff --git a/src/test/java/org/apache/maven/shared/dependency/analyzer/DefaultProjectDependencyAnalyzerTest.java b/src/test/java/org/apache/maven/shared/dependency/analyzer/DefaultProjectDependencyAnalyzerTest.java
deleted file mode 100644
index ca615aa..0000000
--- a/src/test/java/org/apache/maven/shared/dependency/analyzer/DefaultProjectDependencyAnalyzerTest.java
+++ /dev/null
@@ -1,499 +0,0 @@
-package org.apache.maven.shared.dependency.analyzer;
-/*
- * 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.
- */
-
-import org.apache.maven.artifact.Artifact;
-import org.apache.maven.artifact.DefaultArtifact;
-import org.apache.maven.artifact.handler.ArtifactHandler;
-import org.apache.maven.artifact.handler.DefaultArtifactHandler;
-import org.apache.maven.artifact.versioning.VersionRange;
-import org.apache.maven.project.MavenProject;
-import org.apache.maven.shared.invoker.InvocationRequest;
-import org.apache.maven.shared.invoker.InvocationResult;
-import org.apache.maven.shared.test.plugin.BuildTool;
-import org.apache.maven.shared.test.plugin.ProjectTool;
-import org.apache.maven.shared.test.plugin.TestToolsException;
-import org.codehaus.plexus.PlexusTestCase;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.JUnit4;
-
-import java.io.File;
-import java.nio.file.Files;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Properties;
-import java.util.Set;
-
-/**
- * Tests <code>DefaultProjectDependencyAnalyzer</code>.
- *
- * @author <a href="mailto:markhobson@gmail.com">Mark Hobson</a>
- * @see DefaultProjectDependencyAnalyzer
- */
-@RunWith( JUnit4.class )
-public class DefaultProjectDependencyAnalyzerTest
-    extends PlexusTestCase
-{
-    private BuildTool buildTool;
-
-    private ProjectTool projectTool;
-
-    private ProjectDependencyAnalyzer analyzer;
-
-    private static File localRepo;
-
-    /*
-     * @see org.codehaus.plexus.PlexusTestCase#setUp()
-     */
-    @Before
-    public void setUp()
-        throws Exception
-    {
-        super.setUp();
-
-        buildTool = (BuildTool) lookup( BuildTool.ROLE );
-
-        projectTool = (ProjectTool) lookup( ProjectTool.ROLE );
-
-        if ( localRepo == null )
-        {
-            localRepo = new File( System.getProperty( "local.repo" ) );
-            if ( !localRepo.isDirectory() )
-            {
-                Files.createDirectories( localRepo.toPath() );
-            }
-            System.out.println( "Local repository: " + localRepo );
-        }
-
-        analyzer = (ProjectDependencyAnalyzer) lookup( ProjectDependencyAnalyzer.class.getName() );
-    }
-
-    @Test
-    public void testPom()
-        throws TestToolsException, ProjectDependencyAnalyzerException
-    {
-        compileProject( "pom/pom.xml" );
-
-        MavenProject project = getProject( "pom/pom.xml" );
-
-        ProjectDependencyAnalysis actualAnalysis = analyzer.analyze( project );
-
-        ProjectDependencyAnalysis expectedAnalysis = new ProjectDependencyAnalysis();
-
-        assertEquals( expectedAnalysis, actualAnalysis );
-    }
-
-    @Test
-    public void testJarWithNoDependencies()
-        throws TestToolsException, ProjectDependencyAnalyzerException
-    {
-        compileProject( "jarWithNoDependencies/pom.xml" );
-
-        MavenProject project = getProject( "jarWithNoDependencies/pom.xml" );
-
-        ProjectDependencyAnalysis actualAnalysis = analyzer.analyze( project );
-
-        ProjectDependencyAnalysis expectedAnalysis = new ProjectDependencyAnalysis();
-
-        assertEquals( expectedAnalysis, actualAnalysis );
-    }
-
-    @Test
-    public void testJava8methodRefs()
-        throws TestToolsException, ProjectDependencyAnalyzerException
-    {
-        // Only visible through constant pool analysis (supported for JDK8+)
-        compileProject( "java8methodRefs/pom.xml" );
-
-        MavenProject project = getProject( "java8methodRefs/pom.xml" );
-
-        ProjectDependencyAnalysis actualAnalysis = analyzer.analyze( project );
-
-        Artifact project1 = createArtifact( "commons-io", "commons-io", "jar", "2.4", "compile" );
-        Artifact project2 = createArtifact( "commons-lang", "commons-lang", "jar", "2.6", "compile" );
-        Set<Artifact> usedDeclaredArtifacts = new HashSet<>( Arrays.asList( project1, project2 ) );
-
-        ProjectDependencyAnalysis expectedAnalysis =
-            new ProjectDependencyAnalysis( usedDeclaredArtifacts, new HashSet<>(), new HashSet<>(),
-                    new HashSet<>() );
-
-        assertEquals( expectedAnalysis, actualAnalysis );
-    }
-
-    @Test
-    public void testInlinedStaticReference()
-        throws TestToolsException, ProjectDependencyAnalyzerException
-    {
-        // Only visible through constant pool analysis (supported for JDK8+)
-        compileProject( "inlinedStaticReference/pom.xml" );
-
-        MavenProject project = getProject( "inlinedStaticReference/pom.xml" );
-
-        ProjectDependencyAnalysis actualAnalysis = analyzer.analyze( project );
-
-        Artifact project1 = createArtifact( "dom4j", "dom4j", "jar", "1.6.1", "compile" );
-        Set<Artifact> usedDeclaredArtifacts = Collections.singleton( project1 );
-
-        ProjectDependencyAnalysis expectedAnalysis =
-            new ProjectDependencyAnalysis( usedDeclaredArtifacts, new HashSet<>(), new HashSet<>(),
-                    new HashSet<>() );
-
-        assertEquals( expectedAnalysis, actualAnalysis );
-    }
-
-    @Test
-    public void testJarWithCompileDependency()
-        throws TestToolsException, ProjectDependencyAnalyzerException
-    {
-        compileProject( "jarWithCompileDependency/pom.xml" );
-
-        MavenProject project2 = getProject( "jarWithCompileDependency/project2/pom.xml" );
-
-        if ( project2.getBuild().getOutputDirectory().contains( "${" ) )
-        {
-            // if Maven version used as dependency is upgraded to >= 2.2.0
-            throw new TestToolsException( "output directory was not interpolated: "
-                + project2.getBuild().getOutputDirectory() );
-        }
-
-        ProjectDependencyAnalysis actualAnalysis = analyzer.analyze( project2 );
-        
-        assertTrue( "Incorrectly classified Guava as testonly",
-                   actualAnalysis.getTestArtifactsWithNonTestScope().isEmpty() );
-
-        Artifact project1 = createArtifact( "org.apache.maven.shared.dependency-analyzer.tests",
-                                            "jarWithCompileDependency1", "jar", "1.0", "compile" );
-        Artifact guava = createArtifact( "com.google.guava", "guava", "jar", "30.1.1-android", "compile" );
-        Set<Artifact> usedDeclaredArtifacts = new HashSet<>( Arrays.asList( project1, guava ) );
-        ProjectDependencyAnalysis expectedAnalysis = new ProjectDependencyAnalysis( usedDeclaredArtifacts, (Set<Artifact>) null, null,
-                null );
-
-        assertEquals( expectedAnalysis, actualAnalysis );
-    }
-
-    @Test
-    public void testForceDeclaredDependenciesUsage()
-        throws TestToolsException, ProjectDependencyAnalyzerException
-    {
-        compileProject( "jarWithTestDependency/pom.xml" );
-
-        MavenProject project2 = getProject( "jarWithTestDependency/project2/pom.xml" );
-
-        ProjectDependencyAnalysis analysis = analyzer.analyze( project2 );
-
-        try
-        {
-            analysis.forceDeclaredDependenciesUsage( new String[] {
-                "org.apache.maven.shared.dependency-analyzer.tests:jarWithTestDependency1" } );
-            fail( "failure expected since junit dependency is declared-used" );
-        }
-        catch ( ProjectDependencyAnalyzerException pdae )
-        {
-            assertTrue( pdae.getMessage().contains( "Trying to force use of dependencies which are "
-                + "declared but already detected as used: "
-                + "[org.apache.maven.shared.dependency-analyzer.tests:jarWithTestDependency1]" ) );
-        }
-
-        try
-        {
-            analysis.forceDeclaredDependenciesUsage( new String[] { "undefined:undefined" } );
-            fail( "failure expected since undefined dependency is not declared" );
-        }
-        catch ( ProjectDependencyAnalyzerException pdae )
-        {
-            assertTrue( pdae.getMessage().contains( "Trying to force use of dependencies which are "
-                + "not declared: [undefined:undefined]" ) );
-        }
-    }
-
-    @Test
-    public void testJarWithTestDependency()
-        throws TestToolsException, ProjectDependencyAnalyzerException
-    {
-        compileProject( "jarWithTestDependency/pom.xml" );
-
-        MavenProject project2 = getProject( "jarWithTestDependency/project2/pom.xml" );
-
-        ProjectDependencyAnalysis actualAnalysis = analyzer.analyze( project2 );
-        
-        Artifact project1 = createArtifact( "org.apache.maven.shared.dependency-analyzer.tests",
-                                            "jarWithTestDependency1", "jar", "1.0", "test" );
-        Artifact junit = createArtifact( "junit", "junit", "jar", "3.8.1", "test" );
-
-        Set<Artifact> usedDeclaredArtifacts = new HashSet<>( Arrays.asList( project1, junit ) );
-        ProjectDependencyAnalysis expectedAnalysis = new ProjectDependencyAnalysis( usedDeclaredArtifacts, (Set<Artifact>) null, null, null );
-
-        assertEquals( expectedAnalysis, actualAnalysis );
-    }
-
-    @Test
-    public void testJarWithXmlTransitiveDependency()
-        throws TestToolsException, ProjectDependencyAnalyzerException
-    {
-        compileProject( "jarWithXmlTransitiveDependency/pom.xml" );
-
-        MavenProject project = getProject( "jarWithXmlTransitiveDependency/pom.xml" );
-
-        ProjectDependencyAnalysis actualAnalysis = analyzer.analyze( project );
-
-        Artifact jdom = createArtifact( "dom4j", "dom4j", "jar", "1.6.1", "compile" );
-        Set<Artifact> usedDeclaredArtifacts = Collections.singleton( jdom );
-
-        ProjectDependencyAnalysis expectedAnalysis = new ProjectDependencyAnalysis( usedDeclaredArtifacts, (Set<Artifact>) null, null,
-                null );
-
-        // MSHARED-47: usedUndeclaredArtifacts=[xml-apis:xml-apis:jar:1.0.b2:compile]
-        // assertEquals( expectedAnalysis, actualAnalysis );
-    }
-
-    @Test
-    public void testJarWithCompileScopedTestDependency()
-            throws TestToolsException, ProjectDependencyAnalyzerException
-    {
-        compileProject( "jarWithCompileScopedTestDependency/pom.xml" );
-
-        MavenProject project2 = getProject( "jarWithCompileScopedTestDependency/project2/pom.xml" );
-
-        ProjectDependencyAnalysis actualAnalysis = analyzer.analyze( project2 );
-
-        Artifact artifact1 = createArtifact( "org.apache.maven.shared.dependency-analyzer.tests",
-                "jarWithCompileScopedTestDependency1", "jar", "1.0", "test" );
-        Artifact junit = createArtifact( "junit", "junit", "jar", "3.8.1", "compile" );
-
-        Set<Artifact> usedDeclaredArtifacts = new HashSet<>( Arrays.asList( artifact1, junit ) );
-        Set<Artifact> nonTestScopedTestArtifacts = Collections.singleton( junit );
-        ProjectDependencyAnalysis expectedAnalysis = new ProjectDependencyAnalysis( usedDeclaredArtifacts, (Set<Artifact>) null, null,
-                nonTestScopedTestArtifacts );
-
-        assertEquals( expectedAnalysis, actualAnalysis );
-    }
-
-    @Test
-    public void testJarWithRuntimeScopedTestDependency() throws TestToolsException, ProjectDependencyAnalyzerException
-    {
-        // We can't effectively analyze runtime dependencies at this time
-        compileProject( "jarWithRuntimeScopedTestDependency/pom.xml" );
-
-        MavenProject project2 = getProject( "jarWithRuntimeScopedTestDependency/project2/pom.xml" );
-
-        ProjectDependencyAnalysis actualAnalysis = analyzer.analyze( project2 );
-
-        Artifact artifact1 = createArtifact( "org.apache.maven.shared.dependency-analyzer.tests",
-                "jarWithRuntimeScopedTestDependency1", "jar", "1.0", "test" );
-        Artifact junit = createArtifact( "junit", "junit", "jar", "3.8.1", "runtime" );
-
-        Set<Artifact> usedDeclaredArtifacts = new HashSet<>( Arrays.asList( artifact1, junit ) );
-        ProjectDependencyAnalysis expectedAnalysis = new ProjectDependencyAnalysis( usedDeclaredArtifacts, (Set<Artifact>) null, null,
-                null );
-
-        assertEquals( expectedAnalysis, actualAnalysis );
-    }
-
-    @Test
-    public void testMultimoduleProject()
-        throws TestToolsException, ProjectDependencyAnalyzerException
-    {
-        compileProject( "multimoduleProject/pom.xml" );
-
-        // difficult to create multi-module project with Maven 2.x, so here's hacky solution
-        // to get a inter-module dependency
-        MavenProject project = getProject( "multimoduleProject/module2/pom.xml" );
-        @SuppressWarnings( "unchecked" )
-        Set<Artifact> dependencyArtifacts = project.getArtifacts();
-        for ( Artifact artifact : dependencyArtifacts )
-        {
-            if ( artifact.getArtifactId().equals( "test-module1" ) )
-            {
-                File dir = getTestFile( "target/test-classes/", "multimoduleProject/module1/target/classes/" );
-                artifact.setFile( dir );
-            }
-        }
-
-        ProjectDependencyAnalysis actualAnalysis = analyzer.analyze( project );
-
-        Artifact junit = createArtifact( "org.apache.maven.its.dependency", "test-module1", "jar", "1.0", "compile" );
-        Set<Artifact> usedDeclaredArtifacts = Collections.singleton( junit );
-
-        ProjectDependencyAnalysis expectedAnalysis = new ProjectDependencyAnalysis( usedDeclaredArtifacts, (Set<Artifact>) null, null,
-                null );
-
-        assertEquals( expectedAnalysis, actualAnalysis );
-    }
-
-    @Test
-    public void testTypeUseAnnotationDependency()
-            throws TestToolsException, ProjectDependencyAnalyzerException
-    {
-        Properties properties = new Properties();
-        properties.put( "maven.compiler.source", "1.8" );
-        properties.put( "maven.compiler.target", "1.8" );
-        compileProject( "typeUseAnnotationDependency/pom.xml", properties);
-
-        MavenProject usage = getProject( "typeUseAnnotationDependency/usage/pom.xml" );
-
-        ProjectDependencyAnalysis actualAnalysis = analyzer.analyze( usage );
-
-        Artifact annotation = createArtifact( "org.apache.maven.shared.dependency-analyzer.tests",
-                                            "typeUseAnnotationDependencyAnnotation", "jar", "1.0", "compile" );
-        Set<Artifact> usedDeclaredArtifacts = Collections.singleton( annotation );
-        ProjectDependencyAnalysis expectedAnalysis = new ProjectDependencyAnalysis(usedDeclaredArtifacts, (Set<Artifact>) null, null,
-                null );
-
-        assertEquals( expectedAnalysis, actualAnalysis );
-    }
-
-    @Test
-    public void testTypeUseAnnotationDependencyOnLocalVariable()
-            throws TestToolsException, ProjectDependencyAnalyzerException
-    {
-        Properties properties = new Properties();
-        properties.put( "maven.compiler.source", "1.8" );
-        properties.put( "maven.compiler.target", "1.8" );
-        compileProject( "typeUseAnnotationDependency/pom.xml", properties);
-
-        MavenProject usage = getProject( "typeUseAnnotationDependency/usageLocalVar/pom.xml" );
-
-        ProjectDependencyAnalysis actualAnalysis = analyzer.analyze( usage );
-
-        Artifact annotation = createArtifact( "org.apache.maven.shared.dependency-analyzer.tests",
-                                            "typeUseAnnotationDependencyAnnotation", "jar", "1.0", "compile" );
-        Set<Artifact> usedDeclaredArtifacts = Collections.singleton( annotation );
-        ProjectDependencyAnalysis expectedAnalysis = new ProjectDependencyAnalysis(usedDeclaredArtifacts, (Set<Artifact>) null, null,
-                null);
-
-        assertEquals( expectedAnalysis, actualAnalysis );
-    }
-
-    @Test
-    public void testUnnamedPackageClassReference()
-        throws TestToolsException, ProjectDependencyAnalyzerException
-    {
-        // Only visible through constant pool analysis (supported for JDK8+)
-        compileProject( "unnamedPackageClassReference/pom.xml" );
-
-        MavenProject project = getProject( "unnamedPackageClassReference/pom.xml" );
-
-        ProjectDependencyAnalysis actualAnalysis = analyzer.analyze( project );
-
-        Artifact dnsjava = createArtifact( "dnsjava", "dnsjava", "jar", "2.1.8", "compile" );
-        // we don't use any dnsjava classes so this should show up as an unused dep
-        Set<Artifact> unusedDeclaredArtifacts = Collections.singleton( dnsjava );
-
-        ProjectDependencyAnalysis expectedAnalysis =
-            new ProjectDependencyAnalysis( new HashSet<>(), new HashSet<>(), unusedDeclaredArtifacts,
-                new HashSet<>() );
-
-        assertEquals( expectedAnalysis, actualAnalysis );
-    }
-
-    @Test
-    public void testJarWithClassInUnnamedPackage()
-            throws TestToolsException, ProjectDependencyAnalyzerException
-    {
-        compileProject( "jarWithClassInUnnamedPackage/pom.xml" );
-
-        MavenProject project2 = getProject( "jarWithClassInUnnamedPackage/project2/pom.xml" );
-
-        ProjectDependencyAnalysis actualAnalysis = analyzer.analyze( project2 );
-
-        Artifact project1 = createArtifact( "org.apache.maven.shared.dependency-analyzer.tests",
-                                            "jarWithClassInUnnamedPackage1", "jar", "1.0", "compile" );
-        Set<Artifact> unusedDeclaredArtifacts = Collections.singleton( project1 );
-        ProjectDependencyAnalysis expectedAnalysis = new ProjectDependencyAnalysis( null, null, unusedDeclaredArtifacts );
-
-        assertEquals( expectedAnalysis, actualAnalysis );
-    }
-
-    @Test
-    public void testUsedUndeclaredClassReference()
-        throws TestToolsException, ProjectDependencyAnalyzerException
-    {
-        compileProject( "usedUndeclaredReference/pom.xml" );
-
-        MavenProject project = getProject( "usedUndeclaredReference/pom.xml" );
-
-        ProjectDependencyAnalysis actualAnalysis = analyzer.analyze( project );
-
-        Artifact xmlApis = createArtifact( "xml-apis", "xml-apis", "jar", "1.0.b2", "compile" );
-        Set<Artifact> expectedUsedUndeclaredArtifacts = Collections.singleton( xmlApis );
-
-        assertEquals( expectedUsedUndeclaredArtifacts, actualAnalysis.getUsedUndeclaredArtifacts() );
-
-        Map<Artifact, Set<String>> expectedUsedUndeclaredArtifactsWithClasses =
-                Collections.singletonMap(xmlApis, Collections.singleton("org.apache.xmlcommons.Version") );
-
-        assertEquals( expectedUsedUndeclaredArtifactsWithClasses, actualAnalysis.getUsedUndeclaredArtifactsWithClasses() );
-    }
-
-    // private methods --------------------------------------------------------
-
-    private void compileProject( String pomPath )
-        throws TestToolsException
-    {
-        compileProject( pomPath, new Properties() );
-    }
-
-    private void compileProject(String pomPath, Properties properties) throws TestToolsException {
-        File pom = getTestFile( "target/test-classes/", pomPath );
-        if ( !properties.containsKey( "maven.compiler.source" ) )
-        {
-          properties.put( "maven.compiler.source", "1.8" );
-          properties.put( "maven.compiler.target", "1.8" );
-        }
-        
-        String httpsProtocols = System.getProperty( "https.protocols" );
-        if ( httpsProtocols != null )
-        {
-            properties.put( "https.protocols", httpsProtocols );
-        }
-
-        List<String> goals = Arrays.asList( "clean", "install" );
-        File log = new File( pom.getParentFile(), "build.log" );
-
-        InvocationRequest request = buildTool.createBasicInvocationRequest( pom, properties, goals, log );
-        request.setLocalRepositoryDirectory( localRepo );
-        request.setBatchMode( true );
-
-        InvocationResult result = buildTool.executeMaven( request );
-
-        assertNull( "Error compiling test project", result.getExecutionException() );
-        assertEquals( "Error compiling test project", 0, result.getExitCode() );
-    }
-
-    private MavenProject getProject( String pomPath )
-        throws TestToolsException
-    {
-        File pom = getTestFile( "target/test-classes/", pomPath );
-
-        return projectTool.readProjectWithDependencies( pom, localRepo );
-    }
-
-    private Artifact createArtifact( String groupId, String artifactId, String type, String version, String scope )
-    {
-        VersionRange versionRange = VersionRange.createFromVersion( version );
-        ArtifactHandler handler = new DefaultArtifactHandler();
-
-        return new DefaultArtifact( groupId, artifactId, versionRange, scope, type, null, handler );
-    }
-}
diff --git a/src/test/java/org/apache/maven/shared/dependency/analyzer/ProjectDependencyAnalysisTest.java b/src/test/java/org/apache/maven/shared/dependency/analyzer/ProjectDependencyAnalysisTest.java
index 55d649a..09e519d 100644
--- a/src/test/java/org/apache/maven/shared/dependency/analyzer/ProjectDependencyAnalysisTest.java
+++ b/src/test/java/org/apache/maven/shared/dependency/analyzer/ProjectDependencyAnalysisTest.java
@@ -19,18 +19,20 @@ package org.apache.maven.shared.dependency.analyzer;
  * under the License.
  */
 
+import java.util.Arrays;
 import java.util.HashSet;
 import java.util.Set;
 
 import org.apache.maven.artifact.Artifact;
-
+import org.apache.maven.artifact.DefaultArtifact;
+import org.apache.maven.artifact.versioning.VersionRange;
 import org.junit.Test;
 
 import static org.assertj.core.api.Assertions.assertThat;
 
 /**
  * Tests <code>ProjectDependencyAnalysis</code>.
- * 
+ *
  * @author <a href="mailto:markhobson@gmail.com">Mark Hobson</a>
  * @see ProjectDependencyAnalysis
  */
@@ -46,10 +48,47 @@ public class ProjectDependencyAnalysisTest
 
         ProjectDependencyAnalysis analysis =
             new ProjectDependencyAnalysis( usedDeclaredArtifacts, usedUndeclaredArtifacts, unusedDeclaredArtifacts,
-                    testArtifactsWithNonTestScope);
+                testArtifactsWithNonTestScope );
 
         assertThat( analysis.getUsedDeclaredArtifacts() ).isEqualTo( usedDeclaredArtifacts );
         assertThat( analysis.getUsedUndeclaredArtifacts() ).isEqualTo( usedUndeclaredArtifacts );
         assertThat( analysis.getUnusedDeclaredArtifacts() ).isEqualTo( unusedDeclaredArtifacts );
     }
+
+    @Test
+    public void ignoreNonCompileShouldFilterOnlyUnusedDeclare()
+    {
+        Artifact artifactCompile = aTestArtifact( "test1", Artifact.SCOPE_COMPILE );
+        Artifact artifactProvided = aTestArtifact( "test2", Artifact.SCOPE_PROVIDED );
+        Artifact artifactTest = aTestArtifact( "test3", Artifact.SCOPE_TEST );
+
+        ProjectDependencyAnalysis analysis = new ProjectDependencyAnalysis(
+            asSet( artifactCompile, artifactProvided, artifactTest ),
+            asSet( artifactCompile, artifactProvided, artifactTest ),
+            asSet( artifactCompile, artifactProvided, artifactTest ),
+            asSet( artifactCompile, artifactProvided, artifactTest ) );
+
+        ProjectDependencyAnalysis compileOnlyAnalysis = analysis.ignoreNonCompile();
+
+        assertThat( compileOnlyAnalysis.getUsedDeclaredArtifacts() ).hasSize( 3 );
+        assertThat( compileOnlyAnalysis.getUsedUndeclaredArtifacts() ).hasSize( 3 );
+
+        assertThat( compileOnlyAnalysis.getUnusedDeclaredArtifacts() )
+            .hasSize( 1 )
+            .allSatisfy( a -> assertThat( a.getScope() ).isEqualTo( Artifact.SCOPE_COMPILE ) );
+
+        assertThat( compileOnlyAnalysis.getTestArtifactsWithNonTestScope() )
+            .hasSize( 3 );
+    }
+
+    private <T> Set<T> asSet( T... items )
+    {
+        return new HashSet<>( Arrays.asList( items ) );
+    }
+
+    private Artifact aTestArtifact( String artifactId, String scope )
+    {
+        return new DefaultArtifact( "groupId", artifactId, VersionRange.createFromVersion( "1.0" ),
+            scope, "jar", "", null );
+    }
 }