Boost Your Java Projects: One‑Click Maven Multi‑Module Generation
This article introduces a lightweight IntelliJ IDEA plugin that automates the creation of Maven multi‑module projects, detailing its core features, installation methods, step‑by‑step usage, customization options, dependency handling, troubleshooting tips, and how to build and extend the plugin from source.
Introduction
When starting a new Java backend project, manually creating Maven modules, writing pom.xml dependencies, and adjusting directory structures can waste hours. The author built a plugin that generates a complete multi‑module Maven project with a single command, reducing setup time from dozens of minutes to seconds.
Development Background
Even experienced developers repeat the same tedious steps when initializing projects. The plugin was created to eliminate this repetitive work and standardize project scaffolding.
Core Features
One‑click generation : Enter module names and the plugin creates the full directory structure and configures pom.xml dependencies automatically.
Smart dependency linking : Provide module names in business order (e.g., api→service→pojo) and the plugin sets up the correct Maven dependencies.
Full customization : Module names and Java version can be changed; the generated layout follows company standards.
Best‑practice templates : Uses Maven’s official recommended project layout.
Zero‑config start : Generates a ready‑to‑use .gitignore and README so the repository can be cloned and developed immediately.
Installation Methods
Method 1 – Marketplace (recommended for beginners)
Open IDEA settings ( Ctrl+Alt+S or Cmd+, on macOS).
Navigate to Plugins → Marketplace.
Search for Maven aggregation Quickstart and click Install.
Restart IDEA after installation.
If the plugin is still under review, download the JAR manually and install it later.
Method 2 – Manual offline installation
Download the latest JAR from the plugin repository.
Open the plugin settings page, click the gear icon, and choose Install Plugin from Disk....
Select the downloaded JAR and restart IDEA.
IDEA version 2020.3 or newer is required; older versions may be incompatible.
Practical Walkthrough
Step 1 – Open the creation wizard
Create an empty project, then choose File > New > Create Maven Aggregation Project (found under New 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 Modules : list modules in business order, separated by commas, e.g., api,service,pojo,common Java version : choose 11 or 17 (newer versions may have compatibility issues).
Step 3 – Finish
Click Finish. The plugin creates the following structure (example for an e‑commerce platform):
ecommerce-platform/
├── api/
├── service/
├── pojo/
├── common/
├── pom.xml // parent pom
├── README.md
└── .gitignoreEach module follows the standard Maven layout:
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 own template, edit the Velocity template files located in the plugin’s templates directory (path varies by OS). After modification, restart IDEA and newly generated projects will follow the custom layout.
Automatic Dependency Management
When modules are entered in order (e.g., api,service,pojo), the plugin automatically adds: api depends on
service servicedepends on pojo All modules depend on common by default.
Troubleshooting
Out‑of‑memory errors : Increase IDEA VM options, e.g., -Xmx2048m.
Plugin not found : Ensure IDEA version is 2021.1 or newer; reinstall if necessary.
Changing Java version : Edit maven.compiler.source and maven.compiler.target in the parent pom.xml, e.g.,
<maven.compiler.source>17</maven.compiler.source>.
Extending the Plugin (Advanced Users)
Source code is hosted at https://gitee.com/tingyuabc/maven-aggregation-quickstart. To build:
git clone [email protected]:tingyuabc/maven-aggregation-quickstart.git
cd maven-aggregation-quickstart
mvn clean packageThe resulting JAR appears in target/. Install it via IDEA’s Install Plugin from Disk... for testing.
Conclusion
The plugin dramatically speeds up Maven multi‑module project initialization, enforces consistent structure, and reduces manual errors. Future plans include adding Spring Boot version selection and permission templates. Contributions via pull requests are welcome.
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.
