How to Stop Maven Archetype from Hanging and Speed Up Project Creation

This guide explains why Maven archetype project creation often hangs or fails, and provides four practical solutions—including adding internal catalog parameters, configuring VM options, preparing a local archetype‑catalog.xml, and setting an Alibaba mirror—to speed up builds and avoid errors.

Java Interview Crash Guide
Java Interview Crash Guide
Java Interview Crash Guide
How to Stop Maven Archetype from Hanging and Speed Up Project Creation

In real development we often use Maven's archetype plugin to generate project scaffolding, but creation frequently gets stuck, taking a long time or failing. [INFO] Generating project in Batch mode Below are practical solutions.

Solution 1

Add the parameter archetypeCatalog=internal when creating the Maven project (click “+” to add the parameter).

Solution 2

Add -DarchetypeCatalog=internal or -DarchetypeCatalog=local to Maven VM Options (Settings → Build, Execution, Deployment → Build Tools → Maven → Runner → VM Options).

Solution 3

Prepare an archetype-catalog.xml file:

Method 1: Browse http://repo1.maven.org/maven2/archetype-catalog.xml, copy the source, and save it locally.

Method 2: Use the command line:

curl http://repo1.maven.org/maven2/archetype-catalog.xml > archetype-catalog.xml

Place the file in Maven’s default repository path (usually ~/.m2), not the installation directory. You can check the exact location in Maven’s settings file ( config/settings.xml).

When building, add -DarchetypeCatalog=local after archetype:generate. IDEs like Eclipse and IntelliJ IDEA allow setting this parameter during project creation.

Solution 4

Modify conf/settings.xml to use Alibaba’s Maven mirror:

<mirror>
    <id>alimaven</id>
    <name>aliyun maven</name>
    <url>http://maven.aliyun.com/nexus/content/groups/public/</url>
    <mirrorOf>central</mirrorOf>
</mirror>

Testing shows the build completes in about 1.146 seconds.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

Javadependency managementmavenbuild toolsArchetype
Java Interview Crash Guide
Written by

Java Interview Crash Guide

Dedicated to sharing Java interview Q&A; follow and reply "java" to receive a free premium Java interview guide.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.