include wsimport into maven build process

to include the source-code-generation wsimport does for you into your maven build you can use the cxf-codegen-plugin as follows:

<plugin>
    <groupId>org.apache.cxf</groupId>
    <artifactId>cxf-codegen-plugin</artifactId>
    <version>2.5.2</version>
    <executions>
        <execution>
            <id>generate-sources</id>
            <phase>generate-sources</phase>
            <configuration>
                <sourceRoot>src/main/java</sourceRoot>
                <wsdlOptions>
                    <wsdlOption>
                        <wsdl>http://localhost:8080/SoapService?wsdl</wsdl>
                        <extraargs>
                            <extraarg>-client</extraarg>
                        </extraargs>
                    </wsdlOption>
                </wsdlOptions>
            </configuration>
            <goals>
                <goal>wsdl2java</goal>
            </goals>
        </execution>
    </executions>
</plugin>

This adds the generated resources to your maven source folder. Eclipse indigo complains about the plugin and generates a lifecycle-mapping to ignore this plugin during the eclipse build. So you have to call generate-sources or just compile manually in the shell.

Leave a Comment