简体   繁体   English

如何为Jira WADL生成Java客户端?

[英]How to generate Java client for Jira WADL?

all 所有

I tried to generate Java client from Jira wadl descriptor, but it does not work: java.lang.IllegalStateException: Single WADL resources element is expected 我试图从Jira wadl描述符生成Java客户端,但是它不起作用: java.lang.IllegalStateException:预期有单个WADL资源元素

WADL file used: https://docs.atlassian.com/jira/REST/7.0.4/jira-rest-plugin.wadl 使用的WADL文件: https : //docs.atlassian.com/jira/REST/7.0.4/jira-rest-plugin.wadl

Build used: 使用的版本:

  <build>
        <plugins>
            <plugin>
                <groupId>org.apache.cxf</groupId>
                <artifactId>cxf-wadl2java-plugin</artifactId>
                <version>3.1.9</version>
                <executions>
                    <execution>
                        <id>generate-sources</id>
                        <phase>generate-sources</phase>
                        <configuration>
                            <sourceRoot>${basedir}/target/generated/src/main/java</sourceRoot>
                            <wadlOptions>
                                <wadlOption>
                                    <wadl>${basedir}/src/main/resources/jira-rest-plugin.wadl</wadl>
                                    <impl>true</impl>

                                    <packagename>com.mycompany.jira</packagename>
                                    <schemaPackagenames>
                                       <schemaPackagename>http://mycompany=com.mycompany.jira.schema</schemaPackagename>
                                    </schemaPackagenames>

                                </wadlOption>
                            </wadlOptions>
                        </configuration>
                        <goals>
                            <goal>wadl2java</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

I had a hope that they fixed their WADL in 7.x ... 我希望他们在7.x中修复了WADL ...

Anybody who made it work? 任何使它起作用的人吗?

It does not look like valid WADL file, it explains individual services, with input, input format. 它看起来不像有效的WADL文件,它以输入,输入格式解释了各个服务。 For a wadl2java plugin to work you need to have WADL file with syntax similar to shown below. 为了使wadl2java插件正常工作,您需要具有如下所示语法的WADL文件。

<application xmlns="http://research.sun.com/wadl/2006/10">
    <doc xmlns:jersey="http://jersey.dev.java.net/" 
            jersey:generatedBy="Jersey: 1.0-ea-SNAPSHOT 10/02/2008 12:17 PM"/>
    <resources base="http://localhost:9998/storage/">
        <resource path="/containers">
            <method name="GET" id="getContainers">
                <response>
                    <representation mediaType="application/xml"/>
                </response>
            </method>
            <!-- Next methods ->
        </resource>
     </resources>
  </application>

I guess only way for you is to contact atlassian to provide at valid WADL file if the support, else you might need to use top down approach and implement the syntax as shown in the link you shared 我想唯一的办法是,如果有支持,请联系atlassian以提供有效的WADL文件,否则您可能需要使用自上而下的方法并实现您共享的链接中所示的语法

Here is some additional info, 1) go to your specific server version api docs url. 这是一些其他信息,1)转到您的特定服务器版本api docs url。 eg:- https://docs.atlassian.com/software/jira/docs/api/REST/7.12.3/ 例如: -https : //docs.atlassian.com/software/jira/docs/api/REST/7.12.3/

2) Append "jira-rest-plugin.wadl" to the end and press enter This downloads the wadl for the specific version you want 2)在末尾附加“ jira-rest-plugin.wadl”,然后按Enter。这将下载您想要的特定版本的wadl

3) Signup for free in Apimatic.io and login 3)在Apimatic.io中免费注册并登录

4) Use the transformer to upload the wadl and specify the output format (Swagger openapi v2.0 or 3.0, or postman, etc.) 4)使用转换器上载wadl并指定输出格式(Swagger openapi v2.0或3.0,或邮递员等)

5) THis will generate and download the swagger.json 5)这将生成并下载swagger.json

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM