我正在创建下面给出的属性块或映射,我想将其写入文件。我找不到从管道代码将属性写入文件的方法。需要帮助弄清楚如何做。
def props = [APPNAME = 'testaoo',
DEPLOY_ENV = stream,
DEPLOY_STREAM = stream_num,
DEPLOY_ENV_TYPE = deploy_env_type,
BUILD_JOB_ID = env.BUILD_JOB_ID,
WAS_NDM_AgentURL= getAgentURL(stream),
WAS_CLUSTER = getClusterName(stream),
DeployPublishNeeded = 'Yes'
]
答案 0 :(得分:0)
def props = [
APPNAME : 'testaoo',
DeployPublishNeeded : 'Yes'
]
def content = props.collect{entry->entry.key+"="+entry.value}.join('\n')
writeFile file: 'a.properties', text: content