为什么 axistools-maven-plugin 尝试访问此相对架构位置?

发布于 2024-10-14 02:51:35 字数 3571 浏览 3 评论 0原文

我们正在使用 Axis 1.x 做一个 Web 服务项目,但我在使 Maven 构建正常工作时遇到问题。

我做了一个

 mvn clean generate-sources

触发 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)

这是正确的。该文件不存在。 (并且 -e 不会产生任何其他有用信息 - 它是由 MojoExecutionException 引起的 LifecycleExecutionException、由 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>

这对于我所有的同事来说似乎都工作得很好。我们都使用 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>

我已经完全清除了我的本地 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

如果您像我一样,现在认为也许 ./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

We're doing a web service project with Axis 1.x and I'm having problems getting the Maven build to work.

I do a

 mvn clean generate-sources

which triggers axistools-maven-plugin's wsdl2java goal. It eventually aborts with

[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)

This is correct. That file doesn't exist. (And -e yields no additional useful information -- it's a LifecycleExecutionException, caused by a MojoExecutionException, caused by an AxisPluginException, caused by a FileNotFoundException.)

The point is, it shouldn't search for WEB-INF\project.xsd, it should access WEB-INF\wsdl\project.xsd.

Here's what the WSDL says:

<wsdl:types>
    <xsd:schema targetNamespace="http://domain/project/">
        <xsd:import namespace="http://domain/schema/" schemaLocation="project.xsd"/>
    </xsd:schema>
</wsdl:types>

This seems to work fine for all my coworkers. We're all using Maven 2.2.1 and axistools-maven-plugin is pinned to 1.4 with the following configuration:

  <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>

I already completely cleared my local Maven repository, hoping that it was a rogue dependency, but that didn't change anything. Any idea what could be causing this just for me, but not for my coworkers?


EDIT 1: I tried changing the schemaLocation to wsdl/project.xsd (just for testing purposes, I won't be able to make any permanent modifications to the WSDL) and got this amusing result:

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

If you are, like me, now thinking that maybe ./project.xsd might work... nope, sorry, that makes it search directly for WEB-INF/project.xsd again.


EDIT 2: Okay, now axistools is just teasing me...

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

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

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

As a reminder, the correct path would be src/main/webapp/WEB-INF/wsdl/project.xsd.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

向日葵 2024-10-21 02:51:35

尝试使用 useEmitter 标签,例如:

    <plugins>
        <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>axistools-maven-plugin</artifactId>
            <version>1.4</version>
            <configuration>
                <useEmitter>true</useEmitter>

...

Try to use the useEmitter tag like:

    <plugins>
        <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>axistools-maven-plugin</artifactId>
            <version>1.4</version>
            <configuration>
                <useEmitter>true</useEmitter>

...

糖粟与秋泊 2024-10-21 02:51:35

我能够通过确保项目位置的路径不包含空格来解决此问题。因此,Win XP 上的默认位置将不起作用(“文档和设置”)

I was able to resolve this issue by ensuring that the path of the project location does not contain spaces. Therefore, the default location on Win XP will not work ("Documents and Settings")

无声情话 2024-10-21 02:51:35

不幸的是,当启用 时, 功能不再起作用。

因此,我必须将生成分为两个“执行”,

  • 首先是所有不带 XSD 且带有 true 的 WSDL
  • ,然后是带有 XSD 的包含(幸运的是我只有一个)带有 < code>true(并且文件名显式添加到

Unfortunately when <useEmitter> is enabled <subPackageByFileName> feature does not work anymore.

So I had to split generation into two "executions"

  • first all WSDLs without XSD and with <subPackageByFileName>true</subPackageByFileName>
  • and then the one with XSD include (luckily I have just one) with <useEmitter>true</useEmitter> (and the file name explicitly added to <packageSpace>)
野生奥特曼 2024-10-21 02:51:35

如上所述,我在使用 Maven 构建时也遇到了同样的问题,我能够通过确保项目位置的路径不包含空格来解决此问题。

I also got the same issue while building with maven as mentioned and I was able to resolve this issue by ensuring that the path of the project location does not contain spaces.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文