Maven - yibinericxia/documents GitHub Wiki
Maven Project
Apache Maven automates project setup and build process, such as setting up dependency management, downloading dependencies, compiling source code, running tests, packaging code into jar/war/zip files, and uploading to the central repository system or deploying to a server.
pom.xml (project object model)
The project-specific configuration other than sensitive data should be kept in the pom.xml as a part of source code repository. This file could contains the following elements with the project:
- modelVersion
- parent
- groupId
- artifactId
- packaging
- version
- modules
- url
- name
- description
- properties
- repositories
- dependencies
- dependencyManagement
- profiles
- build
settings.xml
The global or user configuration and credentials should be kept in the settings.xml under "${maven.home}/conf/" or "${user.home}/.m2/". This file could contains the following elements within the settings:
- localRepository: location for all the project dependencies cached, normally ${user.home}/.m2/repository
- interactiveMode: a boolean value to allow user to interact or not
- offline: a boolean value for app to operate in offline mode or not
- pluginGroups: group a list of elements with a groupId. The default contains org.apache.maven.plugins & org.codehaus.mojo.
- servers: server credentials for the repository
- mirrors: define an alternative mirror for a particular repository
- proxies: configure a proxy for HTTP requests with only one proxy can be active at a time
- profiles: truncated version of the same element in pom.xml with 4 child elements: activation, repositories, pluginRepositories and properties
- activeProfiles: profiles referred will be activated automatically
The server id in settings.xml should match the id of the repository in the pom.xml. The active profile in settings.xml overrides any equivalent profile values (with the same id) in a pom.xml or profiles.xml