JiraRestClient 搜索未返回 JQL 查询的结果
JiraRestClient search returnes no results for JQL query
我遇到了与 Search JQL 相关的问题。我正在使用查询
(issuefunction in issuesInEpics('key = ABCD-24911') and issuetype=Feature)
在 Jira 中它返回一些记录但是当我在 JiraRestClient
中使用这个查询时它不起作用,而是返回零条记录。
以下查询工作正常:
issuefunction in issuesInEpics("resolution is not empty") and issuetype = Feature
代码片段:
String query="issuefunction in issuesInEpics('key = ABCD-24911') and issuetype=Feature";
Integer resultsLength=50,startAt=0;
JiraRestClient.getSearchClient().searchJql(query,resultsLength,startAt,null);
我的 Maven 依赖项:
<dependency>
<groupId>com.atlassian.jira</groupId>
<artifactId>jira-rest-java-client-api</artifactId>
<version>4.0.0</version>
</dependency>
<dependency>
<groupId>com.atlassian.jira</groupId>
<artifactId>jira-rest-java-client-core</artifactId>
<version>4.0.0</version>
</dependency>
<dependency>
<groupId>com.atlassian.fugue</groupId>
<artifactId>fugue</artifactId>
<version>2.2.1</version>
</dependency>
<dependency>
<groupId>com.atlassian.httpclient</groupId>
<artifactId>atlassian-httpclient-spi</artifactId>
<version>0.17.0-m01</version>
</dependency>
任何人都请帮助我找到解决方案。
如果我理解 https://community.atlassian.com/t5/Jira-questions/How-to-get-a-list-of-quot-issues-in-epic-quot-in-Jira/qaq-p/511549 正确,解决方法是使用
String query="issueFunction in linkedIssuesOf('key=ABCD-24911', 'is epic of')
AND issuetype=Feature";
而不是
String query="issuefunction in issuesInEpics('key = ABCD-24911')
AND issuetype=Feature";
背景: 看来函数IssuesInEpics()
和epicsOf()
是最近才引入来修正linkedIssuesOf()
的功能的。
我认为可能是您的 JIRA 实例特有的问题导致了您的问题。我下面的代码是基于 Anish 写的。它可以完美地编译和运行,打印出我希望它显示的确切问题列表。
当您可以并排查看两段代码时,也许这对您有所帮助。
public static void main(String[] args) throws URISyntaxException {
URI uri = new URI("https://example.com");
JiraRestClientFactory jiraRestClientFactory = new AsynchronousJiraRestClientFactory();
try (JiraRestClient jiraRestClient = jiraRestClientFactory.createWithBasicHttpAuthentication(uri, "email", "password")) {
SearchRestClient searchClient = jiraRestClient.getSearchClient();
String query = "issueFunction in issuesInEpics('key = PROJ-1234') and issuetype = Task";
System.out.println(query);
SearchResult result = searchClient.searchJql(query, 50, 0, null).claim();
for (Issue issue : result.getIssues()) {
System.out.println(issue.getKey());
}
} catch (Exception ex) {
ex.printStackTrace();
}
}
我还使用我公司使用的自定义代理客户端尝试了给定的 JQL,查询绝对可以正常工作。请检查您的环境和 JIRA 日志..
我遇到了与 Search JQL 相关的问题。我正在使用查询
(issuefunction in issuesInEpics('key = ABCD-24911') and issuetype=Feature)
在 Jira 中它返回一些记录但是当我在 JiraRestClient
中使用这个查询时它不起作用,而是返回零条记录。
以下查询工作正常:
issuefunction in issuesInEpics("resolution is not empty") and issuetype = Feature
代码片段:
String query="issuefunction in issuesInEpics('key = ABCD-24911') and issuetype=Feature";
Integer resultsLength=50,startAt=0;
JiraRestClient.getSearchClient().searchJql(query,resultsLength,startAt,null);
我的 Maven 依赖项:
<dependency>
<groupId>com.atlassian.jira</groupId>
<artifactId>jira-rest-java-client-api</artifactId>
<version>4.0.0</version>
</dependency>
<dependency>
<groupId>com.atlassian.jira</groupId>
<artifactId>jira-rest-java-client-core</artifactId>
<version>4.0.0</version>
</dependency>
<dependency>
<groupId>com.atlassian.fugue</groupId>
<artifactId>fugue</artifactId>
<version>2.2.1</version>
</dependency>
<dependency>
<groupId>com.atlassian.httpclient</groupId>
<artifactId>atlassian-httpclient-spi</artifactId>
<version>0.17.0-m01</version>
</dependency>
任何人都请帮助我找到解决方案。
如果我理解 https://community.atlassian.com/t5/Jira-questions/How-to-get-a-list-of-quot-issues-in-epic-quot-in-Jira/qaq-p/511549 正确,解决方法是使用
String query="issueFunction in linkedIssuesOf('key=ABCD-24911', 'is epic of')
AND issuetype=Feature";
而不是
String query="issuefunction in issuesInEpics('key = ABCD-24911')
AND issuetype=Feature";
背景: 看来函数IssuesInEpics()
和epicsOf()
是最近才引入来修正linkedIssuesOf()
的功能的。
我认为可能是您的 JIRA 实例特有的问题导致了您的问题。我下面的代码是基于 Anish 写的。它可以完美地编译和运行,打印出我希望它显示的确切问题列表。
当您可以并排查看两段代码时,也许这对您有所帮助。
public static void main(String[] args) throws URISyntaxException {
URI uri = new URI("https://example.com");
JiraRestClientFactory jiraRestClientFactory = new AsynchronousJiraRestClientFactory();
try (JiraRestClient jiraRestClient = jiraRestClientFactory.createWithBasicHttpAuthentication(uri, "email", "password")) {
SearchRestClient searchClient = jiraRestClient.getSearchClient();
String query = "issueFunction in issuesInEpics('key = PROJ-1234') and issuetype = Task";
System.out.println(query);
SearchResult result = searchClient.searchJql(query, 50, 0, null).claim();
for (Issue issue : result.getIssues()) {
System.out.println(issue.getKey());
}
} catch (Exception ex) {
ex.printStackTrace();
}
}
我还使用我公司使用的自定义代理客户端尝试了给定的 JQL,查询绝对可以正常工作。请检查您的环境和 JIRA 日志..