How to Speed Up Maven Archetype Project Creation with Internal Catalog
When generating Maven projects with the archetype plugin, developers often encounter long waits or failures; this guide explains four practical solutions—including adding the internal catalog parameter, setting VM options, using a local archetype‑catalog.xml, and configuring Maven mirrors—to accelerate project creation and avoid errors.
Preface
In real development we often use Maven's archetype plugin to generate project scaffolding, but the creation process can get stuck, taking a long time or failing. [INFO] Generating project in Batch mode Below are four solutions to resolve the issue.
Solution 1
Add the parameter archetypeCatalog=internal when creating the Maven project (click “+” to add the parameter).
Solution 2
In Maven’s VM Options add -DarchetypeCatalog=internal or -DarchetypeCatalog=local (Settings → Build, Execution, Deployment → Build Tools → Maven → Runner → VM Options).
Solution 3
Prepare an archetype-catalog.xml file:
Method 1: Browse to http://repo1.maven.org/maven2/archetype-catalog.xml, copy the source and save locally.
Method 2: Use command line
curl http://repo1.maven.org/maven2/archetype-catalog.xml > archetype-catalog.xml.
Place the file in Maven’s default repository directory (usually ~/.m2), not the installation path. If you have customized the location, check Maven’s /config/settings.xml.
When running archetype:generate, add the parameter -DarchetypeCatalog=local. IDEs such as Eclipse and IntelliJ IDEA allow setting this during project creation.
Solution 4
Modify Maven’s conf/settings.xml to use a domestic mirror, for example the Alibaba Cloud mirror:
<mirror>
<id>alimaven</id>
<name>aliyun maven</name>
<url>http://maven.aliyun.com/nexus/content/groups/public/</url>
<mirrorOf>central</mirrorOf>
</mirror>After applying these changes, the project generation completes quickly (e.g., 1.146 seconds).
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
Java High-Performance Architecture
Sharing Java development articles and resources, including SSM architecture and the Spring ecosystem (Spring Boot, Spring Cloud, MyBatis, Dubbo, Docker), Zookeeper, Redis, architecture design, microservices, message queues, Git, etc.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
