One-Click Maven Multi-Module Setup for Java Projects with IntelliJ Plugin
Discover how to dramatically speed up Java Maven multi‑module project creation by using a custom IntelliJ plugin that generates full module structures, configures dependencies, and applies best‑practice settings in seconds, complete with installation methods, usage tips, and troubleshooting advice.
Introduction
When starting a new Java project, many developers still manually create Maven multi‑module directories, write pom.xml dependencies, and adjust the structure, which can waste an entire afternoon. This plugin automates those repetitive steps, reducing setup time from minutes to seconds.
Development Background
Both newcomers and experienced engineers often repeat the same mechanical tasks when initializing a project. The author spent two weeks creating a plugin that generates the full project skeleton with a single command, cutting the average setup time from 40 minutes to about 30 seconds.
Core Features
One‑Click Generation : Input module names and the plugin creates the complete directory structure and pom dependencies.
Smart Dependency Linking : Modules are linked according to the order you provide (e.g., api→service→pojo).
Full Customization : Module names, Java version, and other settings can be adjusted to match company standards.
Best‑Practice Templates : Generates Maven‑recommended directory layouts and configuration files.
Zero‑Config Start : Automatically adds .gitignore and README.md so the project is ready to code immediately.
Installation (Two Methods)
Method 1: Marketplace (Recommended for Beginners)
Open IDEA settings ( Ctrl+Alt+S on Windows, Cmd+, on macOS).
Navigate to Plugins and switch to the Marketplace tab.
Search for Maven-aggregation Quickstart and click Install.
Restart IDEA.
Method 2: Manual Offline Installation
Download the latest .jar from the plugin repository.
Open the plugin settings page in IDEA and click the gear icon.
Select Install Plugin from Disk... and choose the downloaded .jar.
Note: IDEA version must be 2020.3 or newer.
Hands‑On Guide
Step 1: Open the Creation Wizard
After restarting IDEA, choose File > New > Create Maven Aggregation Project (or right‑click a module and select New - Create Maven Aggregation Project).
Step 2: Fill Project Information
GroupId : e.g., com.wandong ArtifactId : project name in lowercase, e.g., user-center Version : default 1.0.0 Module Names : comma‑separated business order, e.g., api,service,pojo,common Java Version : choose 11 or 17.
Tip: The order of modules determines the automatic dependency chain.
Step 3: Finish
Click Finish. The plugin generates the full Maven structure in seconds.
ecommerce-platform/
├── api/
├── service/
├── pojo/
├── common/
├── pom.xml // parent pom
├── README.md
└── .gitignoreAdvanced Customization
To adapt the plugin to a team’s coding standards, edit the Velocity templates located in the plugin’s templates directory (e.g., ~/.local/share/JetBrains/IntelliJIdea/plugins/…/templates on Linux/macOS or the equivalent path on Windows). After modifying the templates, restart IDEA and new projects will follow the custom layout.
Common Issues & Solutions
Out‑of‑Memory Errors : Increase IDEA’s heap size via Help > Edit Custom VM Options and raise -Xmx (e.g., -Xmx2048m).
Plugin Not Found : Ensure IDEA version is 2021.1 or newer; reinstall 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).
Source Code & Build
Clone the plugin source, build with Maven, and install the generated .jar for testing:
git clone [email protected]:tingyuabc/maven-aggregation-quickstart.git
cd maven-aggregation-quickstart
mvn clean packageAfter a successful build, locate the .jar in the target/ directory and install it via IDEA’s Install Plugin from Disk... option.
Conclusion
The plugin was created to eliminate repetitive project‑initialization tasks and has become the team’s standard “secret sauce” for bootstrapping Java Maven projects quickly and consistently.
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.
macrozheng
Dedicated to Java tech sharing and dissecting top open-source projects. Topics include Spring Boot, Spring Cloud, Docker, Kubernetes and more. Author’s GitHub project “mall” has 50K+ stars.
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.
