Boost Your Java Project Setup: One-Click Maven Multi-Module Generation
This article introduces a custom IntelliJ IDEA plugin that automates the creation of Maven multi‑module Java projects, turning a tedious half‑hour setup into a 30‑second one‑click process, while offering smart dependency wiring, customizable templates, and detailed installation and usage instructions.
The author built a plugin to automate the creation of Maven multi‑module Java projects, eliminating the repetitive manual steps of creating folders, writing pom dependencies, and adjusting directory structures, which previously took around 40 minutes.
Development Background
New graduates and even experienced developers often waste hours setting up basic project scaffolding. The plugin generates the full structure, configures pom dependencies automatically, and follows Maven best practices.
Core Features
One‑click generation : Enter module names and the plugin creates the entire structure with pom dependencies. Smart dependency linking : Modules are linked according to the order you provide (e.g., api → service → pojo). Fully customizable : Module names, Java version, and other settings can be changed to match company standards. Best‑practice templates : Generates Maven‑recommended directory layout. Zero‑config start : Automatically adds .gitignore and README files.
Installation (Two Methods)
Method 1: Marketplace (recommended for beginners)
1. Open IDEA settings (Ctrl+Alt+S or Cmd+, on macOS). 2. Go to Plugins → Marketplace. 3. Search for Maven-aggregation Quickstart and click Install. 4. Restart IDEA after the installation finishes.
Method 2: Manual (offline environment)
1. Download the latest JAR from the plugin repository. 2. Open the plugin settings page and click the gear icon. 3. Choose Install Plugin from Disk... and select the downloaded JAR.
Note: The plugin requires IntelliJ IDEA 2020.3 or newer.
Usage Guide
1. Create a new Maven Aggregation Project via File > New > Create Maven Aggregation Project (or right‑click a directory and select New - Create Maven Aggregation Project). 2. Fill in the project information: GroupId (e.g., com.wandong), ArtifactId (e.g., user-center), Version (default 1.0.0), Module names (comma‑separated, e.g., api,service,pojo,common), and Java version (11 or 17). 3. Click Finish. 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/main/resources, src/test/java, etc.).
Advanced Customization
To adapt the template to a team’s coding standards, locate the plugin installation directory ( ~/.local/share/JetBrains/IntelliJIdea/plugins/ on Linux/macOS or C:\Users\<username>\AppData\Roaming\JetBrains\ on Windows), edit the templates folder’s Velocity files, and restart IDEA.
The plugin also automatically adds dependency relationships based on the order of module names (e.g., api depends on service, service depends on pojo, and all modules depend on common).
FAQ
Out‑of‑memory errors : Increase IDEA’s 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.
Building the Plugin from Source
Clone the repository and build with Maven:
git clone https://gitee.com/tingyuabc/maven-aggregation-quickstart.git
cd maven-aggregation-quickstart
mvn clean packageAfter a successful build, install the generated JAR via IDEA’s Install Plugin from Disk... option.
The author plans to add Spring Boot version selection and permission templates in future releases and welcomes contributions via pull requests.
Architect's Tech Stack
Java backend, microservices, distributed systems, containerized programming, and more.
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.
