Element | Description |
---|---|
localRepository | Specifies the path where Maven stores downloaded artifacts (dependencies, plugins, etc.). Default: ${user.home}/.m2/repository Example: <localRepository>/path/to/local/repo</localRepository> |
interactiveMode | Controls whether Maven prompts for user input when needed Default: true Set to false for automated builds or CI/CD environments. |
offline | When true, Maven operates in offline mode and won't attempt network connections to download artifacts. Default: false Useful when working without internet connectivity. |
pluginGroups | Additional group IDs to search when resolving plugins by their prefix. Example: Adding org.springframework.boot allows using mvn spring-boot:run |
proxies | Configuration for HTTP/HTTPS proxies when Maven needs to connect through corporate firewalls. Include host, port, username, password, and nonProxyHosts settings. |
servers | Authentication credentials for accessing remote repositories and deployment targets. Contains server-id, username, password, and other authentication details. Use password encryption or environment variables for sensitive data. |
mirrors | Repository mirrors that redirect artifact requests to alternative locations. Commonly used for corporate repositories or faster regional mirrors. Can mirror specific repositories or use * for all repositories. |
profiles | Named sets of configuration that can be activated conditionally. Can contain repositories, plugin repositories, properties, and plugin configuration. Activated by conditions like JDK version, OS, system properties, or explicitly by name. |
activeProfiles | List of profile IDs that are automatically active for all builds. Profiles listed here don't require explicit activation. Use sparingly as they apply globally. |
Activation Type | Description |
---|---|
By Default | Activated automatically unless deactivated. <activeByDefault>true</activeByDefault> |
By JDK Version | Activate based on Java version. <jdk>23</jdk> <jdk>[1.8,)</jdk> |
By OS | Activate based on operating system. <os><family>windows</family></os> |
By Property | Activate when system property exists. <property><name>env</name><value>dev</value></property> |
mvn clean install -P dev