You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by hb...@apache.org on 2017/12/20 09:34:08 UTC

[maven-ear-plugin] 05/16: PR: MNG-1296 Submitted by: Edwin Punzalan Reviewed by: Brett Porter use scope filter and optional flag instead of hard coding

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

hboutemy pushed a commit to annotated tag maven-ear-plugin-2.1
in repository https://gitbox.apache.org/repos/asf/maven-ear-plugin.git

commit be0c28359b76aecfa6530373b6bbd75642b42d99
Author: Brett Leslie Porter <br...@apache.org>
AuthorDate: Mon Oct 24 04:16:41 2005 +0000

    PR: MNG-1296
    Submitted by: Edwin Punzalan
    Reviewed by:  Brett Porter
    use scope filter and optional flag instead of hard coding
    
    
    git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk/maven-plugins/maven-ear-plugin@327955 13f79535-47bb-0310-9956-ffa450edef68
---
 src/main/java/org/apache/maven/plugin/ear/AbstractEarMojo.java | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/main/java/org/apache/maven/plugin/ear/AbstractEarMojo.java b/src/main/java/org/apache/maven/plugin/ear/AbstractEarMojo.java
index 8bb7c67..167851c 100644
--- a/src/main/java/org/apache/maven/plugin/ear/AbstractEarMojo.java
+++ b/src/main/java/org/apache/maven/plugin/ear/AbstractEarMojo.java
@@ -27,6 +27,7 @@ import java.util.ArrayList;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Set;
+import org.apache.maven.artifact.resolver.filter.ScopeArtifactFilter;
 
 /**
  * A base class for EAR-processing related tasks.
@@ -102,9 +103,9 @@ public abstract class AbstractEarMojo
             Artifact artifact = (Artifact) iter.next();
 
             // Artifact is not yet registered and it has neither test, nor a
-            // provided scope
-            if ( !isArtifactRegistered( artifact, allModules ) && !Artifact.SCOPE_TEST.equals( artifact.getScope() ) &&
-                !Artifact.SCOPE_PROVIDED.equals( artifact.getScope() ) )
+            // provided scope, not is it optional
+            ScopeArtifactFilter filter = new ScopeArtifactFilter( Artifact.SCOPE_RUNTIME );
+            if ( !isArtifactRegistered( artifact, allModules ) && !artifact.isOptional() && filter.include( artifact ) )
             {
                 EarModule module = EarModuleFactory.newEarModule( artifact );
                 allModules.add( module );

-- 
To stop receiving notification emails like this one, please contact
"commits@maven.apache.org" <co...@maven.apache.org>.