[CXF-6420] Update wsdl attachment to use the wsdlname to allow attaching multiple wsdls Patch from Andreas Panagiotidis applied with modifications for compatibility
Project: http://git-wip-us.apache.org/repos/asf/cxf/repo Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/d1fdbcda Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/d1fdbcda Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/d1fdbcda Branch: refs/heads/3.0.x-fixes Commit: d1fdbcdadd8e3f8f74cef8fd17ae78d509e05ab6 Parents: 103c145 Author: Daniel Kulp <[email protected]> Authored: Tue Jun 2 16:51:34 2015 -0400 Committer: Daniel Kulp <[email protected]> Committed: Tue Jun 2 16:55:10 2015 -0400 ---------------------------------------------------------------------- .../org/apache/cxf/maven_plugin/Java2WSMojo.java | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cxf/blob/d1fdbcda/maven-plugins/java2ws-plugin/src/main/java/org/apache/cxf/maven_plugin/Java2WSMojo.java ---------------------------------------------------------------------- diff --git a/maven-plugins/java2ws-plugin/src/main/java/org/apache/cxf/maven_plugin/Java2WSMojo.java b/maven-plugins/java2ws-plugin/src/main/java/org/apache/cxf/maven_plugin/Java2WSMojo.java index 6582f88..b0b78de 100644 --- a/maven-plugins/java2ws-plugin/src/main/java/org/apache/cxf/maven_plugin/Java2WSMojo.java +++ b/maven-plugins/java2ws-plugin/src/main/java/org/apache/cxf/maven_plugin/Java2WSMojo.java @@ -434,11 +434,23 @@ public class Java2WSMojo extends AbstractMojo { File wsdlFile = new File(outputFile); if (wsdlFile.exists()) { if (classifier != null) { - projectHelper.attachArtifact(project, "wsdl", classifier, wsdlFile); + projectHelper.attachArtifact(project, wsdlFile.getName(), classifier, wsdlFile); } else { - projectHelper.attachArtifact(project, "wsdl", wsdlFile); + projectHelper.attachArtifact(project, wsdlFile.getName(), wsdlFile); + } + boolean hasWsdlAttached = false; + for (Artifact a : project.getAttachedArtifacts()) { + if ("wsdl".equals(a.getType())) { + hasWsdlAttached = true; + } + } + if (!hasWsdlAttached) { + if (classifier != null) { + projectHelper.attachArtifact(project, "wsdl", classifier, wsdlFile); + } else { + projectHelper.attachArtifact(project, "wsdl", wsdlFile); + } } - } } }
