Skip to content

Maven and Spring

How to share configuration between Spring and Maven

See Deploy to different environments - run-time and configuration-management-with-spring for examples on what's possible.

Filtering in Maven

Use filtering to easily set a different set of properties according to environment.

(+) Provides the same functionality for pom.xml as PropertyOverrideConfigurer and PropertyPlaceholderConfigurer does for the application context. (-) "MavenMagic"

Maven Profiles

Use system properties or profile name to activate and disable profiles. One profile per environment can be used to easily switch between environments.

(+) Flexible (-) Too flexible, so often misused with high complexity as a result (-) "MavenMagic"

How to avoid duplication between Maven projects and Maven modules

See Organizing Maven projects

How to use different web.xml files in different environments

See webxml in war-plugin BluePrints: maven profiles