Generate Maven Multi‑Module Projects in Seconds with a One‑Click Plugin
This article walks you through a Maven aggregation plugin for IntelliJ IDEA that automates multi‑module project creation, configures pom dependencies, supports custom templates, and solves common setup pain points, turning a half‑hour task into a 30‑second operation.
Introduction
Recently I led a team to start a new project and saw fresh graduates still building Maven multi‑module projects manually—creating folders, writing pom dependencies, adjusting directory structures—wasting an entire afternoon without a basic framework.
Background
Last week an intern spent a whole afternoon on a four‑module project (api, service, pojo, common), constantly mixing up dependencies and building chaotic directories, until I had to step in and refactor everything.
Even experienced developers repeat these mechanical steps, so I built a plugin that automates the process, shrinking project setup from hours to minutes.
Plugin Core Features
One‑click generation: input module names and the plugin creates the whole structure with pom dependencies.
Smart dependency linking: entering modules in business order (e.g., api→service→pojo) automatically builds the dependency chain.
Full customization: module names, Java version, etc., can be changed to match company standards.
Best‑practice templates: generated directories and configs follow Maven official recommendations.
Zero‑config start: automatically creates .gitignore and README.
Installation (Two Methods)
Lazy method: Marketplace (recommended for beginners)
Open IDEA, press Ctrl+Alt+S (or Cmd+, on Mac) to open Settings.
Select Plugins, switch to Marketplace.
Search Maven‑aggregation‑Quickstart, click Install, restart IDEA.
Note: the plugin requires IDEA 2020.3 or later.
Manual installation (offline)
Download the latest jar from the plugin repository.
In Settings → Plugins, click the gear icon and choose Install Plugin from Disk..., select the jar.
Practical Walk‑through
1. Open the creation wizard
After restarting IDEA, create an empty project and choose Create Maven Aggregation Project from the New Project menu.
2. Fill project information
GroupId: reverse domain, e.g., com.wandong.
ArtifactId: project name in lowercase, e.g., user-center.
Version: default 1.0.0.
Module names: business‑ordered list separated by commas, e.g., api,service,pojo,common.
Java version: 11 or 17 is recommended.
3. Finish
Click Finish; the plugin creates all modules and configuration files in seconds. Example structure:
ecommerce-platform/
├── api/
├── service/
├── pojo/
├── common/
├── pom.xml
├── README.md
└── .gitignoreEach module follows standard Maven layout ( src/main/java, src/test/resources, etc.), eliminating manual directory creation.
Advanced: Custom Templates
Locate the plugin installation directory (e.g., ~/.local/share/JetBrains/IntelliJIdea/plugins/ or the Windows equivalent).
Edit the templates folder’s Velocity files to match team conventions.
Restart IDEA; new projects will use the customized template.
Dependency Automation
api depends on service.
service depends on pojo.
All modules depend on common.
Troubleshooting
Out‑of‑memory: increase -Xmx in Help > Edit Custom VM Options (e.g., -Xmx2048m).
Plugin not found: ensure IDEA version 2021.1 or newer.
Change Java version: modify maven.compiler.source and maven.compiler.target in the parent pom, setting both to the desired version (e.g., 17).
Source Code & Further Development
Clone the repository, build with mvn clean package, and install the generated jar for testing. The project is hosted on Gitee: https://gitee.com/tingyuabc/maven-aggregation-quickstart . Future plans include Spring Boot version selection and permission templates.
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.
Selected Java Interview Questions
A professional Java tech channel sharing common knowledge to help developers fill gaps. Follow us!
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.
