简体   繁体   English

是否可以通过自动代理配置脚本配置Eclipse IDE代理设置?

[英]Is there any way of configuring Eclipse IDE proxy settings via an autoproxy configuration script?

I am behind a firewall which uses autoproxy configuration script. 我在使用自动代理配置脚本的防火墙后面。 I am able to browse the internet when I enable the autoproxy url in most browsers I use (IE 7, IE 8, FF, Chrome). 在我使用的大多数浏览器(IE 7,IE 8,FF,Chrome)中启用自动代理网址时,我就能浏览互联网。 For your reference to enable autoproxy url on Windows goto: Settings -> Control Panel -> Internet Options -> Connections -> Lan Settings -> (Check) use automatic configuration scripts -> enter Address value as the autoproxy script url. 供您参考以在Windows上启用自动代理URL,转到:设置->控制面板-> Internet选项->连接->局域网设置->(检查)使用自动配置脚本->输入地址值作为自动代理脚本URL。

The issue I am facing is: I have Eclipse IDE and I want to configure the proxy settings in Eclipse similar to browser settings but I am unable to. 我面临的问题是:我具有Eclipse IDE,并且想要在Eclipse中配置代理设置,类似于浏览器设置,但是无法。 I could not find a setting in Eclipse or NetBeans 6.9.1 or IntelliJ Idea to solve this issue. 我无法在Eclipse或NetBeans 6.9.1或IntelliJ Idea中找到解决此问题的设置。

I am using Maven2 integrated with these IDEs and no local repositories set up yet. 我正在使用与这些IDE集成的Maven2,尚未设置本地存储库。 Maven2 tries to install jars by downloading them from Internet but it cannot due to the proxy setting. Maven2尝试通过从Internet下载jar来安装jar,但由于代理设置而无法安装。 I can manually download these libraries from Maven2 repositories and have an internal repository hosted using Artifactory or Nexus but I would like to know if there is any way I can do it from IDE itself... 我可以从Maven2存储库中手动下载这些库,并使用Artifactory或Nexus托管一个内部存储库,但我想知道是否可以通过IDE本身进行任何操作...

Thanks for your feedback. 感谢您的反馈意见。 Please let me know if you have any questions. 请让我知道,如果你有任何问题。

Here is what I do. 这是我的工作。 All of these instructions are based on my minimal experiences with working PACs, so YMMV. 所有这些说明都是基于我对工作PAC的最低经验,因此是基于YMMV。

Download your pac file via your pac URL. 通过pac URL下载pac文件。 It's plain text and should be easy to open in a text editor. 它是纯文本,应该易于在文本编辑器中打开。

Near the bottom, there's probably a section that says something like: return "PROXY wxyz:a" where "wxyz" is an ip address or username and "a" is a port number. 在底部附近,可能有一个类似以下内容的部分:返回“ PROXY wxyz:a”,其中“ wxyz”是IP地址或用户名,“ a”是端口号。

Write these down. 把这些写下来。

In a recent version of eclipse : 在eclipse的最新版本中:

  • Go to Window -> Preferences -> General -> Network Connections= 转到窗口->首选项->常规->网络连接=
  • Change the provider to "Manual" 将提供程序更改为“手动”
  • Select the "HTTP" line and click the edit button 选择“ HTTP”行,然后单击编辑按钮
  • Add the IP address and port number above to the http line 将上面的IP地址和端口号添加到http行
  • If you have to authenticate to use the proxy, 如果您必须通过身份验证才能使用代理,
    • select "Requires Authentication" 选择“需要身份验证”
    • type in your username. 输入您的用户名。 Note that if your authentication is on a Windows domain, you might have to prepend the domain name and a backslash (\\) like: MYDOMAIN\\MYUSERID 请注意,如果您的身份验证是在Windows域上,则可能必须在域名前加上反斜杠(\\),例如:MYDOMAIN \\ MYUSERID
    • Type in your password 输入密码
  • Click OK 点击确定
  • Click Apply 点击应用
  • Click OK 点击确定

At this point, you should be able to browse using the internal web browser (at least on http URLs). 此时,您应该能够使用内部Web浏览器进行浏览(至少在http URL上)。

Good luck. 祝好运。

Edit : Just so you know, it's WAY easier to use Nexus , one set of <mirror> tags and a single proxy setup (inside Nexus) to manage the proxy issues of Maven inside a firewall. 编辑 :众所周知,使用Nexus ,一组<mirror>标签和一个代理设置(在Nexus内)来管理防火墙内Maven的代理问题要容易得多。

In the file: $your_eclipse_installation\\configuration.settings\\org.eclipse.core.net.prefs 在文件中:$ your_eclipse_installation \\ configuration.settings \\ org.eclipse.core.net.prefs

you need the option: systemProxiesEnabled=true 您需要以下选项:systemProxiesEnabled = true

You can set it also by the Eclipse GUI: Go to Window -> Preferences -> General -> Network Connections Change the provider to "Native" 您也可以通过Eclipse GUI进行设置:转到窗口->首选项->常规->网络连接将提供程序更改为“本机”

The first way is working even if your Eclipse is broken due to wrong configuration attempts. 即使您的Eclipse由于错误的配置尝试而损坏,第一种方法仍然有效。

Download whatever configuration script that your browser is using. 下载浏览器正在使用的任何配置脚本。

the script would have various host:port configuration. 该脚本将具有各种host:port配置。 based on the domain you want to connect , one of the host:port is selected by the borwser. 根据您要连接的域,浏览器选择host:port之一。

in the eclipse network setting you can try to put on of the host ports and see if that works. 在Eclipse网络设置中,您可以尝试使用主机端口,看看是否可行。

worked for me. 为我工作。

the config script looks like, 配置脚本看起来像,

if (isPlainHostName(host))
    return "DIRECT";
else if (dnsDomainIs(host, "<***sample host name *******>"))
    return "PROXY ***some ip*****; DIRECT";
else if (dnsDomainIs(host, "address.com")
        || dnsDomainIs(host, "adress2..com")
        || dnsDomainIs(host, "address3.com")
        || dnsDomainIs(host, "address4.com")        
    return "PROXY <***some proxyhost****>:8080";

you would need to look for the host port in the return statement. 您将需要在return语句中查找主机端口。

Download proxy script and check last line for return statement Proxy IP and Port.
Add this IP and Port using these step.

   1.  Windows -->Preferences-->General -->Network Connection
   2. Select Active Provider : Manual
   3.  Proxy entries select HTTP--> Click on Edit button
   4.  Then add Host as a proxy IP and port left Required Authentication blank.
   5.  Restart eclipse
   6.  Now Eclipse Marketplace... working.

In Netbeans, we can use Tools->Options-> General Tab - > Under proxy settings, select Use system proxy settings. 在Netbeans中,我们可以使用工具->选项->常规选项卡->在代理设置下,选择使用系统代理设置。

This way, it uses the proxy settings provided in Settings -> Control Panel -> Internet Options -> Connections -> Lan Settings -> use automatic configuration scripts. 这样,它使用设置->控制面板-> Internet选项->连接->局域网设置->使用自动配置脚本中提供的代理设置。

If you are using maven, make sure the proxy settings are not provided there, so that it uses Netbeans settings provided above for proxy. 如果使用的是maven,请确保未在其中提供代理设置,以便它使用上面提供的Netbeans设置进行代理。

Hope this helps. 希望这可以帮助。

Shreedevi 舍雷德维

Well there's the Network Connections preference page; 好的,有“网络连接”首选项页面; you can add proxies there. 您可以在此处添加代理。 I don't know much about it; 我对此了解不多; I don't know if the Maven integration plugins will use the proxies defined there. 我不知道Maven集成插件是否将使用在那里定义的代理。

You can find it at Window...Preferences, then General...Network Connections. 您可以在Window ... Preferences,然后是General ... Network Connections中找到它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM