cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject cxf git commit: [CXF-7067] wsdlArtifact was not properly resolved
Date Fri, 30 Jun 2017 10:14:07 GMT
Repository: cxf
Updated Branches:
  refs/heads/master 88f8ce6eb -> 925697fb8


[CXF-7067] wsdlArtifact was not properly resolved


Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/925697fb
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/925697fb
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/925697fb

Branch: refs/heads/master
Commit: 925697fb861b5dd0be32fa04f72a60665bd2c0b0
Parents: 88f8ce6
Author: Dennis Kieselhorst <deki@apache.org>
Authored: Fri Jun 30 12:13:50 2017 +0200
Committer: Dennis Kieselhorst <deki@apache.org>
Committed: Fri Jun 30 12:13:50 2017 +0200

----------------------------------------------------------------------
 maven-plugins/codegen-plugin/pom.xml            | 13 +---
 maven-plugins/codegen-plugin/src/it/README.md   |  5 ++
 .../Cxf7067Service-1.0.0.wsdl                   | 82 ++++++++++++++++++++
 .../src/it/wsdl-artifact-resolution/pom.xml     | 68 ++++++++++++++++
 .../cxf/maven_plugin/AbstractCodegenMoho.java   |  7 +-
 .../wsdl2java/WsdlOptionLoader.java             |  2 +-
 maven-plugins/pom.xml                           |  3 +
 7 files changed, 169 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/925697fb/maven-plugins/codegen-plugin/pom.xml
----------------------------------------------------------------------
diff --git a/maven-plugins/codegen-plugin/pom.xml b/maven-plugins/codegen-plugin/pom.xml
index cba2f65..c1711cf 100644
--- a/maven-plugins/codegen-plugin/pom.xml
+++ b/maven-plugins/codegen-plugin/pom.xml
@@ -36,11 +36,6 @@
             <scope>test</scope>
         </dependency>
         <dependency>
-            <groupId>org.apache.maven.shared</groupId>
-            <artifactId>maven-artifact-resolver</artifactId>
-            <version>1.0</version>
-        </dependency>
-        <dependency>
             <groupId>org.apache.maven</groupId>
             <artifactId>maven-core</artifactId>
             <scope>provided</scope>
@@ -142,7 +137,7 @@
                 <groupId>org.apache.maven.plugins</groupId>
                 <artifactId>maven-plugin-plugin</artifactId>
                 <configuration>
-                    <!-- see http://jira.codehaus.org/browse/MNG-5346 -->
+                    <!-- see https://issues.apache.org/jira/browse/MNG-5346 -->
                     <skipErrorNoDescriptorsFound>true</skipErrorNoDescriptorsFound>
                 </configuration>
                 <executions>
@@ -163,7 +158,7 @@
                         <goals>
                             <goal>install</goal>
                         </goals>
-                        <configuration>
+                        <configuration><!-- has no effect -->
                             <localRepositoryPath>${project.build.directory}/it/repo</localRepositoryPath>
                         </configuration>
                     </execution>
@@ -172,10 +167,10 @@
             <plugin>
                 <groupId>org.apache.maven.plugins</groupId>
                 <artifactId>maven-invoker-plugin</artifactId>
-                <version>2.0.0</version>
+                <version>3.0.0</version>
                 <executions>
                     <execution>
-                        <id>test-toolchains-integration</id>
+                        <id>test-integration</id>
                         <phase>integration-test</phase>
                         <goals>
                             <goal>integration-test</goal>

http://git-wip-us.apache.org/repos/asf/cxf/blob/925697fb/maven-plugins/codegen-plugin/src/it/README.md
----------------------------------------------------------------------
diff --git a/maven-plugins/codegen-plugin/src/it/README.md b/maven-plugins/codegen-plugin/src/it/README.md
index b202bec..f42b169 100644
--- a/maven-plugins/codegen-plugin/src/it/README.md
+++ b/maven-plugins/codegen-plugin/src/it/README.md
@@ -10,3 +10,8 @@ This project contains sample maven module using `cxf-codegen-plugin` to
generate
 - it configures `maven-toolchains-plugins` to target JDK 6
 - cxf `fork` parameter if set to true to enable toolchain detection
 - if the toolchain wasn't correctly used by the cxf-codegen-plugin`, the the build should
fail during the _compile_ phase
+
+wsdl-artifact-resolution
+------------------------
+
+Verifies that a wsdlArtifact from local repository is properly resolved for codegen.

http://git-wip-us.apache.org/repos/asf/cxf/blob/925697fb/maven-plugins/codegen-plugin/src/it/wsdl-artifact-resolution/Cxf7067Service-1.0.0.wsdl
----------------------------------------------------------------------
diff --git a/maven-plugins/codegen-plugin/src/it/wsdl-artifact-resolution/Cxf7067Service-1.0.0.wsdl
b/maven-plugins/codegen-plugin/src/it/wsdl-artifact-resolution/Cxf7067Service-1.0.0.wsdl
new file mode 100644
index 0000000..9f6faa3
--- /dev/null
+++ b/maven-plugins/codegen-plugin/src/it/wsdl-artifact-resolution/Cxf7067Service-1.0.0.wsdl
@@ -0,0 +1,82 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+==============================================================================
+=====  Describe all service specific name spaces.                        =====          
    
+==============================================================================
+--><wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:tns="urn:org:apache:cxf:Cxf7067Service"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:cxf7067msg="urn:org:apache:cxf:message:Cxf7067Message"
targetNamespace="urn:org:apache:cxf:Cxf7067Service"><!--Content from Maven Artifact:
"org.apache.cxf.cxf7067:Cxf7067Service:wsdl:1.0.0" generated 2017-06-28T13:11:08CEST:-->
+<!--
+==============================================================================
+=====  Describe all data types transmitted between the client and server.=====          
   
+==============================================================================
+-->
+    <wsdl:types><xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:tns="urn:org:apache:cxf:cxf7067:Domain-1"
targetNamespace="urn:org:apache:cxf:cxf7067:Domain-1" elementFormDefault="qualified"><!--Content
from Maven Artifact: "org.apache.cxf.cxf7067:Domain-1:xsd:1.0.0":-->
+    <xsd:complexType name="Cxf7067DomainType">
+        <xsd:sequence>
+            <xsd:element name="Id" type="xsd:string" minOccurs="1" maxOccurs="1" />
+        </xsd:sequence>
+    </xsd:complexType>
+</xsd:schema><xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:tns="urn:org:apache:cxf:message:Cxf7067Message"
xmlns:domain="urn:org:apache:cxf:cxf7067:Domain-1" targetNamespace="urn:org:apache:cxf:message:Cxf7067Message"
elementFormDefault="qualified"><!--Content from Maven Artifact: "org.apache.cxf.cxf7067:Cxf7067Message:xsd:1.1.0":-->
+    <xsd:import namespace="urn:org:apache:cxf:cxf7067:Domain-1" />
+    <xsd:element name="Cxf7067Request" type="tns:Cxf7067RequestType" />
+    <xsd:element name="Cxf7067Response" type="tns:Cxf7067ResponseType" />
+    <xsd:complexType name="Cxf7067RequestType">
+        <xsd:sequence>
+            <xsd:element name="domain" type="domain:Cxf7067DomainType" />
+        </xsd:sequence>
+    </xsd:complexType>
+    <xsd:complexType name="Cxf7067ResponseType">
+        <xsd:sequence>
+            <xsd:element name="domain" type="domain:Cxf7067DomainType" />
+        </xsd:sequence>
+    </xsd:complexType>
+</xsd:schema></wsdl:types>
+<!--
+==============================================================================
+=====   Describe all messages transmitted between the client and server. =====          
    
+==============================================================================
+-->	
+    <wsdl:message name="cxf7067Request">
+        <wsdl:part name="cxf7067req" element="cxf7067msg:Cxf7067Request" />
+    </wsdl:message>
+    <wsdl:message name="cxf7067Response">
+        <wsdl:part name="cxf7067resp" element="cxf7067msg:Cxf7067Response" />
+    </wsdl:message>
+<!--
+==============================================================================
+=====   Describe interface and all operations.                           =====  
+==============================================================================
+-->	
+    <wsdl:portType name="Cxf7067Port">
+        <wsdl:operation name="cxf7067operation">
+            <wsdl:input message="tns:cxf7067Request" />
+            <wsdl:output message="tns:cxf7067Response" />
+        </wsdl:operation>
+    </wsdl:portType>
+<!--
+==============================================================================
+=====   Describe how the service will be implemented on the wire.        =====          
    
+==============================================================================
+-->	
+    <wsdl:binding name="Cxf7067PortBinding" type="tns:Cxf7067Port">
+        <soap:binding transport="http://schemas.xmlsoap.org/soap/http" />
+        <wsdl:operation name="cxf7067operation">
+            <soap:operation soapAction="cxf7067operation" style="document" />
+            <wsdl:input>
+                <soap:body use="literal" />
+            </wsdl:input>
+            <wsdl:output>
+                <soap:body use="literal" />
+            </wsdl:output>
+        </wsdl:operation>
+    </wsdl:binding>
+<!--
+==============================================================================
+=====   Describe where the service can be invoked.	                     =====           
   
+==============================================================================
+-->	
+    <wsdl:service name="Cxf7067Service">
+        <wsdl:port name="Cxf7067Port_pt" binding="tns:Cxf7067PortBinding">
+            <soap:address location="http://cxf.apache.cxf/ws/Cxf7067Service" />
+        </wsdl:port>
+    </wsdl:service>
+</wsdl:definitions>

http://git-wip-us.apache.org/repos/asf/cxf/blob/925697fb/maven-plugins/codegen-plugin/src/it/wsdl-artifact-resolution/pom.xml
----------------------------------------------------------------------
diff --git a/maven-plugins/codegen-plugin/src/it/wsdl-artifact-resolution/pom.xml b/maven-plugins/codegen-plugin/src/it/wsdl-artifact-resolution/pom.xml
new file mode 100644
index 0000000..91aaac5
--- /dev/null
+++ b/maven-plugins/codegen-plugin/src/it/wsdl-artifact-resolution/pom.xml
@@ -0,0 +1,68 @@
+<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.cxf</groupId>
+    <artifactId>cxf7067-codegen</artifactId>
+    <version>1.0.0-SNAPSHOT</version>
+    <packaging>jar</packaging>
+    <name>cxf7067-codegen</name>
+
+    <properties>
+        <wsdl.groupid>org.apache.cxf.cxf7067</wsdl.groupid>
+        <wsdl.artifactid>Cxf7067Service</wsdl.artifactid>
+        <wsdl.version>1.0.0</wsdl.version>
+    </properties>
+
+    <build>
+        <plugins>
+            <plugin>
+                <artifactId>maven-install-plugin</artifactId>
+                <version>2.5.2</version>
+                <executions>
+                    <execution>
+                        <goals>
+                            <goal>install-file</goal>
+                        </goals>
+                        <configuration>
+                            <groupId>${wsdl.groupid}</groupId>
+                            <artifactId>${wsdl.artifactid}</artifactId>
+                            <version>${wsdl.version}</version>
+                            <packaging>wsdl</packaging>
+                            <file>Cxf7067Service-1.0.0.wsdl</file>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.cxf</groupId>
+                <artifactId>cxf-codegen-plugin</artifactId>
+                <version>@project.version@</version>
+                <executions>
+                    <execution>
+                        <id>generate-sources</id>
+                        <phase>generate-sources</phase>
+                        <configuration>
+                            <wsdlOptions>
+                                <wsdlOption>
+                                    <wsdlArtifact>
+                                        <groupId>${wsdl.groupid}</groupId>
+                                        <artifactId>${wsdl.artifactid}</artifactId>
+                                        <version>${wsdl.version}</version>
+                                    </wsdlArtifact>
+                                    <wsdlLocation>classpath:${wsdl.artifactid}.wsdl</wsdlLocation>
+                                    <extraargs>
+                                        <extraarg>-verbose</extraarg>
+                                        <extraarg>-validate</extraarg>
+                                    </extraargs>
+                                </wsdlOption>
+                            </wsdlOptions>
+                        </configuration>
+                        <goals>
+                            <goal>wsdl2java</goal>
+                        </goals>
+                    </execution>
+                </executions>
+            </plugin>
+        </plugins>
+    </build>
+</project>

http://git-wip-us.apache.org/repos/asf/cxf/blob/925697fb/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/AbstractCodegenMoho.java
----------------------------------------------------------------------
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 88a0b21..6ae3a3d 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
@@ -37,6 +37,7 @@ import java.util.Set;
 
 import org.apache.commons.lang.SystemUtils;
 import org.apache.cxf.Bus;
+import org.apache.cxf.common.util.CollectionUtils;
 import org.apache.cxf.common.util.SystemPropertyAction;
 import org.apache.cxf.common.util.URIParserUtil;
 import org.apache.cxf.helpers.CastUtils;
@@ -869,7 +870,11 @@ public abstract class AbstractCodegenMoho extends AbstractMojo {
         request.setRemoteRepositories(mavenSession.getRequest().getRemoteRepositories());
         ArtifactResolutionResult result = repositorySystem.resolve(request);
 
-        return result.getOriginatingArtifact();
+        Artifact resolvedArtifact = result.getOriginatingArtifact();
+        if (resolvedArtifact == null && !CollectionUtils.isEmpty(result.getArtifacts()))
{
+            resolvedArtifact = result.getArtifacts().iterator().next();
+        }
+        return resolvedArtifact;
     }
 
     private Artifact findWsdlArtifact(Artifact targetArtifact, Collection<Artifact>
artifactSet) {

http://git-wip-us.apache.org/repos/asf/cxf/blob/925697fb/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/wsdl2java/WsdlOptionLoader.java
----------------------------------------------------------------------
diff --git a/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/wsdl2java/WsdlOptionLoader.java
b/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/wsdl2java/WsdlOptionLoader.java
index 4262c77..6444e31 100644
--- a/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/wsdl2java/WsdlOptionLoader.java
+++ b/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/wsdl2java/WsdlOptionLoader.java
@@ -71,7 +71,7 @@ public final class WsdlOptionLoader {
      * @param wsdlBasedir
      * @param includes file name patterns to include
      * @param excludes file name patterns to exclude
-     * @param defaultOptions options that should be used if no special file is given
+     * @param defaultOutputDir output directory that should be used if no special file is
given
      * @return list of one WsdlOption object for each wsdl found
      * @throws MojoExecutionException
      */

http://git-wip-us.apache.org/repos/asf/cxf/blob/925697fb/maven-plugins/pom.xml
----------------------------------------------------------------------
diff --git a/maven-plugins/pom.xml b/maven-plugins/pom.xml
index 55feffd..6ce0ae4 100644
--- a/maven-plugins/pom.xml
+++ b/maven-plugins/pom.xml
@@ -30,6 +30,9 @@
         <version>3.2.0-SNAPSHOT</version>
         <relativePath>../parent</relativePath>
     </parent>
+    <prerequisites>
+        <maven>${cxf.maven.core.version}</maven>
+    </prerequisites>
     <modules>
         <module>codegen-plugin</module>
         <module>java2ws-plugin</module>


Mime
View raw message