You may have encountered this error when using MAVEN in corporate environments which is due to the proxy issue. You may even get this error even after configuring proxy setting in Eclipse- > Window -> Preferences -> General -> Network Connections
. The problem is that MAVEN wont use this PROXY setting for downloading the dependency JAR’s. So we need to configure the MAVEN proxy separately.
How to Solve the Issue
Step 1: Go to C:\Users\usernname\m2
Step 2: Create file named settings.xml
with the following content and .
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd"> <localRepository/> <interactiveMode/> <usePluginRegistry/> <offline/> <pluginGroups/> <servers/> <mirrors/> <proxies> <proxy> <id>proxyname</id> <active>true</active> <protocol>http</protocol> <host>HOSTNAME/IP</host> <port>PORT</port> <username>USERNAME(if needed)</username> <password>PASSWORD(if needed)</password> <nonProxyHosts>localhost,127.0.0.1</nonProxyHosts> </proxy> </proxies> <profiles/> <activeProfiles/> </settings>
Step 3: Go to Eclipse- > Window -> Preferences -> Maven -> User Settings
.
Step 4: Select the settings.xml file in Global Settings
and User Settings
.
Step 5: Click Apply and Ok,
Enjoy!!!