maven - Axis2 数据绑定(bind) jaxbri + Maven : JAX-B RI JARs not on classpath

标签 maven jaxb apache-axis maven-plugin maven-3

自 2 天以来一直在尝试让 Maven 3.0.3 + axis2-wsdl2code-maven-plugin 1.5.4 与 jaxbri 数据绑定(bind)一起工作。错误消息:

java.lang.RuntimeException: JAX-B RI JARs not on classpath
    at org.apache.axis2.wsdl.codegen.extension.JAXBRIExtension.engage(JAXBRIExtension.java:78)
    at org.apache.axis2.wsdl.codegen.CodeGenerationEngine.generate(CodeGenerationEngine.java:224)

POM:

...
    <properties>
        <axis2ReleaseVersion>1.5.4</axis2ReleaseVersion>
        <axiomReleaseVersion>1.2.7</axiomReleaseVersion>
        <wodenReleaseVersion>1.0M8</wodenReleaseVersion>

    </properties>

    <dependencies>

        <dependency>
            <groupId>org.apache.axis2</groupId>
            <artifactId>axis2</artifactId>
            <version>${axis2ReleaseVersion}</version>
        </dependency>

        <dependency>
            <groupId>org.apache.ws.commons.axiom</groupId>
            <artifactId>axiom-api</artifactId>
            <version>${axiomReleaseVersion}</version>
        </dependency>

        <dependency>
            <groupId>org.apache.ws.commons.axiom</groupId>
            <artifactId>axiom-impl</artifactId>
            <version>${axiomReleaseVersion}</version>
        </dependency>

        <dependency>
            <groupId>org.apache.ws.commons.axiom</groupId>
            <artifactId>axiom-dom</artifactId>
            <version>${axiomReleaseVersion}</version>
        </dependency>

        <plugin>
            <groupId>org.apache.axis2</groupId>
            <artifactId>axis2-wsdl2code-maven-plugin</artifactId>
            <version>1.5.4</version>

            <configuration>
                <generateServerSide>true</generateServerSide>
                <generateServerSideInterface>true</generateServerSideInterface>
                <generateAllClasses>true</generateAllClasses>
                <!--<generateServicesXml>true</generateServicesXml> -->
                <!--<allPorts>true</allPorts> -->
                <!--<backwardCompatible>true</backwardCompatible> -->
                <!--<unwrap>true</unwrap> -->
            </configuration>
            <executions>
                <execution>
                    <goals>
                        <goal>wsdl2code</goal>
                    </goals>
                    <configuration>
                        <packageName>xyz</packageName>
                        <wsdlFile>${basedir}/src/main/resources/wsdl/Service.wsdl</wsdlFile>
                        <databindingName>jaxbri</databindingName>
                    </configuration>
                </execution>
            </executions>
        </plugin>

即使将 jaxb-ri jar 设置为依赖项也不起作用:

<dependency>
    <groupId>org.apache.axis2</groupId>
    <artifactId>axis2-jaxbri</artifactId>
    <version>1.5.4</version>
</dependency>

<dependency>
    <groupId>javax.xml.bind</groupId>
    <artifactId>jaxb-api</artifactId>
    <version>2.1</version>
    <scope>system</scope>
    <systemPath>${basedir}/src/main/resources/lib/jaxb-api-2.1.jar</systemPath>
</dependency>

<dependency>
    <groupId>com.sun.xml.bind</groupId>
    <artifactId>jaxb-impl</artifactId>
    <version>2.1.7</version>
    <scope>system</scope>
    <systemPath>${basedir}/src/main/resources/lib/jaxb-impl-2.1.7.jar</systemPath>
</dependency>

<dependency>
    <groupId>com.sun.tools</groupId>
    <artifactId>jaxb1-xjc</artifactId>
    <version>2.1.7</version>
    <scope>system</scope>
    <systemPath>${basedir}/src/main/resources/lib/jaxb-xjc-2.1.7.jar</systemPath>
</dependency>

预先感谢您的帮助。

最佳答案

插件不使用项目的依赖项。您还需要添加 axis2-jaxbri 作为 wsdl2code 插件的依赖项。

        <plugin>
            <groupId>org.apache.axis2</groupId>
            <artifactId>axis2-wsdl2code-maven-plugin</artifactId>
            <version>1.5.4</version>
            <executions>
                <execution>
                    <goals>
                        <goal>wsdl2code</goal>
                    </goals>
                </execution>
            </executions>
            <configuration>
                <packageName>.....</packageName>
                <wsdlFile>.....</wsdlFile>
                <databindingName>jaxbri</databindingName>
                <syncMode>sync</syncMode>
                <generateTestcase>false</generateTestcase>
            </configuration>
            <dependencies>
                <dependency>
                    <groupId>org.apache.axis2</groupId>
                    <artifactId>axis2-jaxbri</artifactId>
                    <version>1.5.4</version>
                </dependency>
            </dependencies>
        </plugin>

关于maven - Axis2 数据绑定(bind) jaxbri + Maven : JAX-B RI JARs not on classpath,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5302125/

相关文章:

java - 如何在一个 Jaxb2Marshaller 中处理更多 WSDL?

java - 如何使用 JAXB 在 java 中创建另一个元素?

java - 无法访问特定 weblogic 上的 web 应用程序的服务

java - PreparedStatement 和 Axis2

web-services - 在 WSO2 ESB 传出请求中使用 TLS 1.1/1.2

java - 关于 @Override 与接口(interface)的有趣问题

maven - 将所有定义的 Maven 项目属性导出到文件?

java - 使用默认值覆盖 Gradle 设置

java - 有没有一种方法可以将依赖项仅应用于一个包?

java - 用于不带命名空间的子树的 XmlstreamWriter 和 Jaxb