Skip to content

codecentric/cxf-spring-boot-starter-maven-plugin

Repository files navigation

cxf-spring-boot-starter-maven-plugin complementing cxf-spring-boot-starter

Build Status Maven Central Dependency Status License

While a spring-boot-starter like cxf-spring-boot-starter generally only serves as a Maven dependency, something that will be executed in the build-section is not delivered in such a way. But the generation of JAX-B Classfiles is a good candidate to run inside the build-process - so the resulting files aren´t checked into source control system. The configuration e.g. of the jaxws-maven-plugin is rather complex to work properly and one has to do some research, till all necessary configuration parameters are set properly (something like this has to be done - just have a look into the build section of the pom).

Features include:

  • Generating all necessary Java-Classes using JAX-B from your WSDL/XSDs, complementing the cxf-spring-boot-starter
  • This works also for complex imports of many XSD files, that inherit other XSDs themselfs
  • The generated JAX-B Classfiles will be added to your projects classpath - ready to map & transform into whatever you want
  • Scanning your resource-Folder for the WSDL and configuring the jaxws-maven-plugin, so that non-absolute paths will be generated into @WebServiceClient-Class
  • Extract the targetNamespace from the WSDL, generate the SEI and WebServiceClient annotated classes´ package names from it & write it together with the project´s package name into a cxf-spring-boot-maven.properties to enable Complete automation of Endpoint initialization in the cxf-spring-boot-starter (documentation here)

HowTo

  • Put your WSDL into some folder under /src/main/resources/ OR /src/test/resources/ - and add your XSDs, so they could be imported correct (relatively)
  • If you want to tweak your Namespace-Names, put a binding.xml into the same folder, where your WSDL resides
  • add this plugin to your pom´s build-section:
<build>
    <plugins>
        <plugin>
            <groupId>de.codecentric</groupId>
            <artifactId>cxf-spring-boot-starter-maven-plugin</artifactId>
            <version>1.1.4.RELEASE</version>
            <executions>
                <execution>
                    <goals>
                        <goal>generate</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
    </plugins>
</build>
  • it will be executed, if you run a standard:
mvn clean generate-sources

(or directly):

mvn cxf-spring-boot-starter:generate
  • The generated JAX-B Classfiles will be placed in target/generated-sources/wsdlimport

Dones