我如何首先为apache cxf wsdl创建一个maven项目

Ran*_*han 5 wsdl cxf wsdl2java maven

我想使用wsdl从头开始创建一个apache cxf maven项目.我需要使用wsdl2java.我首先找不到wsdl的原型.当我尝试

mvn archetype:generate -Dfilter = org.apache.cxf.archetype:

我只看到这些.首先没有wsdl的原型吗?如果没有,有人可以推荐最有效的方法吗?谢谢

选择原型:1:remote - > org.apache.cxf.archetype:cxf-jaxrs-service(使用Spring配置的简单CXF JAX-RS webap p服务)2:remote - > org.apache.cxf.archetype:cxf-jaxws -javafirst(从Java代码开始创建用于开发Web服务的项目)

And*_*wik 0

我总是为生成的 wsdl 创建子模块。Eclipse 存在路径问题 - 并且该模块不需要多次编译。

对于客户:

<properties>
    <wsdl.dir>${basedir}/src/main/resources/axis2</wsdl.dir>
    <generateServerSide>false</generateServerSide>
    <sourceRoot>${basedir}/target/generated/src/main/java</sourceRoot>
</properties>

<build>
    <pluginManagement>
        <plugins>
            <plugin>
                <groupId>org.apache.cxf</groupId>
                <artifactId>cxf-codegen-plugin</artifactId>
                <version>${cxf.version}</version><!--$NO-MVN-MAN-VER$ -->
                <executions>
                    <execution>
                        <id>generate-sources</id>
                        <phase>generate-sources</phase>
                        <configuration>
                            <sourceRoot>${sourceRoot}</sourceRoot>
                            <defaultOptions>
                                <bindingFiles>
                                    <bindingFile>${wsdl.dir}/binding.xml</bindingFile>
                                </bindingFiles>
                            </defaultOptions>
                            <wsdlOptions>
                                <wsdlOption>
                                    <wsdl>${wsdl.dir}/first.wsdl</wsdl>
                                    <packagenames>
                                        <packagename>com.company.gen.first</packagename>
                                    </packagenames>
                                    <extraargs>
                                        <extraarg>-impl</extraarg>
                                        <extraarg>-autoNameResolution</extraarg>
                                        <extraarg>-wsdlLocation</extraarg>
                                        <wsdlurl />
                                    </extraargs>
                                </wsdlOption>
                            </wsdlOptions>
                        </configuration>
                        <goals>
                            <goal>wsdl2java</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>


            <plugin> <!-- for idea/eclipse -->
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>build-helper-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <id>add-source</id>
                        <phase>generate-sources</phase>
                        <goals>
                            <goal>add-source</goal>
                        </goals>
                        <configuration>
                            <sources>
                                <source>${sourceRoot}</source>
                            </sources>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </pluginManagement>
</build>
Run Code Online (Sandbox Code Playgroud)

对于服务器:

            <execution>
                <id>first</id>
                <goals>
                    <goal>wsdl2code</goal>
                </goals>
                <configuration>
                    <generateServerSide>${generateServerSide}</generateServerSide>
                    <generateAllClasses>${generateServerSide}</generateAllClasses>
                    <generateServicesXml>${generateServerSide}</generateServicesXml>
                    <generateServerSideInterface>${generateServerSide}</generateServerSideInterface>
                    <wsdlFile>${wsdl.dir}/first.wsdl</wsdlFile>
                    <packageName>com.company.gen.first</packageName>
                    <unpackClasses>true</unpackClasses>
                    <syncMode>sync</syncMode>
                    <namespaceURIs>
                        <namespaceURI>
                            <uri>http://uri.company.com</uri>
                            <packageName>com.company.gen.first</packageName>
                        </namespaceURI>
                    </namespaceURIs>

                </configuration>
            </execution>
Run Code Online (Sandbox Code Playgroud)