0

How can I make the cxf-codegen-plugin and wsdl2java goal check that the xsd files used by the wsdls have been modified? When I make a change in the xsd and then run mvn verify it doesn't recompile the jar file.

Snippet of the plugin configuration.

<plugin>
    <groupId>org.apache.cxf</groupId>
    <artifactId>cxf-codegen-plugin</artifactId>
    <version>3.0.4</version>
    <executions>
        <execution>
            <id>generate-us-sources</id>
            <phase>generate-sources</phase>
            <configuration>
                <sourceRoot>${project.build.directory}/generated/cxf</sourceRoot>
                <wsdlOptions>
                    <wsdlOption>
                        <wsdl>${schemas.location}/usidentityservice.wsdl
                        </wsdl>
                        <extraargs>
                            <extraarg>-all</extraarg>
                            <extraarg>-impl</extraarg>
                            <extraarg>-validate</extraarg>
                            <extraarg> -wsdlLocation
                            </extraarg>
                            <extraarg> classpath:/us.wsdl
                            </extraarg>
                        </extraargs>
                    </wsdlOption>
                    <wsdlOption>
                        <wsdl>${schemas.location}/usv2.wsdl
                        </wsdl>
                        <extraargs>
                            <extraarg>-all</extraarg>
                            <extraarg>-impl</extraarg>
                            <extraarg>-validate</extraarg>
                            <extraarg> -wsdlLocation
                            </extraarg>
                            <extraarg> classpath:/usv2.wsdl
                            </extraarg>
                        </extraargs>
                    </wsdlOption>
                </wsdlOptions>
            </configuration>
            <goals>
                <goal>wsdl2java</goal>
            </goals>
        </execution>
    </executions>
</plugin>

An unfavorable solution would be to put the maven clean plugin so that it cleans each time and doesn't miss the xsd change but this will also clean it every time which makes the build slowed.

Captain Man
  • 6,997
  • 6
  • 48
  • 74
  • tried `mvn clean verify` ? – mediahype Nov 02 '15 at 16:24
  • @mediahype `clean verify` works because it deletes the jar so it knows it has to remake it, what I am trying to figure out is why changing the xsd doesn't trigger a recompilation and how to make it do this, was I not clear enough? (Honest question, no sarcasm intended) – Captain Man Nov 02 '15 at 16:34
  • oh... other guess: the verify phase comes before generate-sources, to wich you have the cxf plugin bound. Maybe running `mvn generate-sources` helps ? – mediahype Nov 02 '15 at 17:06
  • @mediahype thanks for the guess but according to the [default lifecycle](https://maven.apache.org/guides/introduction/introduction-to-the-lifecycle.html#Lifecycle_Reference) `generate-sources` is the third phase and `verify` is the third from last (and there are more than 4 :P ). – Captain Man Nov 02 '15 at 20:16

0 Answers0