JiraRestClient 搜索未返回 JQL 查询的结果

我面临与搜索 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>

任何人请帮助我找到解决方案。


HUX布斯
浏览 141回答 2
2回答

慕后森

我认为可能是您的 JIRA 实例特有的问题导致了您的问题。我下面的代码基于 Anish 编写的内容。它编译并运行得非常好,打印出我期望它显示的确切问题列表。当您可以并排查看两段代码时,这可能会对您有所帮助。public static void main(String[] args) throws URISyntaxException {&nbsp; &nbsp; URI uri = new URI("https://example.com");&nbsp; &nbsp; JiraRestClientFactory jiraRestClientFactory = new AsynchronousJiraRestClientFactory();&nbsp; &nbsp; try (JiraRestClient jiraRestClient = jiraRestClientFactory.createWithBasicHttpAuthentication(uri, "email", "password")) {&nbsp; &nbsp; &nbsp; &nbsp; SearchRestClient searchClient = jiraRestClient.getSearchClient();&nbsp; &nbsp; &nbsp; &nbsp; String query = "issueFunction in issuesInEpics('key = PROJ-1234') and issuetype = Task";&nbsp; &nbsp; &nbsp; &nbsp; System.out.println(query);&nbsp; &nbsp; &nbsp; &nbsp; SearchResult result = searchClient.searchJql(query, 50, 0, null).claim();&nbsp; &nbsp; &nbsp; &nbsp; for (Issue issue : result.getIssues()) {&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println(issue.getKey());&nbsp; &nbsp; &nbsp; &nbsp; }&nbsp; &nbsp; } catch (Exception ex) {&nbsp; &nbsp; &nbsp; &nbsp; ex.printStackTrace();&nbsp; &nbsp; }}我还使用我公司使用的自定义代理客户端尝试了给定的 JQL,并且查询绝对工作得很好。请检查您的环境和 JIRA 日志..

LEATH

解决方法是使用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().
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

Java