maven更改插件错误:";此JIRA服务器不支持REST API的版本2;

maven更改插件错误:";此JIRA服务器不支持REST API的版本2;,jira,jira-rest-api,maven-changes-plugin,Jira,Jira Rest Api,Maven Changes Plugin,我们使用maven changes插件生成发布公告。不幸的是,“mvn changes:jira report”命令返回“返回RSS进行问题下载:这个jira服务器不支持RESTAPI的版本2,maven changes插件需要它。”。请参阅下面的命令错误日志: [INFO] Falling back to RSS for issue download: This JIRA server does not support version 2 of the REST API, which mave

我们使用maven changes插件生成发布公告。不幸的是,“mvn changes:jira report”命令返回“返回RSS进行问题下载:这个jira服务器不支持RESTAPI的版本2,maven changes插件需要它。”。请参阅下面的命令错误日志:

[INFO] Falling back to RSS for issue download: This JIRA server does not support version 2 of the REST API, which maven-changes-plugin requires.
[WARNING] Unable to respond to any of these challenges: {oauth=OAuth realm="https%3A%2F%2Fjira.myjira.com%3A8443"}
[INFO] Downloading from JIRA at: https://jira.myjira.com/sr/jira.issueviews:searchrequest-xml/temp/SearchRequest.xml?tempMax=100&reset=true&jqlQuery=project+%3D+CP+AND+fixVersion+%3D+%223.2.1-alpha-4%22+AND+status+in+%28Closed%29+AND+resolution+in+%28Fixed%29+ORDER+BY+priority+DESC%2C+created+DESC
[WARNING] Unable to respond to any of these challenges: {oauth=OAuth realm="https%3A%2F%2Fjira.myjira.com%3A8443"}
[WARNING] Downloading from JIRA failed. Received: [401]
[WARNING] JIRA file /Users/jay/3.2.1-alpha/marketplace/target/jira-results.xml doesn't exist.
[WARNING]
org.apache.maven.plugin.MojoExecutionException: Couldn't find any issues for the version '3.2.1-alpha-4' among the supplied issues: []
        at org.apache.maven.plugin.issues.IssueUtils.getIssuesForVersion(IssueUtils.java:119)
        at org.apache.maven.plugin.jira.JiraMojo.executeReport(JiraMojo.java:387)
        at org.apache.maven.reporting.AbstractMavenReport.generate(AbstractMavenReport.java:255)
        at org.apache.maven.reporting.AbstractMavenReport.generate(AbstractMavenReport.java:210)
        at org.apache.maven.plugin.changes.AbstractChangesReport.execute(AbstractChangesReport.java:207)
        at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:132)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
        at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
        at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
        at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
        at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:120)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:347)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:154)
        at org.apache.maven.cli.MavenCli.execute(MavenCli.java:584)
        at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:213)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:157)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
        at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
        at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
环境信息

JIRA Standalone 5.2.5
maven-changes-plugin v2.11
pom.xml摘录

<issueManagement>
    <system>JIRA</system>
    <url>https://jira.myjira.com:8443/browse/CP</url>
  </issueManagement>
<plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-changes-plugin</artifactId>
        <version>2.11</version>
        <executions>
            <execution>
                <phase>package</phase>
                <goals>
                    <goal>announcement-generate</goal>
                </goals>
                <id>announcement-generate</id>
            </execution>
            <execution>
                <phase>deploy</phase>
                <goals>
                    <goal>announcement-mail</goal>
                </goals>
                <id>announcement-mail</id>
            </execution>
        </executions>
        <configuration>
            <useJql>true</useJql>
          <jiraUser>xxx</jiraUser>
            <jiraPassword>xxx</jiraPassword>
            <webUser>xxx</webUser>
            <webPassword>xxx</webPassword>
          <onlyCurrentVersion>true</onlyCurrentVersion>
            <smtpHost>relay.edsmtp.net</smtpHost>
          <smtpPort implementation="java.lang.Integer">25</smtpPort>
          <toAddresses>
            <toAddress implementation="java.lang.String">to@email.com</toAddress>
          </toAddresses>
          <mailSender>
            <name>Release Notification</name>
            <email>projectupdates@email.com</email>
          </mailSender>
          <issueManagementSystems>
            <issueManagementSystem>JIRA</issueManagementSystem>
          </issueManagementSystems>
        </configuration>
      </plugin>
<reporting>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-changes-plugin</artifactId>
        <version>2.11</version>
        <configuration>
          <useJql>true</useJql>
          <jiraUser>xxx</jiraUser>
            <jiraPassword>xxx</jiraPassword>
            <webUser>xxx</webUser>
            <webPassword>xxx</webPassword>
          <onlyCurrentVersion>true</onlyCurrentVersion>
          <resolutionIds>Unresolved</resolutionIds>
          <statusIds>Open</statusIds>
          <typeIds>Bug, New Feature, Improvement</typeIds>
        </configuration>
        <reportSets>
          <reportSet>
            <reports>
              <report>jira-report</report>
            </reports>
          </reportSet>
        </reportSets>
      </plugin>
    </plugins>
  </reporting>

吉拉
https://jira.myjira.com:8443/browse/CP
org.apache.maven.plugins
maven更改插件
2.11
包裹
公告生成
公告生成
部署
公告邮件
公告邮件
真的
xxx
xxx
xxx
xxx
真的
relay.edsmtp.net
25
to@email.com
发布通知
projectupdates@email.com
吉拉
org.apache.maven.plugins
maven更改插件
2.11
真的
xxx
xxx
xxx
xxx
真的
悬而未决
打开
缺陷、新特性、改进
吉拉报告
感谢你的指点


谢谢

您得到这个错误是因为它试图访问的第一个REST方法(
https://myjiraserver/rest/api/2/serverInfo
)在尝试访问资源时未返回HTTP 200

您的JIRA版本应该支持REST API的v2,因此您可能会因为以下原因之一而出现该错误:

  • 您为Maven提供了错误的URL(可能缺少上下文路径?),或者
  • 您是否正在服务器上使用自签名SSL证书,这可能会干扰客户端的连接能力
  • 在后一种情况下,您可以尝试将Maven指向JIRA的非SSL端口(如果您仍然可以在JIRA的conf/server.xml中访问该端口),或者查看是否可以通过Maven使用来修复它

    我认为选项#2的可能性较小,因为如果出现证书验证问题,我希望WebClient库抛出异常,但我承认,我还没有深入研究它的API,以准确了解它在该场景中的作用

    发件人:

    105 Map urlMap=JiraHelper.getJiraUrlAndProjectName(project.getIssueManagement().getUrl());
    106字符串jiraUrl=urlMap.get(“url”);
    107 jiraProject=urlMap.get(“项目”);
    108
    109//这个类加载器杂耍是一个典型的Maven 2类加载器管理错误的解决方法。
    110类加载器ccl=Thread.currentThread().getContextClassLoader();
    111试试看
    112         {
    113 Thread.currentThread().setContextClassLoader(WebClient.class.getClassLoader());
    114网络客户端=设置网络客户端(jiraUrl);
    115
    116//我们使用RESTAPI的第2版,它最早出现在JIRA 5中
    117//检查是否支持REST API的版本2
    118             // http://docs.atlassian.com/jira/REST/5.0/
    119//请注意,始终可以在无需身份验证的情况下访问serverInfo
    120 client.replacePath(“/rest/api/2/serverInfo”);
    121 client.accept(MediaType.APPLICATION_JSON);
    122 Response siResponse=client.get();
    123如果(siResponse.getStatus()!=Response.Status.OK.getStatusCode())
    124             {
    125投新北东(
    126“这个JIRA服务器不支持RESTAPI的版本2,maven changes插件需要它。”);
    127             }
    128
    
    谢谢@scott dudley。我实际上遇到了选项2。我通过将证书添加到信任存储中修复了它。我编辑了上面的帖子,将必要的JIRA条目也包括在内。提供给Maven的URL在我看来是正确的。这是否意味着你通过选项2使其工作?(或者你在发布之前这样做了,但它仍然损坏?)在发布之前执行了选项#2。发现问题在于密码不正确。很抱歉让您经历了这一过程。这真是我的一次失败:)
    105         Map<String, String> urlMap = JiraHelper.getJiraUrlAndProjectName( project.getIssueManagement().getUrl() );
    106         String jiraUrl = urlMap.get( "url" );
    107         jiraProject = urlMap.get( "project" );
    108 
    109         // This classloader juggling is a workaround for a classic Maven 2 class loader management bug.
    110         ClassLoader ccl = Thread.currentThread().getContextClassLoader();
    111         try
    112         {
    113             Thread.currentThread().setContextClassLoader( WebClient.class.getClassLoader( ) );
    114             WebClient client = setupWebClient( jiraUrl );
    115 
    116             // We use version 2 of the REST API, that first appeared in JIRA 5
    117             // Check if version 2 of the REST API is supported
    118             // http://docs.atlassian.com/jira/REST/5.0/
    119             // Note that serverInfo can always be accessed without authentication
    120             client.replacePath( "/rest/api/2/serverInfo" );
    121             client.accept( MediaType.APPLICATION_JSON );
    122             Response siResponse = client.get();
    123             if ( siResponse.getStatus() != Response.Status.OK.getStatusCode() )
    124             {
    125                 throw new NoRest(
    126                     "This JIRA server does not support version 2 of the REST API, which maven-changes-plugin requires." );
    127             }
    128