You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by bm...@apache.org on 2021/06/01 10:07:05 UTC

[maven-dependency-plugin] branch MDEP-568_go-offline_filter created (now 68600d6)

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

bmarwell pushed a change to branch MDEP-568_go-offline_filter
in repository https://gitbox.apache.org/repos/asf/maven-dependency-plugin.git.


      at 68600d6  [MDEP-568] filter dependencies in go-offline as documented.

This branch includes the following new commits:

     new e10681c  fixed MDEP-568: instead of relying on "requiresDependencyResolution" to download artifacts, download the artifacts in the plugin code after filtering them with the provided parameters.
     new 68600d6  [MDEP-568] filter dependencies in go-offline as documented.

The 2 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-plugin] 01/02: fixed MDEP-568: instead of relying on "requiresDependencyResolution" to download artifacts, download the artifacts in the plugin code after filtering them with the provided parameters.

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

bmarwell pushed a commit to branch MDEP-568_go-offline_filter
in repository https://gitbox.apache.org/repos/asf/maven-dependency-plugin.git

commit e10681c87a3e6ed013e1f92f5d4e47fbefbad6ff
Author: Andreas Janning <an...@qaware.de>
AuthorDate: Mon Jul 16 16:20:11 2018 -0700

    fixed MDEP-568: instead of relying on "requiresDependencyResolution" to download artifacts, download the artifacts
    in the plugin code after filtering them with the provided parameters.
---
 .../mdep-568-go-offline-exclude/invoker.properties | 18 +++++++
 .../projects/mdep-568-go-offline-exclude/pom.xml   | 57 ++++++++++++++++++++++
 .../mdep-568-go-offline-exclude/test.properties    | 19 ++++++++
 .../dependency/resolvers/GoOfflineMojo.java        | 33 +++++++++----
 4 files changed, 117 insertions(+), 10 deletions(-)

diff --git a/src/it/projects/mdep-568-go-offline-exclude/invoker.properties b/src/it/projects/mdep-568-go-offline-exclude/invoker.properties
new file mode 100644
index 0000000..e596121
--- /dev/null
+++ b/src/it/projects/mdep-568-go-offline-exclude/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 = ${project.groupId}:${project.artifactId}:${project.version}:go-offline
diff --git a/src/it/projects/mdep-568-go-offline-exclude/pom.xml b/src/it/projects/mdep-568-go-offline-exclude/pom.xml
new file mode 100644
index 0000000..a69b7b8
--- /dev/null
+++ b/src/it/projects/mdep-568-go-offline-exclude/pom.xml
@@ -0,0 +1,57 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one
+  ~ or more contributor license agreements.  See the NOTICE file
+  ~ distributed with this work for additional information
+  ~ regarding copyright ownership.  The ASF licenses this file
+  ~ to you under the Apache License, Version 2.0 (the
+  ~ "License"); you may not use this file except in compliance
+  ~ with the License.  You may obtain a copy of the License at
+  ~
+  ~   http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing,
+  ~ software distributed under the License is distributed on an
+  ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  ~ KIND, either express or implied.  See the License for the
+  ~ specific language governing permissions and limitations
+  ~ under the License.
+  -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+
+  <groupId>org.apache.maven.its.dependency</groupId>
+  <artifactId>test</artifactId>
+  <version>1.0-SNAPSHOT</version>
+
+  <name>Test</name>
+  <description>
+    Test dependency:go-offline
+  </description>
+
+  <properties>
+    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+  </properties>
+
+  <dependencies>
+    <dependency>
+      <groupId>org.apache.maven</groupId>
+      <artifactId>maven-project</artifactId>
+      <version>2.0.6</version>
+    </dependency>
+    <dependency>
+      <groupId>non.existant.group</groupId>
+      <artifactId>fake</artifactId>
+      <version>1.0.0</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.maven</groupId>
+      <artifactId>non.existant.artifact</artifactId>
+      <version>1.0.0</version>
+    </dependency>
+  </dependencies>
+
+</project>
diff --git a/src/it/projects/mdep-568-go-offline-exclude/test.properties b/src/it/projects/mdep-568-go-offline-exclude/test.properties
new file mode 100644
index 0000000..6e8a5e5
--- /dev/null
+++ b/src/it/projects/mdep-568-go-offline-exclude/test.properties
@@ -0,0 +1,19 @@
+# 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.
+
+excludeGroupIds = non.existant.group
+excludeArtifactIds= non.existant.artifact
diff --git a/src/main/java/org/apache/maven/plugins/dependency/resolvers/GoOfflineMojo.java b/src/main/java/org/apache/maven/plugins/dependency/resolvers/GoOfflineMojo.java
index e0e8b1f..1861c00 100644
--- a/src/main/java/org/apache/maven/plugins/dependency/resolvers/GoOfflineMojo.java
+++ b/src/main/java/org/apache/maven/plugins/dependency/resolvers/GoOfflineMojo.java
@@ -19,12 +19,20 @@ package org.apache.maven.plugins.dependency.resolvers;
  * under the License.    
  */
 
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.LinkedHashSet;
+import java.util.Set;
+
 import org.apache.maven.artifact.Artifact;
 import org.apache.maven.artifact.repository.ArtifactRepository;
 import org.apache.maven.model.Dependency;
 import org.apache.maven.plugin.MojoExecutionException;
-import org.apache.maven.plugins.dependency.utils.DependencyUtil;
+import org.apache.maven.plugins.annotations.Execute;
 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.plugins.dependency.utils.DependencyUtil;
 import org.apache.maven.project.ProjectBuildingRequest;
 import org.apache.maven.shared.artifact.filter.collection.ArtifactsFilter;
 import org.apache.maven.shared.artifact.filter.resolve.TransformableFilter;
@@ -33,25 +41,30 @@ import org.apache.maven.shared.transfer.dependencies.DefaultDependableCoordinate
 import org.apache.maven.shared.transfer.dependencies.DependableCoordinate;
 import org.apache.maven.shared.transfer.dependencies.resolve.DependencyResolverException;
 
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.LinkedHashSet;
-import java.util.Set;
-
 /**
  * Goal that resolves all project dependencies, including plugins and reports and their dependencies.
  *
- * <a href="mailto:brianf@apache.org">Brian Fox</a>
+ * @author <a href="mailto:brianf@apache.org">Brian Fox</a>
  * @author Maarten Mulders
  * @since 2.0
  */
-@Mojo( name = "go-offline", threadSafe = true )
+@Mojo( name = "go-offline", requiresDependencyCollection = ResolutionScope.TEST, threadSafe = true )
+@Execute( goal = "resolve-plugins" )
 public class GoOfflineMojo
     extends AbstractResolveMojo
 {
     /**
-     * Main entry into mojo. Gets the list of dependencies, resolves all that are not in the Reactor, and iterates
-     * through displaying the resolved versions.
+     * Include parent poms in the dependency resolution list.
+     *
+     * @since 3.1.2
+     */
+    @Parameter( property = "includeParents", defaultValue = "false" )
+    private boolean includeParents;
+
+    /**
+     * Main entry into mojo. Gets the list of dependencies, filters them by the include/exclude parameters
+     * provided and iterates through downloading the resolved version.
+     * if the version is not present in the local repository.
      *
      * @throws MojoExecutionException with a message if an error occurs.
      */

[maven-dependency-plugin] 02/02: [MDEP-568] filter dependencies in go-offline as documented.

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

bmarwell pushed a commit to branch MDEP-568_go-offline_filter
in repository https://gitbox.apache.org/repos/asf/maven-dependency-plugin.git

commit 68600d634266b57d460581213c5606f7cd5fcce4
Author: Benjamin Marwell <bm...@gmail.com>
AuthorDate: Tue Jun 1 12:05:26 2021 +0200

    [MDEP-568] filter dependencies in go-offline as documented.
---
 .../filters/AbstractDependencyFilter.java          |  59 +++++++
 .../dependency/filters/ArtifactIdFilter.java       |  98 ++++++++++++
 .../dependency/filters/ClassifierFilter.java       |  98 ++++++++++++
 .../dependency/filters/DependencyFilter.java       |  39 +++++
 .../dependency/filters/FilterDependencies.java     |  91 +++++++++++
 .../plugins/dependency/filters/GroupIdFilter.java  |  98 ++++++++++++
 .../plugins/dependency/filters/ScopeFilter.java    | 171 +++++++++++++++++++++
 .../plugins/dependency/filters/TypeFilter.java     |  98 ++++++++++++
 .../dependency/resolvers/GoOfflineMojo.java        |  29 +++-
 .../dependency/resolvers/TestGoOfflineMojo.java    | 105 +++++++++++++
 10 files changed, 884 insertions(+), 2 deletions(-)

diff --git a/src/main/java/org/apache/maven/plugins/dependency/filters/AbstractDependencyFilter.java b/src/main/java/org/apache/maven/plugins/dependency/filters/AbstractDependencyFilter.java
new file mode 100644
index 0000000..56099aa
--- /dev/null
+++ b/src/main/java/org/apache/maven/plugins/dependency/filters/AbstractDependencyFilter.java
@@ -0,0 +1,59 @@
+package org.apache.maven.plugins.dependency.filters;
+
+/*
+ * 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 java.util.HashSet;
+import java.util.LinkedHashSet;
+import java.util.Locale;
+import java.util.Set;
+
+import org.apache.maven.model.Dependency;
+
+abstract class AbstractDependencyFilter implements DependencyFilter
+{
+    public boolean isDependencyIncluded( Dependency dependency )
+    {
+        Set<Dependency> set = new LinkedHashSet<>();
+        set.add( dependency );
+
+        set = filter( set );
+        return set.contains( dependency );
+    }
+
+    protected Set<String> splitValues( String csvScopeList )
+    {
+        final String[] scopes = csvScopeList.split( "," );
+        Set<String> excludeScope = new HashSet<>();
+
+        for ( String scope : scopes )
+        {
+            final String cleanScope = scope.trim().toLowerCase( Locale.ROOT );
+
+            if ( cleanScope.isEmpty() )
+            {
+                continue;
+            }
+
+            excludeScope.add( cleanScope );
+        }
+
+        return excludeScope;
+    }
+}
diff --git a/src/main/java/org/apache/maven/plugins/dependency/filters/ArtifactIdFilter.java b/src/main/java/org/apache/maven/plugins/dependency/filters/ArtifactIdFilter.java
new file mode 100644
index 0000000..52a5e2e
--- /dev/null
+++ b/src/main/java/org/apache/maven/plugins/dependency/filters/ArtifactIdFilter.java
@@ -0,0 +1,98 @@
+package org.apache.maven.plugins.dependency.filters;
+
+/*
+ * 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 java.util.HashSet;
+import java.util.Set;
+
+import org.apache.maven.model.Dependency;
+
+/**
+ * Filters dependencies by ArtifactId.
+ */
+public class ArtifactIdFilter extends AbstractDependencyFilter
+{
+    private final String includeArtifactId;
+
+    private final String excludeArtifactId;
+
+    public ArtifactIdFilter( String includeArtifactId, String excludeArtifactId )
+    {
+        this.includeArtifactId = includeArtifactId == null ? "" : includeArtifactId;
+        this.excludeArtifactId = excludeArtifactId == null ? "" : excludeArtifactId;
+    }
+
+    @Override
+    public Set<Dependency> filter( Set<Dependency> dependencies )
+    {
+        Set<Dependency> filtered = new HashSet<>( dependencies );
+
+        filtered = filterIncludeArtifactIds( filtered );
+        filtered = filterExcludeArtifactIds( filtered );
+
+        return filtered;
+    }
+
+    private Set<Dependency> filterExcludeArtifactIds( Set<Dependency> dependencies )
+    {
+        if ( excludeArtifactId.trim().isEmpty() )
+        {
+            return dependencies;
+        }
+
+        final Set<String> excludedArtifactIds = splitValues( excludeArtifactId );
+
+        Set<Dependency> filtered = new HashSet<>( dependencies.size() );
+        for ( Dependency dependency : dependencies )
+        {
+            if ( excludedArtifactIds.contains( dependency.getArtifactId() ) )
+            {
+                continue;
+            }
+
+            filtered.add( dependency );
+        }
+
+        return filtered;
+    }
+
+    private Set<Dependency> filterIncludeArtifactIds( Set<Dependency> dependencies )
+    {
+        if ( includeArtifactId.trim().isEmpty() )
+        {
+            return dependencies;
+        }
+
+        Set<String> includedArtifactIds = splitValues( includeArtifactId );
+
+        Set<Dependency> filtered = new HashSet<>( dependencies.size() );
+        for ( Dependency dependency : dependencies )
+        {
+            if ( includedArtifactIds.contains( dependency.getArtifactId() ) )
+            {
+                filtered.add( dependency );
+            }
+        }
+
+        return filtered;
+    }
+
+
+}
diff --git a/src/main/java/org/apache/maven/plugins/dependency/filters/ClassifierFilter.java b/src/main/java/org/apache/maven/plugins/dependency/filters/ClassifierFilter.java
new file mode 100644
index 0000000..6480553
--- /dev/null
+++ b/src/main/java/org/apache/maven/plugins/dependency/filters/ClassifierFilter.java
@@ -0,0 +1,98 @@
+package org.apache.maven.plugins.dependency.filters;
+
+/*
+ * 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 java.util.HashSet;
+import java.util.Set;
+
+import org.apache.maven.model.Dependency;
+
+/**
+ * Filters dependencies by Classifier.
+ */
+public class ClassifierFilter extends AbstractDependencyFilter
+{
+    private final String includeClassifier;
+
+    private final String excludeClassifier;
+
+    public ClassifierFilter( String includeClassifier, String excludeClassifier )
+    {
+        this.includeClassifier = includeClassifier == null ? "" : includeClassifier;
+        this.excludeClassifier = excludeClassifier == null ? "" : excludeClassifier;
+    }
+
+    @Override
+    public Set<Dependency> filter( Set<Dependency> dependencies )
+    {
+        Set<Dependency> filtered = new HashSet<>( dependencies );
+
+        filtered = filterIncludeClassifier( filtered );
+        filtered = filterExcludeClassifier( filtered );
+
+        return filtered;
+    }
+
+    private Set<Dependency> filterExcludeClassifier( Set<Dependency> dependencies )
+    {
+        if ( excludeClassifier.trim().isEmpty() )
+        {
+            return dependencies;
+        }
+
+        final Set<String> excludedClassifiers = splitValues( excludeClassifier );
+
+        Set<Dependency> filtered = new HashSet<>( dependencies.size() );
+        for ( Dependency dependency : dependencies )
+        {
+            if ( excludedClassifiers.contains( dependency.getClassifier() ) )
+            {
+                continue;
+            }
+
+            filtered.add( dependency );
+        }
+
+        return filtered;
+    }
+
+    private Set<Dependency> filterIncludeClassifier( Set<Dependency> dependencies )
+    {
+        if ( includeClassifier.trim().isEmpty() )
+        {
+            return dependencies;
+        }
+
+        Set<String> includedClassifiers = splitValues( includeClassifier );
+
+        Set<Dependency> filtered = new HashSet<>( dependencies.size() );
+        for ( Dependency dependency : dependencies )
+        {
+            if ( includedClassifiers.contains( dependency.getClassifier() ) )
+            {
+                filtered.add( dependency );
+            }
+        }
+
+        return filtered;
+    }
+
+
+}
diff --git a/src/main/java/org/apache/maven/plugins/dependency/filters/DependencyFilter.java b/src/main/java/org/apache/maven/plugins/dependency/filters/DependencyFilter.java
new file mode 100644
index 0000000..30bd56c
--- /dev/null
+++ b/src/main/java/org/apache/maven/plugins/dependency/filters/DependencyFilter.java
@@ -0,0 +1,39 @@
+package org.apache.maven.plugins.dependency.filters;
+
+/*
+ * 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 java.util.Set;
+
+import org.apache.maven.model.Dependency;
+
+/**
+ * Dependencies filter. Used to filter dependencies by one or more of their properties.
+ */
+public interface DependencyFilter
+{
+    /**
+     * Returns a new unmodifiable set of filtered dependencies.
+     * @param dependencies the dependencies to filter.
+     * @return the filtered dependencies.
+     */
+    Set<Dependency> filter( Set<Dependency> dependencies );
+
+    boolean isDependencyIncluded( Dependency dependency );
+}
diff --git a/src/main/java/org/apache/maven/plugins/dependency/filters/FilterDependencies.java b/src/main/java/org/apache/maven/plugins/dependency/filters/FilterDependencies.java
new file mode 100644
index 0000000..b044e1d
--- /dev/null
+++ b/src/main/java/org/apache/maven/plugins/dependency/filters/FilterDependencies.java
@@ -0,0 +1,91 @@
+package org.apache.maven.plugins.dependency.filters;
+
+/*
+ * 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 static java.util.Arrays.asList;
+import static java.util.Collections.unmodifiableList;
+
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import org.apache.maven.model.Dependency;
+
+/**
+ * Applies null to any number of filters to a given collection of dependencies.
+ */
+public class FilterDependencies
+{
+
+    private final List<DependencyFilter> filters;
+
+    /**
+     * Created new instance.
+     */
+    public FilterDependencies( DependencyFilter... filters )
+    {
+        this.filters = unmodifiableList( asList( filters ) );
+    }
+
+    /**
+     * <p>filter.</p>
+     *
+     * @param dependencies The {@link Dependency}s to filter.
+     * @return The resulting artifacts set.
+     */
+    public Set<Dependency> filter( Collection<Dependency> dependencies )
+    {
+        Set<Dependency> filtered = new HashSet<>( dependencies );
+
+        for ( DependencyFilter filter : filters )
+        {
+            try
+            {
+                filtered = filter.filter( filtered );
+            }
+            catch ( NullPointerException e )
+            {
+                // TODO: log
+            }
+        }
+
+        return filtered;
+    }
+
+    /**
+     * <p>Getter for the field <code>filters</code>.</p>
+     *
+     * @return the filters.
+     */
+    public List<DependencyFilter> getFilters()
+    {
+        return this.filters;
+    }
+
+    @Override
+    public String toString()
+    {
+        final StringBuilder sb = new StringBuilder( "FilterDependencies{" );
+        sb.append( "filters=" ).append( filters );
+        sb.append( '}' );
+        return sb.toString();
+    }
+}
diff --git a/src/main/java/org/apache/maven/plugins/dependency/filters/GroupIdFilter.java b/src/main/java/org/apache/maven/plugins/dependency/filters/GroupIdFilter.java
new file mode 100644
index 0000000..c1343f5
--- /dev/null
+++ b/src/main/java/org/apache/maven/plugins/dependency/filters/GroupIdFilter.java
@@ -0,0 +1,98 @@
+package org.apache.maven.plugins.dependency.filters;
+
+/*
+ * 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 java.util.HashSet;
+import java.util.Set;
+
+import org.apache.maven.model.Dependency;
+
+/**
+ * Filters dependencies by GroupId.
+ */
+public class GroupIdFilter extends AbstractDependencyFilter
+{
+    private final String includeGroupId;
+
+    private final String excludeGroupId;
+
+    public GroupIdFilter( String includeGroupId, String excludeGroupId )
+    {
+        this.includeGroupId = includeGroupId == null ? "" : includeGroupId;
+        this.excludeGroupId = excludeGroupId == null ? "" : excludeGroupId;
+    }
+
+    @Override
+    public Set<Dependency> filter( Set<Dependency> dependencies )
+    {
+        Set<Dependency> filtered = new HashSet<>( dependencies );
+
+        filtered = filterIncludeGroupIds( filtered );
+        filtered = filterExcludeGroupIds( filtered );
+
+        return filtered;
+    }
+
+    private Set<Dependency> filterExcludeGroupIds( Set<Dependency> dependencies )
+    {
+        if ( excludeGroupId.trim().isEmpty() )
+        {
+            return dependencies;
+        }
+
+        final Set<String> excludedGroupIds = splitValues( excludeGroupId );
+
+        Set<Dependency> filtered = new HashSet<>( dependencies.size() );
+        for ( Dependency dependency : dependencies )
+        {
+            if ( excludedGroupIds.contains( dependency.getGroupId() ) )
+            {
+                continue;
+            }
+
+            filtered.add( dependency );
+        }
+
+        return filtered;
+    }
+
+    private Set<Dependency> filterIncludeGroupIds( Set<Dependency> dependencies )
+    {
+        if ( includeGroupId.trim().isEmpty() )
+        {
+            return dependencies;
+        }
+
+        Set<String> includedGroupIds = splitValues( includeGroupId );
+
+        Set<Dependency> filtered = new HashSet<>( dependencies.size() );
+        for ( Dependency dependency : dependencies )
+        {
+            if ( includedGroupIds.contains( dependency.getGroupId() ) )
+            {
+                filtered.add( dependency );
+            }
+        }
+
+        return filtered;
+    }
+
+
+}
diff --git a/src/main/java/org/apache/maven/plugins/dependency/filters/ScopeFilter.java b/src/main/java/org/apache/maven/plugins/dependency/filters/ScopeFilter.java
new file mode 100644
index 0000000..8a47a1d
--- /dev/null
+++ b/src/main/java/org/apache/maven/plugins/dependency/filters/ScopeFilter.java
@@ -0,0 +1,171 @@
+package org.apache.maven.plugins.dependency.filters;
+
+/*
+ * 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 static java.util.Arrays.asList;
+import static java.util.Collections.singletonList;
+
+import java.util.HashSet;
+import java.util.Set;
+
+import org.apache.maven.artifact.Artifact;
+import org.apache.maven.model.Dependency;
+
+/**
+ * Filters dependencies by scope.
+ */
+public class ScopeFilter extends AbstractDependencyFilter
+{
+    private final String includeScope;
+
+    private final String excludeScope;
+
+    public ScopeFilter( String includeScope, String excludeScope )
+    {
+        this.includeScope = includeScope == null ? "" : includeScope;
+        this.excludeScope = excludeScope == null ? "" : excludeScope;
+    }
+
+    @Override
+    public Set<Dependency> filter( Set<Dependency> dependencies )
+    {
+        Set<Dependency> filtered = new HashSet<>( dependencies );
+
+        filtered = filterIncludeScope( filtered );
+        filtered = filterExcludeScope( filtered );
+
+        return filtered;
+    }
+
+    private Set<Dependency> filterExcludeScope( Set<Dependency> dependencies )
+    {
+        if ( excludeScope.trim().isEmpty() )
+        {
+            return dependencies;
+        }
+
+        final Set<String> excludedScopes = toResolvedScopes( excludeScope, true );
+
+        Set<Dependency> filtered = new HashSet<>( dependencies.size() );
+        for ( Dependency dependency : dependencies )
+        {
+            if ( excludedScopes.contains( dependency.getScope() ) )
+            {
+                continue;
+            }
+
+            filtered.add( dependency );
+        }
+
+        return filtered;
+    }
+
+    private Set<Dependency> filterIncludeScope( Set<Dependency> dependencies )
+    {
+        if ( includeScope.trim().isEmpty() )
+        {
+            return dependencies;
+        }
+
+        Set<String> includedScopes = toResolvedScopes( includeScope, false );
+
+        Set<Dependency> filtered = new HashSet<>( dependencies.size() );
+        for ( Dependency dependency : dependencies )
+        {
+            if ( includedScopes.contains( dependency.getScope() ) )
+            {
+                filtered.add( dependency );
+            }
+        }
+
+        return filtered;
+    }
+
+    private Set<String> toResolvedScopes( String scope, boolean isExcludeScope )
+    {
+        if ( isExcludeScope )
+        {
+            /*
+             * runtime exclude scope excludes runtime and compile dependencies,
+             * compile exclude scope excludes compile, provided, and system dependencies,
+             * test exclude scope excludes all dependencies, then not really a legitimate option: it will
+             * fail, you probably meant to configure includeScope = compile
+             * provided exclude scope just excludes provided dependencies,
+             * system exclude scope just excludes system dependencies.
+             */
+            switch ( scope )
+            {
+                case Artifact.SCOPE_RUNTIME:
+                    return new HashSet<>( asList(
+                            Artifact.SCOPE_RUNTIME,
+                            Artifact.SCOPE_COMPILE ) );
+                case Artifact.SCOPE_COMPILE:
+                    return new HashSet<>( asList(
+                            Artifact.SCOPE_COMPILE,
+                            Artifact.SCOPE_PROVIDED,
+                            Artifact.SCOPE_SYSTEM ) );
+                case Artifact.SCOPE_TEST:
+                    throw new IllegalArgumentException( "invalid exclude scope: test. Did you mean compile?" );
+                case Artifact.SCOPE_PROVIDED:
+                    return new HashSet<>( singletonList( Artifact.SCOPE_PROVIDED ) );
+                case Artifact.SCOPE_SYSTEM:
+                    return new HashSet<>( singletonList( Artifact.SCOPE_SYSTEM ) );
+                default:
+                    throw new IllegalArgumentException( "Invalid Scope: " + scope );
+            }
+        }
+        else
+        {
+            /*
+             * runtime include scope gives runtime and compile dependencies,
+             * compile include scope gives compile, provided, and system dependencies,
+             * test include scope gives all dependencies (equivalent to default),
+             * provided include scope just gives provided dependencies,
+             * system include scope just gives system dependencies.
+             */
+            switch ( scope )
+            {
+                case Artifact.SCOPE_RUNTIME:
+                    return new HashSet<>( asList(
+                            Artifact.SCOPE_RUNTIME,
+                            Artifact.SCOPE_COMPILE ) );
+                case Artifact.SCOPE_COMPILE:
+                    return new HashSet<>( asList(
+                            Artifact.SCOPE_COMPILE,
+                            Artifact.SCOPE_PROVIDED,
+                            Artifact.SCOPE_SYSTEM ) );
+                case Artifact.SCOPE_TEST:
+                    return new HashSet<>( asList(
+                            Artifact.SCOPE_COMPILE,
+                            Artifact.SCOPE_PROVIDED,
+                            Artifact.SCOPE_SYSTEM,
+                            Artifact.SCOPE_TEST,
+                            Artifact.SCOPE_RUNTIME ) );
+                case Artifact.SCOPE_PROVIDED:
+                    return new HashSet<>( singletonList( Artifact.SCOPE_PROVIDED ) );
+                case Artifact.SCOPE_SYSTEM:
+                    return new HashSet<>( singletonList( Artifact.SCOPE_SYSTEM ) );
+                default:
+                    throw new IllegalArgumentException( "Invalid Scope: " + scope );
+            }
+        }
+    }
+
+}
diff --git a/src/main/java/org/apache/maven/plugins/dependency/filters/TypeFilter.java b/src/main/java/org/apache/maven/plugins/dependency/filters/TypeFilter.java
new file mode 100644
index 0000000..f466c54
--- /dev/null
+++ b/src/main/java/org/apache/maven/plugins/dependency/filters/TypeFilter.java
@@ -0,0 +1,98 @@
+package org.apache.maven.plugins.dependency.filters;
+
+/*
+ * 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 java.util.HashSet;
+import java.util.Set;
+
+import org.apache.maven.model.Dependency;
+
+/**
+ * Filters dependencies by type.
+ */
+public class TypeFilter extends AbstractDependencyFilter
+{
+    private final String includeType;
+
+    private final String excludeType;
+
+    public TypeFilter( String includeType, String excludeType )
+    {
+        this.includeType = includeType == null ? "" : includeType;
+        this.excludeType = excludeType == null ? "" : excludeType;
+    }
+
+    @Override
+    public Set<Dependency> filter( Set<Dependency> dependencies )
+    {
+        Set<Dependency> filtered = new HashSet<>( dependencies );
+
+        filtered = filterIncludeType( filtered );
+        filtered = filterExcludeType( filtered );
+
+        return filtered;
+    }
+
+    private Set<Dependency> filterExcludeType( Set<Dependency> dependencies )
+    {
+        if ( excludeType.trim().isEmpty() )
+        {
+            return dependencies;
+        }
+
+        final Set<String> excludedTypes = splitValues( excludeType );
+
+        Set<Dependency> filtered = new HashSet<>( dependencies.size() );
+        for ( Dependency dependency : dependencies )
+        {
+            if ( excludedTypes.contains( dependency.getType() ) )
+            {
+                continue;
+            }
+
+            filtered.add( dependency );
+        }
+
+        return filtered;
+    }
+
+    private Set<Dependency> filterIncludeType( Set<Dependency> dependencies )
+    {
+        if ( includeType.trim().isEmpty() )
+        {
+            return dependencies;
+        }
+
+        Set<String> includedTypes = splitValues( includeType );
+
+        Set<Dependency> filtered = new HashSet<>( dependencies.size() );
+        for ( Dependency dependency : dependencies )
+        {
+            if ( includedTypes.contains( dependency.getType() ) )
+            {
+                filtered.add( dependency );
+            }
+        }
+
+        return filtered;
+    }
+
+
+}
diff --git a/src/main/java/org/apache/maven/plugins/dependency/resolvers/GoOfflineMojo.java b/src/main/java/org/apache/maven/plugins/dependency/resolvers/GoOfflineMojo.java
index 1861c00..606aa7e 100644
--- a/src/main/java/org/apache/maven/plugins/dependency/resolvers/GoOfflineMojo.java
+++ b/src/main/java/org/apache/maven/plugins/dependency/resolvers/GoOfflineMojo.java
@@ -19,6 +19,8 @@ package org.apache.maven.plugins.dependency.resolvers;
  * under the License.    
  */
 
+import static java.util.Collections.unmodifiableSet;
+
 import java.util.Collection;
 import java.util.HashSet;
 import java.util.LinkedHashSet;
@@ -32,6 +34,12 @@ import org.apache.maven.plugins.annotations.Execute;
 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.plugins.dependency.filters.ArtifactIdFilter;
+import org.apache.maven.plugins.dependency.filters.ClassifierFilter;
+import org.apache.maven.plugins.dependency.filters.FilterDependencies;
+import org.apache.maven.plugins.dependency.filters.GroupIdFilter;
+import org.apache.maven.plugins.dependency.filters.ScopeFilter;
+import org.apache.maven.plugins.dependency.filters.TypeFilter;
 import org.apache.maven.plugins.dependency.utils.DependencyUtil;
 import org.apache.maven.project.ProjectBuildingRequest;
 import org.apache.maven.shared.artifact.filter.collection.ArtifactsFilter;
@@ -60,6 +68,7 @@ public class GoOfflineMojo
      */
     @Parameter( property = "includeParents", defaultValue = "false" )
     private boolean includeParents;
+    private Set<Artifact> dependencies;
 
     /**
      * Main entry into mojo. Gets the list of dependencies, filters them by the include/exclude parameters
@@ -77,7 +86,7 @@ public class GoOfflineMojo
         {
             final Set<Artifact> plugins = resolvePluginArtifacts();
 
-            final Set<Artifact> dependencies = resolveDependencyArtifacts();
+            this.dependencies = resolveDependencyArtifacts();
 
             if ( !isSilent() )
             {
@@ -111,7 +120,16 @@ public class GoOfflineMojo
     protected Set<Artifact> resolveDependencyArtifacts()
             throws DependencyResolverException
     {
-        final Collection<Dependency> dependencies = getProject().getDependencies();
+        Collection<Dependency> dependencies = getProject().getDependencies();
+        final FilterDependencies filterDependencies = new FilterDependencies(
+                new ArtifactIdFilter( this.includeArtifactIds, this.excludeArtifactIds ),
+                new GroupIdFilter( this.includeGroupIds, this.excludeGroupIds ),
+                new ScopeFilter( this.includeScope, this.excludeScope ),
+                new ClassifierFilter( this.includeClassifiers, this.excludeClassifiers ),
+                new TypeFilter( this.includeTypes, this.excludeTypes )
+        );
+        dependencies = filterDependencies.filter( dependencies );
+
         final Set<DependableCoordinate> dependableCoordinates = new HashSet<>();
 
         final ProjectBuildingRequest buildingRequest = newResolveArtifactProjectBuildingRequest();
@@ -141,6 +159,7 @@ public class GoOfflineMojo
 
         for ( DependableCoordinate dependableCoordinate : dependableCoordinates )
         {
+
             final Iterable<ArtifactResult> artifactResults = getDependencyResolver().resolveDependencies(
                     buildingRequest, dependableCoordinate, filter );
 
@@ -220,4 +239,10 @@ public class GoOfflineMojo
     {
         return null;
     }
+
+    public Set<Artifact> getDependencies()
+    {
+        return unmodifiableSet( dependencies );
+    }
+
 }
diff --git a/src/test/java/org/apache/maven/plugins/dependency/resolvers/TestGoOfflineMojo.java b/src/test/java/org/apache/maven/plugins/dependency/resolvers/TestGoOfflineMojo.java
new file mode 100644
index 0000000..ecf0e57
--- /dev/null
+++ b/src/test/java/org/apache/maven/plugins/dependency/resolvers/TestGoOfflineMojo.java
@@ -0,0 +1,105 @@
+package org.apache.maven.plugins.dependency.resolvers;
+
+/*
+ * 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 static java.util.Collections.singletonList;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+import java.util.Set;
+
+import org.apache.maven.artifact.Artifact;
+import org.apache.maven.artifact.versioning.VersionRange;
+import org.apache.maven.execution.MavenSession;
+import org.apache.maven.model.Dependency;
+import org.apache.maven.plugins.dependency.AbstractDependencyMojoTestCase;
+import org.apache.maven.plugins.dependency.utils.DependencyStatusSets;
+import org.apache.maven.project.MavenProject;
+
+public class TestGoOfflineMojo extends AbstractDependencyMojoTestCase
+{
+
+    protected void setUp() throws Exception
+    {
+        // required for mojo lookups to work
+        super.setUp( "goOfflineTest", false );
+    }
+
+    public void testGoOffline() throws Exception
+    {
+        File testPom = new File( getBasedir(), "target/test-classes/unit/resolve-test/plugin-config.xml" );
+        GoOfflineMojo mojo = (GoOfflineMojo) lookupMojo( "go-offline", testPom );
+        MavenProject project = mojo.getProject();
+        MavenSession session = newMavenSession( project );
+        setVariableValueToObject( mojo, "session", session );
+        setVariableValueToObject( mojo, "includeArtifactIds", "" );
+        setVariableValueToObject( mojo, "excludeArtifactIds", "" );
+        setVariableValueToObject( mojo, "includeGroupIds", "" );
+        setVariableValueToObject( mojo, "excludeGroupIds", "" );
+        setVariableValueToObject( mojo, "includeScope", "" );
+        setVariableValueToObject( mojo, "excludeScope", "system" );
+        setVariableValueToObject( mojo, "includeClassifiers", "" );
+        setVariableValueToObject( mojo, "excludeClassifiers", "" );
+        setVariableValueToObject( mojo, "includeTypes", "" );
+        setVariableValueToObject( mojo, "excludeTypes", "" );
+
+        Set<Artifact> artifacts = this.stubFactory.getScopedArtifacts();
+        Set<Artifact> directArtifacts = this.stubFactory.getReleaseAndSnapshotArtifacts();
+        artifacts.addAll( directArtifacts );
+        project.setArtifacts( artifacts );
+        project.setDependencies( createArtifacts( createDependencies() ) );
+        //project.setDependencyArtifacts( directArtifacts );
+
+        mojo.doExecute();
+        Set<Artifact> results = mojo.getDependencies();
+
+        assertTrue(results.isEmpty());
+    }
+
+    private List<Dependency> createDependencies()
+    {
+        final Dependency comSunTools = new Dependency();
+        comSunTools.setGroupId( "com.sun" );
+        comSunTools.setArtifactId( "tools" );
+        comSunTools.setScope( "system" );
+        comSunTools.setVersion( "1.8" );
+        comSunTools.setType( "jar" );
+
+        return singletonList( comSunTools );
+    }
+
+    // respects the createUnpackableFile flag of the ArtifactStubFactory
+    private List<Dependency> createArtifacts( List<Dependency> items )
+            throws IOException
+    {
+        for ( Dependency item : items )
+        {
+            String classifier = "".equals( item.getClassifier() ) ? null : item.getClassifier();
+            stubFactory.createArtifact( item.getGroupId(), item.getArtifactId(),
+                    VersionRange.createFromVersion( item.getVersion() ), null, item.getType(),
+                    classifier, item.isOptional() );
+        }
+        return items;
+    }
+}