如何使用 Axistools-maven-plugin 将 WDSL 转换为 Java?

发布于 2024-12-10 20:44:16 字数 1201 浏览 0 评论 0原文

我配置了 axistools-maven-plugin 如下:

<plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>axistools-maven-plugin</artifactId>
    <version>1.4</version>
    <configuration>
        <wsdlDirectory>/src/main/resources</wsdlDirectory>
        <wsdlFiles>
            <wsdlFile>adjustment.wsdl</wsdlFile>
        </wsdlFiles>
        <keep>true</keep>
        <allElements>true</allElements>
        <outputDirectory>/src/main/java</outputDirectory>
        <subPackageByFileName>true</subPackageByFileName>
        <useEmitter>true</useEmitter>
        <wsdlVersion>2</wsdlVersion>
    </configuration>
    <executions>
        <execution>
            <goals>
                <goal>wsdl2java</goal>
            </goals>
        </execution>
    </executions>
</plugin>

但是我的 wsdl 文件没有被正确引用。配置是否正确?

我总是收到以下信息消息

[INFO] Nothing to generate. All WSDL files are up to date.

I configured the axistools-maven-plugin as follows:

<plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>axistools-maven-plugin</artifactId>
    <version>1.4</version>
    <configuration>
        <wsdlDirectory>/src/main/resources</wsdlDirectory>
        <wsdlFiles>
            <wsdlFile>adjustment.wsdl</wsdlFile>
        </wsdlFiles>
        <keep>true</keep>
        <allElements>true</allElements>
        <outputDirectory>/src/main/java</outputDirectory>
        <subPackageByFileName>true</subPackageByFileName>
        <useEmitter>true</useEmitter>
        <wsdlVersion>2</wsdlVersion>
    </configuration>
    <executions>
        <execution>
            <goals>
                <goal>wsdl2java</goal>
            </goals>
        </execution>
    </executions>
</plugin>

but my wsdl files are not being referred properly. Is the configuration correct?

I am getting the following info msg always

[INFO] Nothing to generate. All WSDL files are up to date.

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

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

发布评论

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

评论(4

枉心 2024-12-17 20:44:16

对我来说这是目录参数名称。它不是 而是 。无论如何,这是我的工作配置:

<plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>axistools-maven-plugin</artifactId>
    <version>1.4</version>
    <configuration>
        <!--  A directory where the WSDL files reside: -->
        <sourceDirectory>${basedir}/src/main/resources/</sourceDirectory>
        <!-- The list of WSDL files: -->
        <wsdlFiles>
            <wsdlFile>services.wsdl</wsdlFile>
        </wsdlFiles>
        <allElements>true</allElements>
        <!-- Where you want the generated files: -->
        <outputDirectory>${basedir}/src/main/java</outputDirectory>
        <subPackageByFileName>true</subPackageByFileName>
        <useEmitter>false</useEmitter>
        <verbose>true</verbose>
    </configuration>
    <executions>
        <execution>
            <goals>
                <goal>wsdl2java</goal>
            </goals>
        </execution>
    </executions>
</plugin>

For me it was the directory parameter name. It's not <wsdlDirectory> but <sourceDirectory>. Anyway, here's my working config:

<plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>axistools-maven-plugin</artifactId>
    <version>1.4</version>
    <configuration>
        <!--  A directory where the WSDL files reside: -->
        <sourceDirectory>${basedir}/src/main/resources/</sourceDirectory>
        <!-- The list of WSDL files: -->
        <wsdlFiles>
            <wsdlFile>services.wsdl</wsdlFile>
        </wsdlFiles>
        <allElements>true</allElements>
        <!-- Where you want the generated files: -->
        <outputDirectory>${basedir}/src/main/java</outputDirectory>
        <subPackageByFileName>true</subPackageByFileName>
        <useEmitter>false</useEmitter>
        <verbose>true</verbose>
    </configuration>
    <executions>
        <execution>
            <goals>
                <goal>wsdl2java</goal>
            </goals>
        </execution>
    </executions>
</plugin>
很酷又爱笑 2024-12-17 20:44:16

当我在 wsdlFile 中出现拼写错误时,收到几乎相同的(信息)消息!
实际消息是:“跳过最新的 wsdl”

例如

<sourceDirectory>src\main\resources\wsdl\release\x.y\</sourceDirectory>
<wsdlFiles>
       <wsdlFile>ABCWebservicex.y.wsdl</wsdlFile>  <!-- typo here -->
</wsdlFiles>

,存在的文件是:ABCWebservice_x.y.wsdl

Got almost the same (info) message when i had a typo in wsdlFile!
The actual message was: "Skipping up to date wsdl"

e.g.

<sourceDirectory>src\main\resources\wsdl\release\x.y\</sourceDirectory>
<wsdlFiles>
       <wsdlFile>ABCWebservicex.y.wsdl</wsdlFile>  <!-- typo here -->
</wsdlFiles>

And the file present was: ABCWebservice_x.y.wsdl

聽兲甴掵 2024-12-17 20:44:16

跳过 /src/main/java/src/main/resources 中的前导斜杠可能会有所帮助。

编辑:我仔细查看了我的工作配置。我不知道你是怎么想到这个的:

<wsdlDirectory>src/main/resources</wsdlDirectory>

可能应该是:

<sourceDirectory>src/main/resources</sourceDirectory>

Skipping the leading slash in /src/main/java and /src/main/resources will probably help.

Edit: I've taken a closer look at my working configuration. I don't know how you came to this:

<wsdlDirectory>src/main/resources</wsdlDirectory>

Should probably be:

<sourceDirectory>src/main/resources</sourceDirectory>
如日中天 2024-12-17 20:44:16

如果您在同一个 wsdlfiles 标签下使用多个 wsdls,那么您可能会遇到如下跳过信息:

<wsdlFiles>
  <wsdlFile><file1>.wsdl</wsdlFile>
  <wsdlFile><file2>.wsdl</wsdlFile>                                 
</wsdlFiles>

在这种情况下,要么在 wsdlfiles 标签下使用单个 WSDL,要么使用 wsdloptions

<wsdlOptions>
  <wsdlOption>
    <wsdl>src/main/resources/wsdl/<file>.wsdl</wsdl>                         
    <wsdlLocation>classpath:wsdl<file1>.wsdl</wsdlLocation>
  </wsdlOption>
</wsdlOptions>

Do Maven Clean > Maven 更新项目 > Maven 生成的资源。完毕 !

If you are using multiple wsdls under same wsdlfiles tag then you may encounter skipping info like below:

<wsdlFiles>
  <wsdlFile><file1>.wsdl</wsdlFile>
  <wsdlFile><file2>.wsdl</wsdlFile>                                 
</wsdlFiles>

In this case, either use single WSDL under wsdlfiles tag or use wsdloptions

<wsdlOptions>
  <wsdlOption>
    <wsdl>src/main/resources/wsdl/<file>.wsdl</wsdl>                         
    <wsdlLocation>classpath:wsdl<file1>.wsdl</wsdlLocation>
  </wsdlOption>
</wsdlOptions>

Do Maven Clean > Maven Update project > Maven Generated resources. DONE !

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