[英]Environment variable in Jenkinsfile
We are trying to use ${server.config.dir}
in jvmOptions我们正在尝试在 jvmOptions 中使用
${server.config.dir}
-Djava.security.auth.login.config=${server.config.dir}/kerberos/client_jaas.conf
Can we set this as part of Jenkins environment variables?我们可以将其设置为 Jenkins 环境变量的一部分吗?
We did it like this-我们是这样做的——
environment {
server.config.dir="some directory"
}
and we are getting this error-我们收到了这个错误-
WorkflowScript: 37: Expected string literal @ line 37, column 9.
server.conf.dir="serverconfigdir"
^
The error message indicates a string literal is expected, and the special characters are causing the compiler to not read the key in the environment
directive as a string literal.错误消息表明需要字符串文字,特殊字符导致编译器无法将
environment
指令中的键作为字符串文字读取。 You need to explicitly cast it as a literal string:您需要将其显式转换为文字字符串:
environment {
'server.config.dir' = "some directory"
}
and the error will be fixed.并且错误将被修复。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.