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

解决创建Maven项目时的‘No plugin found for prefix 'archetype'’错误

Hey there, let's work through this Maven archetype issue step by step—you’ve already done some troubleshooting, so let’s build on that to fix the problem.

First, fix that command typo

You mentioned running mvn archetype: generate (with a space after the colon) and getting a "no POM file" error. That’s just a simple formatting mistake: the correct command is mvn archetype:generate with no space between the colon and generate. Maven interprets the space as a separate goal, which is why it looked for a POM in your current directory. That’s an easy fix for that particular error!

Now, tackle the core issue: No plugin found for prefix 'archetype'

Even with your proxy config, Maven can’t pull the archetype plugin metadata. Let’s go through the most likely fixes:

1. Update your proxy config to support HTTPS

Maven’s central repository uses HTTPS by default, but your current settings only define an HTTP proxy. Add an HTTPS proxy entry to your ${user.home}/.m2/settings.xml (use the same host/port your colleague provided unless told otherwise):

<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 https://maven.apache.org/xsd/settings-1.0.0.xsd">
  <proxies>
    <proxy>
      <id>my-http-proxy</id>
      <active>true</active>
      <protocol>http</protocol>
      <host>my_host</host>
      <port>my_port</port>
      <nonProxyHosts>localhost|127.0.0.1|*.my_company.com</nonProxyHosts>
    </proxy>
    <proxy>
      <id>my-https-proxy</id>
      <active>true</active>
      <protocol>https</protocol>
      <host>my_host</host>
      <port>my_port</port>
      <nonProxyHosts>localhost|127.0.0.1|*.my_company.com</nonProxyHosts>
    </proxy>
  </proxies>
</settings>

Also, check if your company proxy requires authentication—if so, add <username> and <password> fields inside each proxy block (ask your colleague if you don’t have these details).

2. Clear Maven’s cache and force an update

Maven caches plugin metadata, and sometimes stale or corrupted cache files cause this error. Delete the archetype plugin’s cached files and force Maven to refresh everything:

# Delete the cached archetype plugin files
rm -rf ~/.m2/repository/org/apache/maven/plugins/archetype

# Run generate with the -U flag to force metadata update
mvn -U archetype:generate

The -U flag tells Maven to skip cached metadata and pull fresh copies from the repository.

3. Check for a company Maven mirror

Many companies run an internal Maven mirror that proxies central repository requests. If your company has one, add a mirror config to your settings.xml—this is often more reliable than using a direct proxy:

<settings ...>
  <!-- Keep your existing proxy config if needed -->
  <mirrors>
    <mirror>
      <id>company-mirror</id>
      <mirrorOf>central</mirrorOf>
      <url>http://your-company-maven-mirror-url/repository/maven-public/</url>
    </mirror>
  </mirrors>
</settings>

Ask your team or IT department for the correct mirror URL if you don’t have it.

4. Test if your proxy actually connects to Maven Central

Verify that your proxy can reach Maven Central using curl:

curl -x http://my_host:my_port https://repo.maven.apache.org/maven2/

If this returns a HTML page with directory listings, your proxy is working. If it times out or errors, double-check the host/port with your colleague—there might be a typo or missing authentication requirement.

Final checks

  • Make sure you’re running a recent version of Maven (3.8.x or newer). Older versions have issues with HTTPS and modern proxy setups. You can check your version with mvn -v.
  • Ensure your settings.xml is saved in the correct location: ${user.home}/.m2/settings.xml (that’s ~/.m2/settings.xml on Linux/macOS, C:\Users\YourName\.m2\settings.xml on Windows).

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.05.12 05:10:54