我正在尝试配置环境属性 com.sun.jndi.ldap.connect.timeout和com.sun.jndi.ldap.read.timeout在jenkins上使用groovy脚本。
片段: 我尝试使用
ldap = [
new LDAPSecurityRealm.EnvironmentProperty('com.sun.jndi.ldap.connect.timeout', '5000'),
new LDAPSecurityRealm.EnvironmentProperty('com.sun.jndi.ldap.read.timeout','6000'),
] as LDAPSecurityRealm.EnvironmentProperty[]
SecurityRealm ldap_ex = new LDAPSecurityRealm(server,rootDN,userSearchBase,userSearch,groupSearchBase,managerDN,managerPassword,inhibitInferRootDN,disableMailAddressResolver,enable_cache,ldap)
Jenkins.instance.setSecurityRealm(ldap_ex)
Jenkins.instance.save()
但是我总是得到
[hudson.security.LDAPSecurityRealm$EnvironmentProperty@5baed704, hudson.security.LDAPSecurityRealm$EnvironmentProperty@71c1d902]
groovy.lang.GroovyRuntimeException: Could not find matching constructor for: hudson.security.LDAPSecurityRealm(java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.Boolean, java.lang.Boolean, hudson.security.LDAPSecurityRealm$CacheConfiguration, [Lhudson.security.LDAPSecurityRealm$EnvironmentProperty;)
我看到[Lhudson.security.LDAPSecurityRealm $ EnvironmentProperty;)是列表,但根据构造函数文档,我需要一个数组:
(java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang。 String,java.lang.String,boolean,boolean,hudson.security.LDAPSecurityRealm $ CacheConfiguration, hudson.security.LDAPSecurityRealm $ EnvironmentProperty []),
所以您能建议如何使用它吗?