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

ffang pushed a commit to branch 3.1.x-fixes
in repository https://gitbox.apache.org/repos/asf/cxf.git

commit 0ff40637dd61d08957ab874132cc10f65ae78e1d
Author: cpandey <chandrashekharpan...@hotmail.com>
AuthorDate: Mon Apr 9 21:21:45 2018 +0530

    Handle multiple classifiers for wsdlArtifact.
    (cherry picked from commit e2ca038b51f2d9b2bccbc69644e165f22c9cf859)
---
 .../cxf/maven_plugin/AbstractCodegenMoho.java      | 30 +++++++++++++++-------
 1 file changed, 21 insertions(+), 9 deletions(-)

diff --git 
a/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/AbstractCodegenMoho.java
 
b/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/AbstractCodegenMoho.java
index ae27fc5..4597f7e 100644
--- 
a/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/AbstractCodegenMoho.java
+++ 
b/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/AbstractCodegenMoho.java
@@ -877,22 +877,34 @@ public abstract class AbstractCodegenMoho extends 
AbstractMojo {
     }
 
     private Artifact findWsdlArtifact(Artifact targetArtifact, 
Collection<Artifact> artifactSet) {
+        boolean artifactMatched = false;
         if (artifactSet != null && !artifactSet.isEmpty()) {
             for (Artifact pArtifact : artifactSet) {
-                if (targetArtifact.getGroupId().equals(pArtifact.getGroupId())
-                        && 
targetArtifact.getArtifactId().equals(pArtifact.getArtifactId())
-                        && 
targetArtifact.getVersion().equals(pArtifact.getVersion()) 
-                        && ("wsdl".equals(pArtifact.getType()) 
-                        || (
-                                targetArtifact.getClassifier() != null
-                                        && pArtifact.getType() != null
-                                        && (targetArtifact.getClassifier() + 
".wsdl").equals(pArtifact.getType())
-                        ))) {
+                artifactMatched = isArtifactMatched(targetArtifact, pArtifact);
+                if (targetArtifact.getClassifier() != null && 
pArtifact.getClassifier() != null 
+                        && 
targetArtifact.getClassifier().equals(pArtifact.getClassifier()) 
+                        && artifactMatched) {
+                       //handle multile classifiers
+                    return pArtifact;
+                } else if (artifactMatched && targetArtifact.getClassifier() 
== null) {
                     return pArtifact;
                 }
             }
         }
         return null;
     }
+    
+    private boolean isArtifactMatched(Artifact targetArtifact, Artifact 
pArtifact) {
+        return targetArtifact.getGroupId().equals(pArtifact.getGroupId())
+                && 
targetArtifact.getArtifactId().equals(pArtifact.getArtifactId())
+                && targetArtifact.getVersion().equals(pArtifact.getVersion())
+                && ("wsdl".equals(pArtifact.getType()) 
+                || (
+                        targetArtifact.getClassifier() != null
+                                && pArtifact.getType() != null
+                                && (targetArtifact.getClassifier() + 
".wsdl").equals(pArtifact.getType())
+                ));
+    }
 
 }
+

-- 
To stop receiving notification emails like this one, please contact
ff...@apache.org.

Reply via email to