Working with Maven multimodule projects in NetBeans
Maven lets a Java codebase split into a parent project and several focused child modules while retaining one dependency graph and build lifecycle. In NetBeans, those modules appear together in the Projects window, so a developer can edit a shared API, domain model, service implementation and web tier without maintaining unrelated builds.
This matters for Australian teams that commonly distribute delivery across Sydney, Melbourne, Brisbane and Perth. A shared Maven configuration reduces local drift, while a corporate artefact mirror can improve access to the libraries used by banks, government suppliers and established Java EE organisations. For a Perth developer working while Sydney sleeps, CI feedback keeps things moving through the arvo instead of leaving a dependency failure waiting for another office to wake.
The important distinction is that a Maven multimodule project is a POM hierarchy, not an Apache NetBeans Module, or NBM. NetBeans provides the IDE integration, but Maven still owns module order, dependency versions, packaging and repeatable builds. Get that boundary right and the setup stays much easier to maintain.
Shape the project hierarchy
Start by choosing boundaries around stable responsibilities rather than individual developers. A parent aggregator can contain a shared model, service API, an EJB implementation and a Jakarta EE web module. The NetBeans background explains how the IDE’s Maven support fits into the wider platform.
Create the parent as a Maven project with pom packaging, then use the Maven Module wizard from its context menu to add children. Confirm that every child lists the parent in modules and points its parent reference to the correct relativePath. Open the top-level pom.xml and review the resulting reactor graph before adding code.
Connect modules through Maven
Put versions and dependency rules in the parent’s dependencyManagement section, and let child POMs declare only the artefacts they use. This avoids copying version numbers across modules and makes upgrades predictable. Use a platform BOM or carefully chosen internal BOM where several libraries must remain aligned.
Before wiring teams, agree ownership and release rules for each boundary. Phil Schwartz’s project notes offer a useful perspective on keeping project work visible and manageable. A short dependency matrix showing each module’s owner, published artefact and allowed consumers prevents accidental coupling.
Control dependency and plugin resolution
NetBeans resolves project dependencies through Maven, so effective POM and dependency-tree views are essential debugging tools. Check which repository supplies each JAR, especially when an Australian office works through a managed proxy or an internal Nexus, Artifactory or other artefact mirror rather than Maven Central alone.
Provide a sanitised settings.xml template containing mirror URLs and server IDs, while keeping credentials in local Maven settings or an enterprise credential manager. Keep plugin versions under pluginManagement and use properties for Java release levels. Older platform notes in the NetBeans Blog archive can help when an upgrade changes resolver or formatter behaviour.
Build and test in reactor order
Running Clean and Build on the parent lets Maven’s reactor compile dependencies before their consumers. The output still lands in each module’s target directory, and a successful reactor summary makes skipped or failed modules obvious. Build the parent regularly; building a child alone can hide an invalid sibling relationship.
Use NetBeans’ test window for fast JUnit feedback, then run the Maven verify lifecycle for the authoritative result. Separate unit, integration and container tests with Maven profiles or Surefire and Failsafe configuration. In CI, the checked-in wrapper should run a command such as ./mvnw -U clean verify with the same mirror and profile rules used by developers.
Debug across project boundaries
Debugging works across modules when NetBeans sees the reactor output as the selected project’s classpath. Put a breakpoint in an implementation method, launch the owning module with Debug, and inspect values as the request passes through an API module into service code.
If the debugger attaches but shows stale types, clean the parent and rebuild the dependency before trying again. Avoid debugging an artefact already installed in the local Maven repository, because that can mask source changes. For remote Java EE or microservices, configure the JVM debugger port and host access deliberately.
Standardise formatting and IDE settings
Formatting rules belong in shared project settings, because reviewers should not debate spaces versus tabs. NetBeans can use its built-in formatter, while teams that prefer Eclipse conventions can follow this Eclipse formatter configuration. Commit the resulting configuration and apply it consistently across modules.
Also standardise UTF-8, line endings, annotation processing and proxy settings without recording personal filesystem paths. Keep the Maven wrapper, JDK baseline and formatter configuration together in version control. These small choices are particularly helpful when a Melbourne developer and a Perth colleague generate code on different operating systems.
Practical recommendations for a durable workflow
Module boundaries need maintenance as products evolve. Record each module’s responsibility and public API, watch for dependency cycles, and review dependency trees during every upgrade. A release should update the parent version and changelog, even when a child’s code has not changed.
Visible inventories make that upkeep less tedious, a practical idea also illustrated by Emily’s Project List. Keep the list beside the reactor rather than in separate spreadsheets, and include ownership, release cadence and retirement status for every module.
- Keep Maven parent and child POMs as the source of truth; use NBM packaging only for deliberate IDE-specific deliverables.
- Use
dependencyManagementandpluginManagementso versions are inherited predictably. - Build the full reactor in CI and test the exact artefacts intended for release.
- Keep credentials, mirrors and proxy details in managed settings, never in source control.
- Run the parent Clean and Build after resolver, JDK or plugin changes.
- Document module ownership, public APIs, release rules and deprecation plans.
Treat this as a build system rather than a folder of convenient projects. With Maven responsible for structure and NetBeans handling navigation and feedback, teams in Brisbane can publish the same tested reactor as a team in Adelaide, and future maintainers can reproduce it without relying on local NetBeans settings.