You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Maven settings.xml代理配置报错求助:未使用代理却无法构建项目

Fixing Maven Proxy Configuration Error When Not Using a Proxy

Hey there! I see you're stuck with a Maven proxy issue while setting up your web app for your school project—let's get this sorted out quickly.

First things first: Proxy configuration is NOT mandatory

You don't need to have a <proxy> block in your settings.xml if you're not using a proxy server to access the internet. The problem here is that your current settings.xml has an active proxy configuration pointing to a non-existent proxy server (proxy.host.net), which is why Maven is timing out trying to connect through it.

Step-by-step solutions:

  1. Disable or remove the invalid proxy configuration
    Open your settings.xml file (usually located in ~/.m2/ on Linux/macOS or C:\Users\<your-username>\.m2\ on Windows) and do one of the following:

    • Option 1: Turn off the proxy by changing <active>true</active> to <active>false</active>
    • Option 2: Comment out the entire <proxy> block (safer if you might need it later)

    Here's how the commented-out version would look:

    <!-- <proxy>
        <id>optional</id>
        <active>true</active>
        <protocol>http</protocol>
        <username>proxyuser</username>
        <password>proxypass</password>
        <host>proxy.host.net</host>
        <port>80</port>
        <nonProxyHosts>local.net|some.host.com</nonProxyHosts>
    </proxy> -->
    
  2. Clear Maven's cached failed requests
    Your error message mentions that Maven cached the failed connection attempts. To force it to retry, run this command in your project directory:

    mvn clean install -U
    

    The -U flag tells Maven to ignore cached metadata and fetch fresh copies from the central repository.

  3. Verify the fix
    Run a simple test command to make sure Maven can now connect properly:

    mvn help:system
    

    If this runs without any "connection timed out" errors, you're good to go!

Why this was happening:

Maven was trying to route all its requests to the central repository through the proxy server defined in your settings.xml, but that proxy doesn't exist (or isn't reachable from your network). Disabling that proxy lets Maven connect directly to the repository, which resolves all those plugin download failures.

内容的提问来源于stack exchange,提问作者Đào Thiện Tuấn

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.15 04:09:52