Configure Maven Settings.xml
The Self-Managed Commerce Maven build scripts require a properly configured Maven settings.xml file. This file is required so the build process can obtain required Self-Managed Commerce artifacts and, optionally, deploy newly-built artifacts to your own Maven repository manager.
There are several options for configuring the Maven settings.xml for the build environment.
- If your team has an existing suitably-configured
settings.xmlfile then you can use that. Copy it to~/.m2/settings.xmlin the build environment. - You can manually configure a
settings.xmlfile. Self-Managed Commerce includes several Mavensettings.xmlfile templates that serve different use cases. For information about some of the included options to configure Maven, see Update Maven Settings. - You can use the included Ansible playbook to automatically create a
settings.xmlfile. More information about this option is below.
Playbook to Create Maven settings.xml
The configure_maven_settings.yml playbook can be used to automatically create a Maven ~/.m2/settings.xml file. The resulting settings.xml file is based on the extensions/maven/individual-settings.xml file. That configuration is only suitable for test builds in environments that do not yet have a Maven repository manager such as Sonatype Nexus.
note
The Maven configuration currently created by the playbook does not support using your repository manager to proxy artifacts. As such, it is acceptable for test build environments but is not suitable for build environments regularly performing builds.
Prerequisites
Before you begin, ensure you meet all prerequisites.
Access to the Elastic Path Nexus Repositories
You will need the username and password credentials for accessing the Elastic Path Nexus repositories.
tip
If you have an existing CloudOps for Kubernetes environment then you can use the Sonatype Nexus server provided by that tooling.
Create the settings.xml File
The steps below demonstrate how to create a ~/.m2/settings.xml file using the configure_maven_settings.yml playbook.
- Establish a shell session on the build host.
- Clone the Self-Managed Commerce source code project
ep-commercefrom your organization Git repository. - Check out the
ep-commercebranch that you will be building. - Change directory to
devops/build_tools_extras. - Invoke the playbook to configure the local Maven repository.
ansible-playbook -e maven_deployer_user_name='<username>' -e maven_deployer_password='<password>' configure_maven_settings.yml
Replace
<username>and<password>with the appropriate values for accessing the Elastic Path Nexus repositories.