Boost Java Project Setup with a One‑Click Maven Multi‑Module Generation Plugin
This article explains how a custom IntelliJ IDEA plugin can automate the creation of Maven multi‑module projects, turning a tedious half‑hour manual process into a 30‑second one‑click operation, and provides step‑by‑step installation, usage, customization, and troubleshooting guidance.
Introduction
A senior architect noticed that junior developers in the team still built Maven multi‑module projects manually—creating folders, writing pom.xml dependencies, and adjusting directory structures—wasting an entire afternoon before a basic framework was ready.
Even experienced engineers repeat these repetitive steps for every new project, leading to an average setup time of 40 minutes and frequent dependency mistakes.
Why a plugin?
During a recent onboarding, an intern spent an afternoon stuck on a four‑module project (api, service, pojo, common) because dependencies were reversed or directories were mis‑structured, prompting the question: can this be fully automated?
The solution is a lightweight IntelliJ IDEA plugin that generates the entire Maven structure, configures dependencies, and follows company standards in seconds.
Core Features of the Plugin
One‑click generation: Enter module names and the plugin creates the full project skeleton with correct pom.xml dependencies.
Smart dependency linking: Provide module order (e.g., api→service→pojo) and the plugin automatically adds the appropriate dependency tags.
Full customization: Module names, Java version, and directory layout can be adjusted to match internal coding standards.
Best‑practice templates: Generated directories and configurations follow Maven’s official recommendations.
Zero‑config start: The plugin also creates a ready‑to‑use .gitignore and README so the project can be built immediately.
Installation Methods
Method 1: Marketplace (recommended for beginners)
Open IDEA settings ( Ctrl+Alt+S on Windows, Cmd+, on macOS).
Navigate to Plugins → Marketplace.
Search for Maven aggregation Quickstart and click Install.
Restart IDEA after the installation completes.
This method works once the plugin passes the marketplace review.
Method 2: Manual offline installation
Download the latest .jar from the plugin repository.
Open the plugin settings page and click the gear icon ⚙️.
Select Install Plugin from Disk... and choose the downloaded .jar.
Note: The plugin requires IntelliJ IDEA 2020.3 or newer; older versions may be incompatible.
Using the Plugin – Practical Example
Step 1: Create a Maven Aggregation Project
After restarting IDEA, choose File → New → Create Maven Aggregation Project from the New Project wizard.
Step 2: Fill Project Information
GroupId: Company domain in reverse, e.g., com.wandong.
ArtifactId: Project name in lowercase, e.g., user-center.
Version: Default 1.0.0 (adjust later if needed).
Module names: List modules in business order, separated by commas, e.g., api,service,pojo,common.
Java version: Choose 11 or 17; newer versions may cause compatibility issues.
After confirming, the plugin generates the following structure:
ecommerce-platform/
├── api/
├── service/
├── pojo/
├── common/
├── pom.xml // parent pom
├── README.md
└── .gitignoreEach module follows the standard Maven layout ( src/main/java, src/test/resources, etc.).
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 a team’s specific code style, edit the templates folder inside the plugin installation directory (e.g., ~/.local/share/JetBrains/IntelliJIdea/plugins/ on Linux or the corresponding path on Windows) and modify the Velocity template files. Restart IDEA to apply changes.
Automatic Dependency Management
The plugin adds a dependency from api to service when the module order is api,service,pojo.
It adds a dependency from service to pojo.
All modules automatically depend on common.
No manual editing of dependency tags is required.
Troubleshooting
Out‑of‑memory errors: Increase the IDE heap size via Help → Edit Custom VM Options and set a larger -Xmx value (e.g., -Xmx2048m).
Plugin not found: Ensure IDEA version is 2021.1 or newer; reinstall and restart if necessary.
Changing Java version: Edit the parent pom.xml and set maven.compiler.source and maven.compiler.target to the desired version (e.g., 17).
Building and Testing the Plugin Source
For developers who want to extend the plugin (e.g., add Spring Boot version selection or custom code‑generation rules), the source is available on Gitee.
git clone [email protected]:tingyuabc/maven-aggregation-quickstart.git
cd maven-aggregationBuild the plugin with Maven: mvn clean package After a successful build, install the generated .jar via Install Plugin from Disk... to test locally.
Future Enhancements
Planned features include a Spring Boot version selector and module‑permission templates. Contributions via pull requests are welcome.
Source Repository
https://gitee.com/tingyuabc/maven-aggregation-quickstart
Top Architect
Top Architect focuses on sharing practical architecture knowledge, covering enterprise, system, website, large‑scale distributed, and high‑availability architectures, plus architecture adjustments using internet technologies. We welcome idea‑driven, sharing‑oriented architects to exchange and learn together.
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.
