CXF maven plugin generates classes in wrong directory

I am using maven cxf-codegen-plugin to create java web service files from wsdl. The plugin works fine if I try to generate files in the default output directory (Target \ generated-sources \ CXF), but if I try to generate them in another directory using:

<sourceRoot>src/main/myOtherDir</sourceRoot>

in my pom.xml, files are only generated if I do this:

mvn clean eclipse:eclipse

If i do

mvn eclipse:eclipse 

without "cleaning" files are not generated ...

Does anyone have any ideas ....?

My pom:

        <plugin>
            <groupId>org.apache.cxf</groupId>
            <artifactId>cxf-codegen-plugin</artifactId>
            <version>${cxf.version}</version>
            <executions>
                <execution>
                    <id>generate-sources</id>
                    <configuration>
                        <sourceRoot>src/main/myOtherDir</sourceRoot> 
                        <wsdlOptions>
                            <wsdlOption>
                                <wsdl>src/main/resources/wsdl/AccountWS.wsdl</wsdl>
                            </wsdlOption>
                        </wsdlOptions>
                    </configuration>
                    <goals>
                        <goal>wsdl2java</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
    </plugins>

Thanks Alon

+3
source share
2 answers

You better set sourceRoot below the target directory so that it is cleared along with other content, for example:

<sourceRoot>${project.build.directory}/generated/cxf</sourceRoot>

, , , .

<executions>
  <execution>
    <id>generate-sources</id>
    <phase>process-resources</phase>
    ...
    <goals>
      <goal>wsdl2java</goal>
    </goals>
  </execution>
+3

, , ... wsdl, ...

apache cfx , : CXF 2.1.4 <phase>, .

+1

Source: https://habr.com/ru/post/1712464/


All Articles