我正在尝试使用 JsonSlurper 从不同的文件中输入变量。但它在第二次执行时失败了。有人可以帮助我吗?
它从一步失败Jenkins_File_Path = readFile ( "${Local_Path_App}" + "/Jenkinsfile" )
主程序
import groovy.json.JsonSlurper
Global_Settings_Path = readFile ("${Main_Local_Path}" + "/Config/GlobalSettings_Java.json" )
def jsonSlurper = new JsonSlurper()
def GlobalVariables = jsonSlurper.parseText(Global_Settings_Path)
Jenkins_File_Path = readFile ( "${Local_Path_App}" + "/Jenkinsfile" )
def jsonSlurper1 = new JsonSlurper()
def json = jsonSlurper1.parseText(Jenkins_File_Path)
GlobalSettings_Java.json
{
"LOB": {
"SVN_Config_Path": "testpath",
"Local_Path_LOB": "test",
}
}
詹金斯文件
{
"BUILD_INFO": {
"Build_Type" : "Maven",
}
}
错误日志
java.io.NotSerializableException: org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:860) 的 groovy.json.internal.LazyMap org.jboss.marshalling.river.BlockMarshaller.doWriteObject(BlockMarshaller.java:65) ) 在 org.jboss.marshalling.river.BlockMarshaller.writeObject(BlockMarshaller.java:56) 在 org.jboss.marshalling.MarshallerObjectOutputStream.writeObjectOverride(MarshallerObjectOutputStream.java:50) 在 org.jboss.marshalling.river.RiverObjectOutputStream.writeObjectOverride( RiverObjectOutputStream.java:179) 在 java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:344) 在 java.util.HashMap.internalWriteEntries(HashMap.java:1785) 在 java.util.HashMap.writeObject(HashMap.java:1362 ) 在 sun.reflect.GeneratedMethodAccessor469.invoke(Unknown Source) 在 sun。reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.jboss.marshalling.reflect.SerializableClass.callWriteObject(SerializableClass.java:271) at org .jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:976) at org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:854) at org.jboss.marshalling.river.RiverMarshaller.doWriteFields(RiverMarshaller .java:1032)在 org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:988) 在 org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:854) 在 org.jboss.marshalling。 River.RiverMarshaller.doWriteFields(RiverMarshaller.java:1032) 在 org.jboss.marshalling。River.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:988) at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:967) at org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:854)在 org.jboss.marshalling.river.RiverMarshaller.doWriteFields(RiverMarshaller.java:1032) 在 org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:988) 在 org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject (RiverMarshaller.java:967)在 org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:854) 在 org.jboss.marshalling.river.RiverMarshaller.doWriteFields(RiverMarshaller.java:1032) 在 org.jboss。 marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller。java:988) at org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:854) at org.jboss.marshalling.river.BlockMarshaller.doWriteObject(BlockMarshaller.java:65) at org.jboss.marshalling.river .BlockMarshaller.writeObject(BlockMarshaller.java:56) at org.jboss.marshalling.MarshallerObjectOutputStream.writeObjectOverride(MarshallerObjectOutputStream.java:50) at org.jboss.marshalling.river.RiverObjectOutputStream.writeObjectOverride(RiverObjectOutputStream.java:179) at java。 io.ObjectOutputStream.writeObject(ObjectOutputStream.java:344) 在 java.util.TreeMap.writeObject(TreeMap.java:2438) 在 sun.reflect.GeneratedMethodAccessor475.invoke(Unknown Source) 在 sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl. java:43) 在 java.lang.reflect.Method。在 org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:976) 的 org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:976) 的调用(Method.java:498) .marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:854) at org.jboss.marshalling.river.RiverMarshaller.doWriteFields(RiverMarshaller.java:1032) at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java :988) org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:854) org.jboss.marshalling.AbstractObjectOutput.writeObject(AbstractObjectOutput.java:58) org.jboss.marshalling.AbstractMarshaller.writeObject( AbstractMarshaller.java:111) 在 org.jenkinsci.plugins.workflow.support.pickles。serialization.RiverWriter.writeObject(RiverWriter.java:132) at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.saveProgram(CpsThreadGroup.java:433) at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.saveProgram(CpsThreadGroup. java:412) 在 org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.run(CpsThreadGroup.java:357) 在 org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.access$100(CpsThreadGroup.java:78) 在 org. jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:236) 在 org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:224) 在 org.jenkinsci.plugins.workflow。 cps.CpsVmExecutorService$2.call(CpsVmExecutorService.java:63) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at hudson.remoting.SingleLaneExecutorService$1。在 jenkins.util.ContextResettingExecutorService$1.run(ContextResettingExecutorService.java:28) 在 java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) 在 java.util.concurrent 运行(SingleLaneExecutorService.java:112)。 FutureTask.run(FutureTask.java:266) 在 java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) 在 java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) 在 java.lang .Thread.run(Thread.java:745) 原因:发生的异常:在对象 org.jenkinsci.plugins.workflow.cps.CpsThreadGroup@7abaf96e 中的字段线程中的字段程序中的字段 e 中的字段调用者的字段局部变量中: 失败run(ContextResettingExecutorService.java:28) 在 java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) 在 java.util.concurrent.FutureTask.run(FutureTask.java:266) 在 java.util.concurrent .ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745) 原因:异常发生:在字段 e 的字段调用者的字段本地人中,在对象 org.jenkinsci.plugins.workflow.cps.CpsThreadGroup@7abaf96e 的字段线程中的字段程序中完成:失败run(ContextResettingExecutorService.java:28) 在 java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) 在 java.util.concurrent.FutureTask.run(FutureTask.java:266) 在 java.util.concurrent .ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745) 原因:异常发生:在字段 e 的字段调用者的字段本地人中,在对象 org.jenkinsci.plugins.workflow.cps.CpsThreadGroup@7abaf96e 的字段线程中的字段程序中完成:失败ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745) 原因:一个异常发生:在对象 org.jenkinsci.plugins.workflow.cps.CpsThreadGroup@7abaf96e 中的字段线程中的字段程序中的字段 e 中的字段调用者的字段本地人中完成:失败ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745) 原因:一个异常发生:在对象 org.jenkinsci.plugins.workflow.cps.CpsThreadGroup@7abaf96e 中的字段线程中的字段程序中的字段 e 中的字段调用者的字段本地人中完成:失败失败失败