Boost Maven Multi‑Module Project Setup with a One‑Click Generation Plugin
This article introduces a Maven aggregation plugin for IntelliJ IDEA that automates the creation of multi‑module Java projects, detailing its core features, installation methods, step‑by‑step usage, customization options, and troubleshooting tips to dramatically reduce setup time.
Why Build a One‑Click Maven Plugin?
When new team members manually create Maven multi‑module projects—building folders, writing pom.xml dependencies, and adjusting structures—it can take hours. Even experienced developers repeat these tedious steps, so the author spent two weeks developing a plugin that generates a complete project in about 30 seconds.
Core Features of the Plugin
One‑Click Generation: Enter module names and the plugin creates the full directory structure with correctly configured pom.xml files.
Smart Dependency Linking: Provide module names in business order (e.g., api→service→pojo) and the plugin automatically sets up inter‑module dependencies.
Full Customization: Module names, Java version, and generated structure can be adjusted to match company standards.
Best‑Practice Templates: Generates Maven‑recommended directory layouts and configurations.
Zero‑Config Startup: Automatically adds .gitignore and README files.
Installation Methods
Method 1 – Marketplace (recommended for beginners): The plugin is under review, so download the JAR manually, then install it via the IDE’s plugin settings.
Method 2 – Offline Installation: Download the latest JAR from the plugin repository, open IDEA settings ( Ctrl+Alt+S or Cmd+, on macOS), go to Plugins → Marketplace, click the gear icon, choose “Install Plugin from Disk…”, and select the JAR.
Note: IDEA version must be 2020.3 or newer.
Using the Plugin
1. Open the creation wizard after restarting IDEA, create an Empty Project, then select File → New → Create Maven Aggregation Project under New Project.
2. Fill in the configuration page:
GroupId: reverse domain of your organization, e.g., com.wandong.
ArtifactId: project name in lowercase, e.g., user-center.
Version: default 1.0.0.
Module Names: list modules in business order, separated by commas, e.g., api,service,pojo,common.
Java Version: choose 11 or 17.
3. Click Finish . The plugin generates the full project structure in seconds.
ecommerce-platform/
├── api/
├── service/
├── pojo/
├── common/
├── pom.xml // parent pom
├── README.md
└── .gitignoreEach module follows the standard Maven layout with src/main/java and src/test/resources directories already created.
module-name/
├── src/
│ ├── main/
│ │ ├── java/ // source code
│ │ └── resources/ // resources
│ └── test/
│ ├── java/ // test code
│ └── resources/ // test resources
└── pom.xml // module pomAdvanced Customization
To adapt the plugin to team‑specific templates, locate the plugin installation directory ( ~/.local/share/JetBrains/IntelliJIdea/plugins/ on Linux/macOS or C:\Users\<em>Username</em>\AppData\Roaming\JetBrains\ on Windows), edit the templates folder’s Velocity files, and restart IDEA.
Troubleshooting
Out‑of‑Memory Errors: Increase the IDE’s VM options, e.g., -Xmx2048m.
Plugin Not Found: Ensure IDEA version is 2021.1+; reinstall if necessary.
Changing Java Version: Edit maven.compiler.source and maven.compiler.target in the parent pom.xml.
Source Code
The plugin’s source is hosted on Gitee: https://gitee.com/tingyuabc/maven-aggregation-quickstart .
Future plans include adding Spring Boot version selection and module‑permission templates. Contributions are welcome.
Architecture Digest
Focusing on Java backend development, covering application architecture from top-tier internet companies (high availability, high performance, high stability), big data, machine learning, Java architecture, and other popular fields.
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.
