其他技术区
groovy 标签描述

去掉[/etc/hosts]中的“[”和“]” 代码 defhostFile="[/etc/hosts]" printlnhostFile.replace("[","").replace("]","") 结果 注意 如果处理的对象不是字符串,可以用toString()方法转换为字符串

  TEZNKK3IfmPf   2023年11月14日   49   0   0 字符串groovy

参考配置 applyplugin:"idea" applyplugin:"groovy" applyplugin:"eclipse" applyplugin:"application" dependencies{ compilelocalGroovy() } tasksourcesJar(type:Jar,dependsOn:classes){ classifier='sources' fromsourceSets.main.allSource } jar{ manifest{ attributes"Main-Class":"com.dalong.Application" } } tas...

  TEZNKK3IfmPf   2023年11月12日   80   0   0 groovygradle

插件 Jenkins需要安装UtilitySteps插件 host.yaml DB: type:mysql hostIP:192.168.1.2 脚本 !groovy //读取yaml文件,转换为一个对象 defdatas=readYamlfile:'/etc/ansible/host.yaml' printlndatas println"数据库IP是"//读取yaml文件中的值 //修改yaml文件的值,不能直接写到原有的文件,需删除旧文件 sh"rm-rf/etc/ansible/host.yaml" datas.DB.hostIP="192.168.1.3" //修改值 da...

  TEZNKK3IfmPf   2023年11月14日   94   0   0 groovyyaml