If your Internet connection is provided via a proxy Maven will not be able to download jars from remote repositories - a common problem faced by companies.
To solve this, Maven needs to be provided the details and credentials of the proxy by going to {Maven install location} → conf → settings.xml
. Scroll down to the <proxies>
tag and enter the details here, using the format mentioned in the comments.
For Eclipse users
Eclipse uses it's own settings.xml
file for running Maven, whose location can be found by going to the menu Window → Preferences → Maven → User Settings → User Settings:. If the file is not available in the location mentioned, simply create it yourself or create a duplicate of the file from the above location {Maven install location} → conf → settings.xml
.
For IntelliJ users
Open the settings and navigate to Maven -> Importing. (This may be nested under Build, Execution, Deployment -> Build Tools ->, depending on the IntelliJ version you're using.)
Set the field named "VM options for importer" like:
-DproxySet=true -DproxyHost=<HOST> -DproxyPort=<PORT>
-DproxySet=true -DproxyHost=myproxy.com -DproxyPort=8080
Apply and restart IntelliJ.