我们公司使用公司代理服务器,其用户名的格式为domainName\username
。当我尝试使用add-proxy
命令从命令行添加代理时。
我得到的异常是:
Error WARNING: Error configuring proxy settings: startup failed:
C:\Documents and Settings\username\.grails\ProxySettings.groovy: 1: unexpected cha
r: '\' @ line 1, column 94.
8080", "http.proxyUser":"company\username"
解决方法是什么?我尝试手动编辑ProxySettings.groovy文件,但是在启动时会引发相同的错误。
[更新] 我尝试使用Grails 2.0.0 RC3,但仍然无法连接。
最佳答案
当在代理配置中使用domain时,您似乎遇到了grails错误:http://jira.grails.org/browse/GRAILS-7387。解决方法是在BuildConfig.groovy
(手动)中配置代理。将以下内容添加到现有的company\username
中:
grails.project.dependency.resolution = {
System.setProperty("http.proxyHost", "host");
System.setProperty("http.proxyPort", "port");
Authenticator.setDefault(new Authenticator() {
protected PasswordAuthentication getPasswordAuthentication() {
return new PasswordAuthentication("company\\username","password".toCharArray());
}
});
[rest of code]
}
这样反斜杠就不会有问题。
关于grails - 用特殊的\字符设置grails代理用户名会导致错误,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/8352502/