<tfoot id='l1xXN'></tfoot>

    • <bdo id='l1xXN'></bdo><ul id='l1xXN'></ul>

      1. <legend id='l1xXN'><style id='l1xXN'><dir id='l1xXN'><q id='l1xXN'></q></dir></style></legend>

        <small id='l1xXN'></small><noframes id='l1xXN'>

        <i id='l1xXN'><tr id='l1xXN'><dt id='l1xXN'><q id='l1xXN'><span id='l1xXN'><b id='l1xXN'><form id='l1xXN'><ins id='l1xXN'></ins><ul id='l1xXN'></ul><sub id='l1xXN'></sub></form><legend id='l1xXN'></legend><bdo id='l1xXN'><pre id='l1xXN'><center id='l1xXN'></center></pre></bdo></b><th id='l1xXN'></th></span></q></dt></tr></i><div id='l1xXN'><tfoot id='l1xXN'></tfoot><dl id='l1xXN'><fieldset id='l1xXN'></fieldset></dl></div>

      2. Jenkins groovy 正则表达式匹配字符串:错误:java.io.NotSerializableExceptio

        Jenkins groovy regex match string : Error: java.io.NotSerializableException: java.util.regex.Matcher(Jenkins groovy 正则表达式匹配字符串:错误:java.io.NotSerializableException:java.util.regex.Matcher)

        <small id='zoP4s'></small><noframes id='zoP4s'>

        <tfoot id='zoP4s'></tfoot>

            <tbody id='zoP4s'></tbody>
          <i id='zoP4s'><tr id='zoP4s'><dt id='zoP4s'><q id='zoP4s'><span id='zoP4s'><b id='zoP4s'><form id='zoP4s'><ins id='zoP4s'></ins><ul id='zoP4s'></ul><sub id='zoP4s'></sub></form><legend id='zoP4s'></legend><bdo id='zoP4s'><pre id='zoP4s'><center id='zoP4s'></center></pre></bdo></b><th id='zoP4s'></th></span></q></dt></tr></i><div id='zoP4s'><tfoot id='zoP4s'></tfoot><dl id='zoP4s'><fieldset id='zoP4s'></fieldset></dl></div>
          <legend id='zoP4s'><style id='zoP4s'><dir id='zoP4s'><q id='zoP4s'></q></dir></style></legend>

                • <bdo id='zoP4s'></bdo><ul id='zoP4s'></ul>
                  本文介绍了Jenkins groovy 正则表达式匹配字符串:错误:java.io.NotSerializableException:java.util.regex.Matcher的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我正在尝试从 groovy 中的正则表达式中获取匹配的字符串.匹配的字符串打印到控制台没有问题,但是当我尝试在 git 命令中使用匹配的字符串时,我收到以下错误:

                  I'm trying to get the matched string from a regex in groovy. The matched string prints to the console without problems, but when I try use the matched string in a git command I get the following error:

                  Err: Incremental Build failed with Error: java.io.NotSerializableException: java.util.regex.Matcher
                  

                  代码如下:

                                  def binaryName = "298_application_V2_00_Build_07.hex"
                  
                                  def matches = (binaryName =~ /(V)(d+)(_)(d+)(_)(Build)(_)(d+)/)
                                  versionTag = ""+matches[0].getAt(0)                 
                                  echo "${matches}"
                                  echo "$versionTag"
                                  bat("git tag $versionTag")
                                  bat("git push origin --tags")
                  

                  如何从正则表达式中获取匹配的字符串?

                  How can I get the matched string from the regex?

                  推荐答案

                  这个问题是Jenkins的CPS,它将所有管道执行序列化以存储为可恢复状态.

                  This problem is caused by Jenkins' CPS, which serializes all pipeline executions to store as resumable state.

                  对不可序列化方法的调用必须包装在一个用 @NonCPS 注释的方法中:

                  Calls to non-serializable methods have to be wrapped in a method annotated with @NonCPS:

                  @NonCPS
                  String getVersion(String binaryName) {
                    def matches = (binaryName =~ /(V)(d+)(_)(d+)(_)(Build)(_)(d+)/)
                    versionTag = ""+matches[0].getAt(0)
                    versionTag
                  }
                  

                  现在可以从您的管道中调用此方法.如果您的 Jenkins master 在执行此方法期间重新启动,它将完全运行它 - 在许多情况下,例如您的,绝对没有问题.

                  this method can now be called from your pipeline. In case your Jenkins master restarts during execution of this method, it would just run through it completely - which is in many cases, such as yours, absolutely no problem.

                  这篇关于Jenkins groovy 正则表达式匹配字符串:错误:java.io.NotSerializableException:java.util.regex.Matcher的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  How to send data to COM PORT using JAVA?(如何使用 JAVA 向 COM PORT 发送数据?)
                  How to make a report page direction to change to quot;rtlquot;?(如何使报表页面方向更改为“rtl?)
                  Use cyrillic .properties file in eclipse project(在 Eclipse 项目中使用西里尔文 .properties 文件)
                  Is there any way to detect an RTL language in Java?(有没有办法在 Java 中检测 RTL 语言?)
                  How to load resource bundle messages from DB in Java?(如何在 Java 中从 DB 加载资源包消息?)
                  How do I change the default locale settings in Java to make them consistent?(如何更改 Java 中的默认语言环境设置以使其保持一致?)
                    <bdo id='pNiYh'></bdo><ul id='pNiYh'></ul>

                    <tfoot id='pNiYh'></tfoot>
                  • <i id='pNiYh'><tr id='pNiYh'><dt id='pNiYh'><q id='pNiYh'><span id='pNiYh'><b id='pNiYh'><form id='pNiYh'><ins id='pNiYh'></ins><ul id='pNiYh'></ul><sub id='pNiYh'></sub></form><legend id='pNiYh'></legend><bdo id='pNiYh'><pre id='pNiYh'><center id='pNiYh'></center></pre></bdo></b><th id='pNiYh'></th></span></q></dt></tr></i><div id='pNiYh'><tfoot id='pNiYh'></tfoot><dl id='pNiYh'><fieldset id='pNiYh'></fieldset></dl></div>

                        <tbody id='pNiYh'></tbody>
                      <legend id='pNiYh'><style id='pNiYh'><dir id='pNiYh'><q id='pNiYh'></q></dir></style></legend>

                        <small id='pNiYh'></small><noframes id='pNiYh'>