Jekins 插件Extended Choice Parameter显示Json Parameter Type遇到的问题

    在jenkins中使用Extended Choice Parameter插件用来显示自定义的多选项,尝试通过groovy script来显示,正常,但查看它的例子,发现它例子中多选是通过类型 Json Parameter Type

    想尝试使用下,直接从帮助中拷贝了一个例子,已经是里面最简单的一个选择颜色的例子

    选择类型 "JSON Parameter Type"  再选择"JSON Parameter Config Groovy Script"
    把例子中的内容直接拷贝     

   import org.boon.Boon;
  def jsonEditorOptions = Boon.fromJson(/{
	disable_edit_json: true,    
        disable_properties: true,       
        no_additional_properties: true,       
         disable_collapse: true,      
        disable_array_add: true,     
        disable_array_delete: true,     
        disable_array_reorder: true, 
        theme: "bootstrap2",       
        iconlib:"fontawesome4",
   	schema: {
   		  "title": "Color Picker", 	
         	  "type": "object", 		                 
    "properties": { 		
 	"color": { 			
   "type": "string", 			
     "format": "color" 		
	} 
     }
    	},
   startval: { 			color :"red" 		}       }/);
return jsonEditorOptions;

排版有点乱,无所谓了,反正这段是可以从插件的帮助中查询到的

照道理来说,完全拷贝的,应该可以正常运行

但拷贝后,执行,并没有显示

就很奇怪是为什么不能显示,明明配置都是拷贝过来的

然后查看jenkins的日志

        发现返回错误信息
  JENKINS-37599: empty classpath entries not allowed
       java.net.MalformedURLException: JENKINS-37599: empty classpath entries not allowed

应该是classpath没有设置,但如何设置classpath呢 ?

查看之后,发现我们装这个多选参数的插件的时候,有一个前置插件script-security.hpi

到jekins的目录中查找子目录 plugins,在这个目录中找到插件的目录script-security

这个插件下有一个jar包,groovy-sandbox-1.10.jar

具体的目录是 D:Program Files (x86)Jenkinspluginsscript-securityWEB-INFlibgroovy-sandbox-1.10.jar

此时还是在刚才的参数设置中,选择高级,把这个jar的路径设在classpath中

此时运行,选择Build with Parameters,就可以出现颜色选择
当然这个只是拷贝了一个最简单的颜色的例子和遇到的问题

如果配置更为复制的选择,可能需要了解json schema

只是记录下,遇到的问题

原文地址:https://www.cnblogs.com/zjsupermanblog/p/7606894.html