cxf-codegen-plugin doesn't generate sources

时光毁灭记忆、已成空白 提交于 2019-11-29 16:59:30

问题


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>

回答1:


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.)




回答2:


In my case at least, I thought it wasn't generating source code as well, but it actually was. The issue was that the folder target/generated/cxf was designated by Eclipse as a source folder, which I didn't do manually. So the source was toward the top of my project, in package structure, not in the folder structure below, which is where I was looking and expecting it to be.




回答3:


In my case as long as I had the old target directory (defined in <sourceRoot>/path/to/target</sourceRoot>) nothing was being generated. Only after deleting the target folder manually plugin actually started to generate the sources.



来源:https://stackoverflow.com/questions/10164522/cxf-codegen-plugin-doesnt-generate-sources

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!