Step-by-Step Guide on How to Set a Proxy in IntelliJ

Comments: 0

A number of IT-users might be curious about how to set a proxy in intelliJ while connected to a corporate network. Such network types often create boundaries for developers, restricting them from connecting to external resources, downloading useful plugins, and updating libraries.

In addition to solving such issues, a server offers protection from any attacks and unauthorized access. It also conceals true user information while allowing remote network testing, regional program debugging, and improving application performance through data caching. As a result, proxy settings in IntelliJ IDEA become beneficial to Java developers as well as Kotlin, Scala, and Spring, Jakarta EE, and many other framework users.

Video Guide for Setting Up a Proxy in IntelliJ

How to Set a Proxy in IntelliJ

Now, let us delve into: how to set a proxy in intelliJ for the most updated versions. Users of older versions would have to adjust instructions slightly. For users who need maximum functionality from the program, we recommend updating so you can take advantage of all the features and avoid bugs and clashes in compatibility.

  1. Open IntelliJ IDEA, under your project, select the “Main Menu” button.

    1en.png

  2. The main menu appears. Navigate to the tab “File”, then “Settings”.

    2en.png

  3. In the new window that opens, go to the drop down and scroll under “Appearance & Behavior” to select “System Settings”, then “HTTP Proxy”.

    3en.png

  4. Select the manual configuration mod.

    4en.png

  5. Enter the IP address and port number. You can also create exceptions for specific addresses that will bypass the proxy.

    5en.png

  6. If using a private proxy, enter your login details. You may wish to click “Remember” for automatic subsequent authorization.

    6en.png

  7. In order to confirm the operational status, click on “Check connection”. A small window will pop up. Enter the URL of any website into the space provided and click “OK”.

    7en.png

  8. Provided all fields are filled accurately, a window will pop up with the results indicating successful connection.

    8en.png

This covers how to add a proxy to IntelliJ IDEA without any extra extensions.

Step 1: Access Proxy Settings in IntelliJ

The above steps on integration of proxy into the development environment set out the most straightforward procedure. There are a couple of ways to set HTTP/SOCKS protocols in IntelliJ proxy settings for more advanced users.

  1. Navigate through the main menu the same way as described above.
  2. Open extra settings by clicking on “Ctrl + Alt + S” which allows you to proceed to step 1 in locating HTTP proxy intelliJ parameters. Alternatively, you can bring up the search bar using “Ctrl + Shift + A” and type in “Proxy”.

    8en2.png

  3. Utilize the search bar. The same way any files and commands can be set, everything else like commands, class files, and settings can be accessed with the Enter search options as well.

    8en3.png

These are three primary quick-access methods for settings in the IDE.

Step 2: Configure Proxy for Maven and Gradle

Maven comes bundled with the IDE and the entire build process is done for you. Nevertheless, IntelliJ IDEA activation proxy settings for Maven is different from the way it is done in IntelliJ.

To add a proxy server to Maven, do the following steps:

  1. Navigate to: C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2022.1.1\plugins\maven\lib\maven3\conf, adjusting the version number of your Maven build. Find the file “settings.xml”.

    9en.png

  2. Right-click the document and then select “Open with” and “Notepad”.

    10en.png

  3. Find the block for setting HTTP/HTTPS and make the necessary alterations.

    11en.png

  4. Exit and reload the project for the new changes to take effect.

The process of setting a proxy for Gradle is different from that for Maven. Before proceeding, ensure the following are complete:

  • Gradle has been downloaded and installed.
  • Gradle parameters have been added into Windows system variables.

Once it is confirmed that everything is in place, move forward with adding the proxy in Gradle.

  1. Go to C:/Users/Account_name/.gradle.
  2. Right-click in an open space and click on “New”, “Notepad”. Type the commands for the proxy for Gradle and type the last two if you would like to set exceptions.
    
    systemProp.http.proxyHost=NameHost
    systemProp.http.proxyPort=50100
    systemProp.http.proxyUser=UserName
    systemProp.http.proxyPassword=Password
    systemProp.https.proxyHost=NameHost
    systemProp.https.proxyPort=50101
    systemProp.https.proxyUser=UserName
    systemProp.https.proxyPassword=Password
    
    systemProp.http.nonProxyHosts=*.nonproxy.com
    systemProp.https.nonProxyHosts=*.nonproxy.com
    
    
  3. Name this “gradle.properties” and set the type to “All types”. Reboot the computer to make the changes effective.

These steps show how to set HTTPS proxies in IntelliJ for automated build tools such as Gradle and Maven. With these instructions, the use of the proxy should be simple.

Step 3: Setting Up a Proxy for Git Integration

No modern software development is complete without Git version control systems. Git is extremely handy in keeping records of the changes, comments, or updates done by a number of developers. Git can easily be installed separately, however, JetBrains came with the solution of embedding it within their IDE so that it could be utilized conveniently.

Just like build systems in IntelliJ, Git also has the ability to connect to a proxy with just a few simple commands:


git config --global http.proxy http://proxyUsername:proxyPassword@proxy.server.com:port 

Replace with your host name, port, username, and password.


git config --global --get http.proxy

Verify the connection to the proxy server using this command.

In case you want to set up an IntelliJ HTTP client proxy, use:


git config --global http.https://domain.com.proxy http://proxyUsername:proxyPassword@proxy.server.com:port

For a direct connection, use:


git config --global --unset http.proxy.

These commands greatly simplify the process of connecting or disconnecting Git proxies specially with regional restrictions or within a corporate network.

Troubleshooting Common Proxy Issues in IntelliJ

After we learned: how to set a proxy in intelliJ we might consider possible issues that could arise. Most of the problems with connection through the proxy is because the information fed is wrong or the application does not have the right configuration. Sometimes, these problems relate simply to the incompatibility between the application and the operative system. These tend to be less frequent, but they do exist.

In case the hostname, port and username of IntelliJ proxy settings not working, we recommend resolving it as follows:

For IntelliJ

Go to “File”, “Settings”, “Appearance & Behavior”, “System Settings”, “HTTP Proxy”. Delete the parameters of the HTTP connection and input them again.

16en.png

For Maven

Since the proxy parameters for Maven were set by editing the “settings.xml” file, it is worth double-checking it, and as an alternative solution, you can use intelliJ IDEA import settings through virtual machine options.

For this:

  1. In the integrated development environment tool bar, click “Search”, type “Maven” and select “Maven Settings”.

    17en.png

  2. Under the drop down side menu, “Maven”, “Importing”. In the VM options for the importer box, type: "-DproxySet=true -DproxyHost=hostName.com -DproxyPort=50100".

    Ensure to change the host name and port to your credentials as these are placeholders.

    18en.png

  3. The same command should be written in the “Maven”, “Runner” branch as well.

    19en.png

    20en.png

  4. Once the commands have been entered, it is necessary to restart the project in order for the changes to take effect and see if the proxy is working properly.

For Gradle

If you already filled in the required information to connect the builder through proxy server in the “gradle.properties” file but the connection is still not working, the issue might be in the program settings. In most cases, the necessary path is missing in the windows environment variables. To set it up, follow these simple instructions:

  1. Right click on the “This PC” icon and click on “Properties”.
  2. A window with some operating system settings will show up. In the right side bar, select “Advanced system settings”.

    21en.png

  3. In the “Advanced” tab, select the “Environment Variables” button.

    22en.png

  4. Select “Path” and click “Edit”.

    23en.png

  5. In the new window that appears, click on “New” and paste the link to the “bin” folder in the “Gradle” folder. This link should resemble the following: C:\Gradle\gradle-8.13\bin.

    24en.png

  6. It will also be necessary to create the variable GRADLE_HOME and point it to the unpacked distribution while adding %GRADLE_HOME%bin to the path.
  7. Once these settings have been adjusted along with the PC being restarted, the proxy should work correctly.

The above approaches on solving connection issues for IDEA have all been practically verified, and they frequently assist in rectifying other errors that may arise while configuring the server. We recommend adhering to the instructions described above on how to set a proxy in intelliJ to avoid problems in the future.

Benefits of Using a Proxy in IntelliJ IDEA

The development environment of IntelliJ IDEA offers a proxy for multitudes of different usage scenarios. Some of the most important ones include:

  • Improving product quality through testing and debugging: programmers may deploy proxy services for interception of HTTP calls, then analyze those calls' messages and payloads. For instance, you may want to see what requests have been initiated from the client side and what information is currently being sent back and forth. This is very important for diagnostics and resolving problems.
  • Anonymity and isolation of network requests: as it is known, a proxy masks the actual IP address. Nevertheless, at development or testing stages, the application can be configured to funnel all the software requests through a proxy server instead of directing them to the Internet. Consequently, it is possible to control the traffic as well as tighten the security of the application.
  • Bypassing restrictions and blockades: this is also useful for developers working with open APIs, Plugins, or other services. These resources often need to be accessed for downloading or updating purposes, but such access is only available through a server.
  • Performance enhancement through data caching: there is a sharp reduction in development and testing cycles as the intermediary server can save frequently sought data in its cache, thus minimizing response waiting time.
  • Traffic filtering: proxy servers can be utilized by programmers to scrutinize traffic, eliminate unwanted queries, and external threats, thus protecting the product more effectively.

This is neither an all-encompassing nor a conclusive list of the many advantages that proxies offer in IntelliJ IDEA. Nevertheless, it can be assured that this integrated proxy offer development environment is useful in programming, testing, debugging, application security, and performance enhancement of the developed applications.

Conclusion

The integrated proxy server in IntelliJ IDEA serves as the answer for many modern companies whose core business involves software development. It provides a way to interact with remote resources like external repositories, APIs, perform application testing and debugging, plug-in updates, while overcoming various blockades, and all this while reinforcing the data security wall. Following the order of steps outlined above in the how to set a proxy in intelliJ will not only enhance the product development outcome, but also streamline the software engineer's work within certain network environments.

Comments:

0 comments