0

I'm trying to get the cxf-codegen-plugin to generate sources from my wsdl file. But Nothing happens when i execute mvn generate-source with eclipse luna. It looks like plugin itself not configured properly.

My pom.xml

        <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/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>com.webservice</groupId>
    <artifactId>wsdlfirstwebservice</artifactId>
    <packaging>war</packaging>
    <version>0.0.1-SNAPSHOT</version>
    <name>wsdlfirstwebservice Maven Webapp</name>
    <url>http://maven.apache.org</url>

    <properties>
        <jdk.version>1.8</jdk.version>
        <cxf.version>3.0.4</cxf.version>
        <jaxb.version>2.2</jaxb.version>
    </properties>
    <dependencies>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>3.8.1</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.cxf</groupId>
            <artifactId>cxf-rt-frontend-jaxws</artifactId>
            <version>${cxf.version}</version>
        </dependency>

        <dependency>
            <groupId>org.apache.cxf</groupId>
            <artifactId>cxf-rt-frontend-jaxrs</artifactId>
            <version>${cxf.version}</version>
        </dependency>

        <dependency>
            <groupId>org.apache.cxf</groupId>
            <artifactId>cxf-rt-transports-http</artifactId>
            <version>${cxf.version}</version>
        </dependency>
        <dependency>
            <groupId>com.sun.xml.bind</groupId>
            <artifactId>jaxb-impl</artifactId>
            <version>${jaxb.version}</version>
        </dependency>
        <dependency>
            <groupId>com.sun.xml.bind</groupId>
            <artifactId>jaxb-xjc</artifactId>
            <version>${jaxb.version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.cxf</groupId>
            <artifactId>cxf-codegen-plugin</artifactId>
            <version>3.0.4</version>
        </dependency>

    </dependencies>
    <build>
        <finalName>Wrsdlfirstwebservice</finalName>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <configuration>
                        <source>${jdk.version}</source>
                        <target>${jdk.version}</target>
                    </configuration>
                </plugin>
                <plugin>
                    <artifactId>maven-war-plugin</artifactId>
                    <version>2.1</version>
                    <configuration>
                        <webXml>src/main/webapp/WEB-INF/web.xml</webXml>
                    </configuration>
                </plugin>


                <plugin>
                    <groupId>org.apache.cxf</groupId>
                    <artifactId>cxf-codegen-plugin</artifactId>
                    <version>${cxf.version}</version>
                    <executions>
                        <execution>
                            <id>generate-sources</id>
                            <phase>generate-sources</phase>
                            <configuration>
                                <sourceRoot>${project.build.directory}/generated/cxf</sourceRoot>
                                <wsdlOptions>
                                    <wsdlOption>
                                        <wsdl>src/main/resources/CustomerOrders.wsdl</wsdl>
                                        <bindingFiles>
                                            <bindingFile>src/main/resources/wsdl/binding.xml</bindingFile>
                                        </bindingFiles>
                                    </wsdlOption>
                                </wsdlOptions>
                            </configuration>
                            <goals>
                                <goal>wsdl2java</goal>
                            </goals>
                        </execution>
                    </executions>
                    <dependencies>
                        <dependency>
                            <groupId>com.sun.xml.bind</groupId>
                            <artifactId>jaxb-impl</artifactId>
                            <version>${jaxb.version}</version>
                        </dependency>
                        <dependency>
                            <groupId>com.sun.xml.bind</groupId>
                            <artifactId>jaxb-xjc</artifactId>
                            <version>${jaxb.version}</version>
                        </dependency>
                    </dependencies>
                </plugin>
            </plugins>
        </pluginManagement>
    </build>
</project>

My wsdl

<?xml version="1.0" encoding="UTF-8"?>
    <wsdl:definitions name="CustomerOrdersService"   
       xmlns:xsd="http://www.w3.org/2001/XMLSchema"
       xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
       xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
       xmlns:tns="http://www.wsdlfirstwebservice.com/customerorders"   
       targetNamespace="http://www.wsdlfirstwebservice.com/customerorders">
        <!-- Types -->
        <wsdl:types>
            <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
                xmlns:tns="http://www.wsdlfirstwebservice.com/customerorders"
                targetNamespace="http://www.wsdlfirstwebservice.com/customerorders">

                <xs:complexType name="order">
                    <xs:sequence>
                        <xs:element name="id" type="xs:integer"/>
                        <xs:element name="product" type="tns:product" maxOccurs="unbounded"/>
                    </xs:sequence>
                </xs:complexType>
                <xs:complexType name="product">
                    <xs:sequence>
                        <xs:element name="id" type="xs:integer" minOccurs="0"/>
                        <xs:element name="description" type="xs:string" minOccurs="0"/>
                        <xs:element name="quantity" type="xs:integer" minOccurs="0"/>                   
                    </xs:sequence>
                </xs:complexType>
                <xs:complexType name="getOrdersRequest">
                    <xs:sequence>
                        <xs:element name="customerId" type="xs:integer" minOccurs="0"/> 
                    </xs:sequence>
                </xs:complexType>
                 <xs:complexType name="getOrdersResponse">
                    <xs:sequence>
                        <xs:element name="order" type="tns:order" minOccurs="0" maxOccurs="unbounded"/> 
                    </xs:sequence>
                </xs:complexType>

                <xs:element name="getOrdersRequest" type="tns:getOrdersRequest"/>
                <xs:element name="getOrdersResponse" type="tns:getOrdersResponse"/>

            </xs:schema>
        </wsdl:types>

        <!-- Messages :
        These are analogous to method parameters and return types in java methods
        -->
        <wsdl:message name="getOrdersRequest">
            <wsdl:part name="parameters" element="tns:getOrdersRequest">
            </wsdl:part>
        </wsdl:message>
        <wsdl:message name="getOrdersResponse">
            <wsdl:part name="parameters" element="tns:getOrdersResponse">
            </wsdl:part>
        </wsdl:message>

        <!-- Port types 
        These are analogous to java methods.  Port types use message as input and/or output.
         -->
        <wsdl:portType name="CustomerOrdersPortType">
            <wsdl:operation name="getOrders">
                <wsdl:input name="getOrdersRequest" message="tns:getOrdersRequest"></wsdl:input>
                <wsdl:output name="getOrdersResponse" message="tns:getOrdersResponse"></wsdl:output>
            </wsdl:operation>
        </wsdl:portType>

        <!-- Bindings 
            This defines the message formats and protocol details for web service
         -->
         <wsdl:binding name="CustomerOrdersServiceSoapBinding" type="tns:CustomerOrdersPortType">
            <soap:binding style="document"  transport="http://schemas.xmlsoap.org/soap/http"/>
            <wsdl:operation name="getOrders">
                <soap:operation soapAction="" style="document"/>
                <wsdl:input name="getOrdersRequest">
                    <soap:body use="literal"/>
                </wsdl:input>
                <wsdl:output name="getOrdersResponse">
                    <soap:body use="literal"/>
                </wsdl:output>
            </wsdl:operation>
         </wsdl:binding>

         <!-- Service
         Tells customer how to consume the service
          -->
         <wsdl:service name="CustomerOrdersService">
            <wsdl:port name="CustomerOrdersPort" binding="tns:CustomerOrdersServiceSoapBinding">
                <soap:address location="http://localhost:8080/wsdlfirstwebservice/services/CustomerOrdersService"/>
            </wsdl:port>
         </wsdl:service>
     </wsdl:definitions>

Console Output

Apache Maven 3.2.1 (ea8b2b07643dbb1b84b6d16e1f08391b666bc1e9; 2014-02-14T23:07:52+05:30) Maven home: D:\JSPractice\wsdlfirstwebservice\EMBEDDED Java version: 1.8.0_60, vendor: Oracle Corporation Java home: C:\Program Files (x86)\Java\jdk1.8.0_60\jre Default locale: en_IN, platform encoding: Cp1252 OS name: "windows 7", version: "6.1", arch: "x86", family: "dos" [INFO] Error stacktraces are turned on. [DEBUG] Reading global settings from EMBEDDED\conf\settings.xml [DEBUG] Reading user settings from C:\Users\D.Sama.m2\settings.xml [DEBUG] Using local repository at C:\Users\D.Sama.m2\repository [DEBUG] Using manager EnhancedLocalRepositoryManager with priority 10.0 for C:\Users\D.Sama.m2\repository [INFO] Scanning for projects... [DEBUG] Extension realms for project com.webservice:wsdlfirstwebservice:war:0.0.1-SNAPSHOT: (none) [DEBUG] Looking up lifecyle mappings for packaging war from ClassRealm[plexus.core, parent: null] [DEBUG] === REACTOR BUILD PLAN ================================================ [DEBUG] Project: com.webservice:wsdlfirstwebservice:war:0.0.1-SNAPSHOT [DEBUG] Tasks:
[generate-sources] [DEBUG] Style: Regular [DEBUG] ======================================================================= [INFO] [INFO] Using the builder org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder with a thread count of 1 [INFO]
[INFO] ------------------------------------------------------------------------ [INFO] Building wsdlfirstwebservice Maven Webapp 0.0.1-SNAPSHOT [INFO] ------------------------------------------------------------------------ [DEBUG] Lifecycle default -> [validate, initialize, generate-sources, process-sources, generate-resources, process-resources, compile, process-classes, generate-test-sources, process-test-sources, generate-test-resources, process-test-resources, test-compile, process-test-classes, test, prepare-package, package, pre-integration-test, integration-test, post-integration-test, verify, install, deploy] [DEBUG] Lifecycle clean -> [pre-clean, clean, post-clean] [DEBUG] Lifecycle site -> [pre-site, site, post-site, site-deploy] [DEBUG] === PROJECT BUILD PLAN ================================================ [DEBUG] Project: com.webservice:wsdlfirstwebservice:0.0.1-SNAPSHOT [DEBUG] Dependencies (collect): [] [DEBUG] Dependencies (resolve): [] [DEBUG] Repositories (dependencies): [central (http://repo.maven.apache.org/maven2, releases)] [DEBUG] Repositories (plugins) : [central (http://repo.maven.apache.org/maven2, releases)] [DEBUG] ======================================================================= [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESS [INFO] ------------------------------------------------------------------------ [INFO] Total time: 0.101 s [INFO] Finished at:

2016-09-11T14:27:19+05:30 [INFO] Final Memory: 4M/15M [INFO]

Gnani
  • 139
  • 1
  • 8
  • 2
    Possible duplicate of [Maven: what is pluginManagement?](http://stackoverflow.com/questions/10483180/maven-what-is-pluginmanagement) – Tunaki Sep 11 '16 at 13:15

1 Answers1

1

You need to put cxf-codegen plugin in your build/plugins part, not only in build/pluginManagement/plugins.

YMomb
  • 2,366
  • 1
  • 27
  • 36