maven - 使用 maven-jaxb2-plugin 从多个 wsdl 文件生成类

标签 maven wsdl jaxb2 maven-jaxb2-plugin

我可以像这样从一个 wsdl 文件生成类:

<plugin>
    <groupId>org.jvnet.jaxb2.maven2</groupId>
    <artifactId>maven-jaxb2-plugin</artifactId>
    <version>0.12.3</version>
    <configuration>
        <schemaLanguage>WSDL</schemaLanguage>
        <schemaDirectory>src/main/resources</schemaDirectory>
        <schemaIncludes>
            <include>bwl_1_1.wsdl</include>
        </schemaIncludes>
        <generatePackage>bwl.wsdl</generatePackage>
        <generateDirectory>${project.build.directory}/generated-sources/bwl</generateDirectory>
    </configuration>
</plugin>

当我尝试使用多个 <plugin> ,只生成其中之一。我发现如果我想从多个文件生成类,我应该使用 <executions> .但是,当我包装 <configuration> 时进入 <executions> ,它不再生成,实际上它从目录中的 xsd 文件生成了一些东西......

我不工作的尝试:
    <plugin>
        <groupId>org.jvnet.jaxb2.maven2</groupId>
        <artifactId>maven-jaxb2-plugin</artifactId>
        <version>0.12.3</version>

        <executions>
            <execution>
                <id>bwl</id>
                <goals>
                    <goal>generate</goal>
                </goals>
                <configuration>
                    <schemaLanguage>WSDL</schemaLanguage>
                    <schemaDirectory>src/main/resources</schemaDirectory>
                    <schemaIncludes>
                        <include>bwl_1_1.wsdl</include>
                    </schemaIncludes>
                    <generatePackage>bwl.wsdl</generatePackage>
                    <generateDirectory>${project.build.directory}/generated-sources/bwl</generateDirectory>
                </configuration>
            </execution>

            <execution>
                <id>score</id>
                <goals>
                    <goal>generate</goal>
                </goals>
                <configuration>
                    <schemaLanguage>WSDL</schemaLanguage>
                    <schemaDirectory>src/main/resources</schemaDirectory>
                    <schemaIncludes>
                        <include>score_1_1.wsdl</include>
                    </schemaIncludes>
                    <generatePackage>score.wsdl</generatePackage>
                    <generateDirectory>${project.build.directory}/generated-sources/score</generateDirectory>
                </configuration>
            </execution>
        </executions>

    </plugin>

谢谢你。

最佳答案

添加 ${basedir}<schemaDirectory> 中的路径前面标签如下

<schemaDirectory>${basedir}/src/main/resources</schemaDirectory>



那么它应该工作!

关于maven - 使用 maven-jaxb2-plugin 从多个 wsdl 文件生成类,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37002020/

相关文章:

maven - 在 jaxb2-maven-plugin 中为 schemagen 添加显式源目录

maven - 如何将 Spark 测试包含为 Maven 依赖项

c# - 将 WSDL 添加到项目只会创建类型,不会进入 app.config 并引发三个错误

java - Maven Javadoc 聚合 jar 插件因 Unresolved 依赖关系而失败

java - SOAP org.xmlpull.v1.XmlPullParserException : expected: START_TAG

wsdl - JAX-WS 与 JAXB 教程

java - JAXB 解码问题

java - 在格式化 JAXB 输出方面需要帮助

java - 为 Apache Tomcat Maven 插件 exec-war-only 目标声明额外资源?

java - 将 checkstyle/google_checks.xml 与 maven-checkstyle-plugin 一起使用时出错