JIRA REST CLIENT:issue.getattachments()返回null

时间:2014-07-18 21:12:23

标签: jira jira-rest-api jira-rest-java-api

我正在尝试获取JIRA问题的附件。但是getAttachments()方法返回null。 JIRA版本是v6.1.4

以下是代码

final JiraRestClientFactory factory = new AsynchronousJiraRestClientFactory();
final URI jiraServerUri = new URI("http://XXX-jira.YYY.com");
final JiraRestClient restClient = factory.createWithBasicHttpAuthentication(jiraServerUri, "XXXX", "YYYY");
//final NullProgressMonitor pm = new NullProgressMonitor();
final Issue issue = restClient.getIssueClient().getIssue("XXX-35238").claim();

System.out.println(issue);
System.out.println(issue.getAttachments());

以下是maven依赖项

<dependency>
    <groupId>com.atlassian.jira</groupId>
    <artifactId>jira-rest-java-client</artifactId>
    <version>2.0.0-m2</version>
</dependency>
    <dependency>
    <groupId>com.atlassian.jira</groupId>
    <artifactId>jira-rest-java-client-api</artifactId>
    <version>2.0.0-m25</version>
</dependency>
<dependency>
    <groupId>com.atlassian.jira</groupId>
    <artifactId>jira-rest-java-client-plugin</artifactId>
    <version>2.0.0-m25</version>
</dependency>
<dependency>
    <groupId>com.atlassian.jira</groupId>
    <artifactId>jira-rest-java-client-core</artifactId>
    <version>2.0.0-m25</version>
</dependency>

非常感谢您的帮助。

1 个答案:

答案 0 :(得分:2)

“附件”字段必须在“默认屏幕”中可用。否则,附件将不会包含在响应中(尽管在浏览器中查看问题时它们是可见的...)