cxf-codegen-plugin doesn't generate sources

Vespasian picture Vespasian · Apr 15, 2012 · Viewed 16.1k times · Source

I'm trying to get the cxf-codegen-plugin to generate sources from my wsdl file. When calling wsdl2java manual the desired classes are generated but when using mvn generate-sources nothing happens and I get the message "No goals needed for project". Calling the plugin directly doesn't helps.

The extract from my poms 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>${project.build.directory}/generated/cxf</sourceRoot>
                <wsdlOptions>
                    <wsdlOption>
                        <wsdl>${basedir}/src/main/MyServiceInterface.wsdl</wsdl>
                    </wsdlOption>
                </wsdlOptions>
            </configuration>
            <goals>
                <goal>wsdl2java</goal>
            </goals>
        </execution>
    </executions>
</plugin>

Answer

Donal Fellows picture Donal Fellows · Apr 15, 2012

That looks very much like the way I (successfully) configure that plugin in one of my projects; I would expect that to work. (I believe you can omit the <sourceRoot>; the default setting for that is the one you've stated.)

The only thing I can think of would be if you had put that plugin configuration in either a non-active Maven profile or (more likely) in the <pluginManagement> section instead of the straight <plugins> section; the pluginManagement section overrides aspects of the configuration of plugins, but doesn't actually enable them for use. (It does however affect explicit usage; I know you don't want to do that.)