1、新建maven工程
2、pom.xml文件中加入如下配置:
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
</dependency>
....
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-codegen-plugin</artifactId>
<version>3.1.11</version>
<executions>
<execution>
<id>generate-sources</id>
<phase>generate-sources</phase>
<configuration>
<!--源碼生成地址-->
<sourceRoot>${project.build.sourceDirectory}</sourceRoot>
<wsdlOptions>
<wsdlOption>
<wsdl>http://xxx/services/userAPI?wsdl</wsdl>
</wsdlOption>
</wsdlOptions>
</configuration>
<goals>
<goal>wsdl2java</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
3、選擇Maven Project,點擊Execute Maven Goal,輸入generate-sources,點擊Execute