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

求助:Maven清理插件maven-clean-plugin:2.5依赖无法解析

Fixing Maven Clean Plugin Resolution Failure on Ubuntu 17.10

Hey there, let's work through this plugin resolution issue since you've already tried the usual quick fixes (deleting .m2 and re-cloning the project). Since the project works on other machines, the problem is almost certainly tied to your local Ubuntu environment or network setup. Here are targeted steps to debug and fix it:

1. Verify Maven's Settings Configuration

Maven might be using a misconfigured settings.xml that's blocking access to the central repository.

  • Check both global and user-level settings files:
    • Global: /etc/maven/settings.xml
    • User: ~/.m2/settings.xml
  • If you suspect the settings are corrupted, replace the user-level file with Maven's default template:
    cp /usr/share/maven/conf/settings.xml ~/.m2/settings.xml
    
  • Look for any incorrect mirror URLs or proxy settings that could be interfering with repository access.

2. Test Network Access to Maven Central

Your Ubuntu machine might be unable to reach the Maven Central repository due to network issues.

  • Run this curl command to check if you can download the plugin's POM file directly:
    curl -v https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-clean-plugin/2.5/maven-clean-plugin-2.5.pom
    
  • If the command fails (timeouts, DNS errors), fix your network connection first:
    • Check DNS settings (try switching to Google DNS: 8.8.8.8 in /etc/resolv.conf)
    • Disable any VPN or corporate proxy temporarily to test
    • Verify Ubuntu's firewall isn't blocking outgoing HTTPS traffic (you can test with sudo ufw disable, then re-enable later with sudo ufw enable)

3. Confirm Maven-JDK Compatibility and Configuration

Even though Maven 3.5 and OpenJDK 8 are compatible, double-check that Maven is using the correct Java version:

  • Run mvn -version and verify the output shows your installed OpenJDK 1.8.151.
  • If it's pointing to a different Java version, set the correct JAVA_HOME in your shell profile:
    # Add this to ~/.bashrc or ~/.zshrc
    export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64
    export PATH=$JAVA_HOME/bin:$PATH
    
  • Reload the profile with source ~/.bashrc and re-run mvn -version to confirm.

4. Manually Install the Plugin to Local Repository

If Maven still can't pull the plugin, download it manually to bypass any automated resolution issues:

  1. Create the required directory structure in your .m2 repo:
    mkdir -p ~/.m2/repository/org/apache/maven/plugins/maven-clean-plugin/2.5
    
  2. Download the plugin files (search for maven-clean-plugin 2.5 on the Maven Central web interface to get these):
    • maven-clean-plugin-2.5.pom
    • maven-clean-plugin-2.5.jar
  3. Move both files into the directory you created, then run mvn clean again.

5. Force Update Dependencies

Sometimes stale metadata can cause resolution issues, even after deleting the .m2 repo. Run this command to force Maven to refresh all dependency metadata:

mvn clean install -U

One of these steps should get the plugin resolving correctly. Since the project works elsewhere, it's just a matter of fixing the local environment kinks!

内容的提问来源于stack exchange,提问作者TheWildHealer

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.05.19 07:30:12