For development and deployment of applications we always use an artifactory in
real-time world to host artifacts needed for your build and also as a target to
deploy artifacts generated in the build process. For Maven, to communicate with
artifactory we need a settings.xml file which is usually located at
"/User/rake/.m2/settings.xml" this file consists of how to authenticate to the artifactory servers and authorizations to read/ write to different locations like release, snapshots e.t.c...
Settings.xml can be generated using the artifactory you're using which in my case is
JFrog, but here's a sample settings file for your reference incase you're feeling lazy☺
<?xml version="1.0" encoding="UTF-8"?> <settings xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.1.0 http://maven.apache.org/xsd/settings-1.1.0.xsd" xmlns="http://maven.apache.org/SETTINGS/1.1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <servers> <server> <id>central</id> <username></username> <password></password> </server> <server> <id>snapshots</id> <username></username> <password></password> </server> </servers> <mirrors> <mirror> <id>libs-release</id> <name>libs-release</name> <url>https://artifacts.rake.com/libs-release</url> <mirrorOf>*,!central,!snapshots</mirrorOf> </mirror> </mirrors> <profiles> <profile> <id>artifactory</id> <repositories> <repository> <id>central</id> <name>libs-release</name> <url>https://artifacts.rake.com/libs-release</url> <snapshots> <enabled>false</enabled> </snapshots> </repository> <repository> <id>snapshots</id> <name>libs-snapshot</name> <url>https://artifacts.rake.com/libs-snapshot</url> <snapshots /> </repository> </repositories> <pluginRepositories> <pluginRepository> <id>central</id> <name>plugins-release</name> <url>https://artifacts.rake.com/plugins-release</url> <snapshots> <enabled>false</enabled> </snapshots> </pluginRepository> <pluginRepository> <id>snapshots</id> <name>plugins-snapshot</name> <url>https://artifacts.rake.com/plugins-snapshot</url> <snapshots /> </pluginRepository> </pluginRepositories> </profile> </profiles> <activeProfiles> <activeProfile>artifactory</activeProfile> </activeProfiles> </settings>
Here's how to configure authentication on JFrog side.
Happy coding 👨💻
Comments
Post a Comment