Update Maven Settings
Elastic Path Commerce build processes use Maven and a Maven repository manager. Every environment where you perform a Maven build requires a suitably-configured Maven settings.xml
file. Pre-configuring the Maven settings.xml
files, and sharing them in the ep-commerce
Git repository, is an easy way to provide suitably-configured Maven settings.xml
files to the team. Team members can then obtain files that are pre-configured and ready to use.
The ep-commerce
Git repository contains two templates for Maven settings.xml
files. This topic guides you to choose which settings.xml
template to use and how to update the template to match your environment.
Prerequisites
Ensure that you have the following items:
- A hosted copy of the Elastic Path Commerce Source. See Hosting the Elastic Path Commerce Source Code.
- Your own Elastic Path Commerce Maven repository manager. See Setup Artifact Repository Manager, and the URLs to the repository manager
- Optional: Username and password credentials for a user on your Maven repository manager that has the authority to deploy artifacts. This is only required if you will deploy artifacts to your repository manager.
- A development branch created in your own Git repository.
extensions/maven/settings.xml
File
The This template file includes configurations for specifying your repository manager as a Maven mirror.
tip
The extensions/maven/settings.xml
file is suitable for build processes that pull artifacts from your Maven repository manager but do not deploy (push) artifacts to the repository. Example include the following:
- Local developer workstations for developers who perform local builds.
- Continuous integration environments if you are not using strategies to reuse artifacts stored in your repository manager.
In the development branch, update the extensions/maven/settings.xml
file to reflect your project environment. When team members create their own branch from the development branch, they will have the necessary Maven configurations.
Check out the development branch that you created for your organization or team.
Open the
extensions/maven/settings.xml
file.Replace
PROJECT_REPOSITORY_GROUP_URL
with the Nexus URL for your<project> EP Repository Group
.<mirrors> <mirror> <!-- You will need to change the URL here to your corporate Maven repository which mirrors the internet. --> <id>internet-mirror</id> <url>PROJECT_REPOSITORY_GROUP_URL</url> <mirrorOf>external:*</mirrorOf> </mirror> </mirrors>
Optional: Review the file and make any other required changes required for your project or environment.
Commit the changes and push them to your
ep-commerce
Git repository.
devops/maven/ci-settings.xml
File
The This template file includes configurations that support deploying (pushing) Maven artifacts to the repository manager. Build processes that leverage ep-commerce
release and snapshot artifact versioning, and deploy (or push) those artifacts to your repository manager, should use the template devops/maven/ci-settings.xml
. Versioning strategies are discussed in Branch and Version Number Convention.
tip
The devops/maven/ci-settings.xml
file is suitable if you have strategies to store and reuse artifacts in your repository manager.
note
The devops/maven/ci-settings.xml
file includes the properties ep.releases.repository.url
and ep.snapshots.repository.url
that are consumed by the <distributionManagement>
stanza in the top-level pom.xml of the ep-commerce
source tree. Maven uses these together to know where to deploy artifacts.
Checkout the development branch that you created for your organization or team.
Open the
devops/maven/ci-settings.xml
file.Replace the following tokens.
PROJECT_REPOSITORY_GROUP_URL
: The URL of the project repository group used as the project mirrorPROJECT_RELEASE_REPOSITORY_URL
: The URL of the project Elastic Path Releases RepositoryPROJECT_SNAPSHOT_REPOSITORY_URL
: The URL of the project Elastic Path Snapshots RepositoryMAVEN_DEPLOYER_USER_NAME
: The username for the deployment Maven repository accountMAVEN_DEPLOYER_PASSWORD
: The password for the deployment Maven repository account
For using encrypted passwords in your
ci-settings.xml
, see the Encrypting passwords in settings.xml section in Maven Mini Guides.Optional: Review the file and make any other required changes required for your project or environment.
Commit the changes and push them to your
ep-commerce
Git repository.