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

Maven连接Nexus遇PluginResolutionException及连接失败,如何解决?

解决Maven PluginResolutionException与Nexus连接问题

Hey there, let's work through this PluginResolutionException and Nexus connection issue step by step! First off, I spotted a tiny but critical typo in your ~/.m2/settings.xml snippet that might be throwing things off—let's start there, then cover other common fixes.

1. Fix the Obvious Typo in Settings.xml

Your config has <severs> instead of <servers>—this misspelled tag will prevent Maven from recognizing your Nexus server authentication details entirely. Correct it to:

<servers>
  <server>
    <id>Releases</id>
    <username>deployment</username>
    <password>test1234</password>
  </server>
  <!-- Add your other server config here if incomplete -->
</servers>

2. Ensure Nexus Repository & Mirror Configurations Are Complete

PluginResolutionException usually happens when Maven can't find a source for plugins. You need to make sure Maven knows to use your Nexus instance for both dependencies and plugins:

Add a Mirror in settings.xml

This tells Maven to route all central repository requests through your Nexus:

<mirrors>
  <mirror>
    <id>nexus-mirror</id>
    <mirrorOf>central</mirrorOf>
    <url>http://your-nexus-url/repository/maven-public/</url>
  </mirror>
</mirrors>

Add a Profile with Repository & Plugin Repository

Make sure Maven has access to Nexus plugin repositories, and link the repo ID to your server auth ID:

<profiles>
  <profile>
    <id>nexus-profile</id>
    <repositories>
      <repository>
        <id>Releases</id>
        <url>http://your-nexus-url/repository/maven-releases/</url>
        <releases><enabled>true</enabled></releases>
        <snapshots><enabled>false</enabled></snapshots>
      </repository>
    </repositories>
    <pluginRepositories>
      <pluginRepository>
        <id>Releases</id>
        <url>http://your-nexus-url/repository/maven-releases/</url>
        <releases><enabled>true</enabled></releases>
        <snapshots><enabled>false</enabled></snapshots>
      </pluginRepository>
    </pluginRepositories>
  </profile>
</profiles>
<activeProfiles>
  <activeProfile>nexus-profile</activeProfile>
</activeProfiles>

Note: The <id> values here must match exactly with the <id> in your <server> config—this is how Maven maps authentication to the repository.

3. Verify Nexus Connection & Permissions

  • Manually visit your Nexus repository URL in a browser to confirm it's reachable.
  • Check that your deployment user has read permissions for the Maven releases repository in Nexus (you can set this in Nexus's user role settings).
  • Test the connection with verbose Maven logging to see exactly what's happening:
    mvn clean install -U -X
    
    The -U flag forces dependency updates, and -X prints detailed logs—look for lines about repository connections or authentication failures.

4. Clean Local Maven Cache

Corrupted local cache files can also cause resolution issues. Clear the cache and rebuild:

rm -rf ~/.m2/repository

Then run your build command again to let Maven re-download everything from Nexus.

If you still hit issues after these steps, share a snippet of the verbose log from the mvn clean install -X command, and we can dig deeper!

内容的提问来源于stack exchange,提问作者박지훈

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.05.22 09:38:04