为什么axistools-maven-plugin试图访问这个相对模式位置?

Hen*_*ger 4 java axis maven-2 wsdl2java

我们正在使用Axis 1.x进行Web服务项目,并且我在使Maven构建工作时遇到了问题.

我做了

 mvn clean generate-sources
Run Code Online (Sandbox Code Playgroud)

这触发了axistools-maven-plugin的wsdl2java目标.它最终会中止

[INFO] [axistools:wsdl2java {execution: generate-project}]
[INFO] about to add compile source root
[INFO] Processing wsdl: C:\Project\src\main\webapp\WEB-INF\wsdl\project.wsdl
Jan 24, 2011 11:24:58 AM org.apache.axis.utils.JavaUtils isAttachmentSupported
WARNING: Unable to find required classes (javax.activation.DataHandler and javax.mail.internet.MimeMultipart). Attachment support is disabled.
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Error generating Java code from WSDL.

Embedded error: Error running Axis
C:\Project\src\main\webapp\WEB-INF\project.xsd (The system cannot find the file specified)
Run Code Online (Sandbox Code Playgroud)

这是对的.该文件不存在.(并且-e不会产生额外的有用信息 - 这是一个LifecycleExecutionException,由MojoExecutionException引起,由AxisPluginException引起,由FileNotFoundException引起.)

关键是,它不应该搜索WEB-INF\project.xsd,它应该访问WEB-INF\wsdl\project.xsd.

这是WSDL所说的:

<wsdl:types>
    <xsd:schema targetNamespace="http://domain/project/">
        <xsd:import namespace="http://domain/schema/" schemaLocation="project.xsd"/>
    </xsd:schema>
</wsdl:types>
Run Code Online (Sandbox Code Playgroud)

这似乎对我的所有同事都很好.我们都使用Maven 2.2.1,axistools-maven-plugin固定为1.4,配置如下:

  <plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>axistools-maven-plugin</artifactId>
    <version>1.4</version>
    <executions>
      <execution>
        <id>generate-project</id>
        <goals>
          <goal>wsdl2java</goal>
        </goals>
        <configuration>
          <sourceDirectory>${basedir}/src/main/webapp/WEB-INF/wsdl/</sourceDirectory>
          <outputDirectory>target/generated-sources</outputDirectory>
          <serverSide>true</serverSide>
          <testCases>false</testCases>
          <wrapArrays>false</wrapArrays>
        </configuration>
      </execution>
    </executions>
  </plugin>
Run Code Online (Sandbox Code Playgroud)

我已经完全清除了我当地的Maven存储库,希望它是一个流氓依赖,但这并没有改变任何东西.知道是什么原因造成这种情况只适合我,但不是我的同事吗?


编辑1:我尝试将schemaLocation更改为wsdl/project.xsd(仅用于测试目的,我将无法对WSDL进行任何永久性修改)并得到了这个有趣的结果:

Embedded error: Error running Axis
WSDLException (at /wsdl:definitions/wsdl:types/xsd:schema):
    faultCode=OTHER_ERROR: An error occurred trying to resolve
    schema referenced at 'wsdl\project.xsd', relative to
    'file:/C:/Project/src/main/webapp/WEB-INF/wsdl/project.wsdl'.:
    This file was not found:
    file:/C:/Project/src/main/webapp/WEB-INF/wsdl/wsdl/project.xsd
Run Code Online (Sandbox Code Playgroud)

如果你像我一样,现在想也许./project.xsd可能会工作......不,抱歉,这让它WEB-INF/project.xsd再次直接搜索.


编辑2:好的,现在axistools只是在戏弄我......

../project.xsd
- > src/main/webapp/project.xsd(错)

../wsdl/project.xsd
- > src/main/webapp/wsdl/project.xsd(错)

../WEB-INF/wsdl/project.xsd
- > src/main/webapp/WEB-INF/WEB-INF/wsdl/project.xsd(错)

提醒一下,正确的道路是src/main/webapp/WEB-INF/wsdl/project.xsd.

小智 7

尝试使用useEmitter标记,如:

    <plugins>
        <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>axistools-maven-plugin</artifactId>
            <version>1.4</version>
            <configuration>
                <useEmitter>true</useEmitter>
Run Code Online (Sandbox Code Playgroud)

...