Giriş
İki tane settings.xml olabilir. Açıklaması
şöyle
Maven always uses either one or two settings files. The global settings defined in (${M2_HOME}/conf/settings.xml) is always required. The user settings file (defined in ${user.home}/.m2/settings.xml) is optional. Any settings defined in the user settings take precedence over the corresponding global settings.
Benim Windows sistemimde MVN_HOME=C:\apache-maven-3.5.0 olarak tanımlı ve bu dizindeki global conf/settings.xml'i ellemiyorum.
"C:\Users\acelya\.m2\settings.xml" dosyasını düzenleyerek ayarları yapıyorum. Maven'de herşeyi
"C:\Users\acelya\.m2\repository" dizinine indiriyor.
Yapısı
Şöyledir
<?xml version="1.0" encoding="UTF-8"?>
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
http://maven.apache.org/xsd/settings-1.0.0.xsd">
<pluginGroups />
<proxies />
<servers>
<server>
...
</server>
<server>
...
</server>
</servers>
<mirrors />
<profiles>
<profile>
<repositories>
<repository>
...
</repository>
</repositories>
</profile>
</profiles>
<activeProfiles>
<activeProfile>companydev</activeProfile>
</activeProfiles>
</settings>
pluginGroups,proxies,servers,mirrors,profiles,activeProfiles taglerini içerir.
mirror tag
Maven pom'ları içinde - örneğin Spring kullanıyorsak - diğer repository'lere atıfta bulunulur. Eğer kapalı bir ortamda çalışıyorsak bu repository'lere erişim mümkün değildir. Bu repository'leri mirror'ladığımızı belirtmek için kullanılır. Şöyle yaparız
<mirror>
<id>mymirror</id>
<url>http://myserver:8080/...</url>
<mirrorOf>*,!myrepo1, !myrepo2</mirrorOf>
</mirror>
profile tag
profiles tag içindedir. İçinde repository ve properties barındırır.
Örnek
Şöyle
yaparız.
<profile>
<id>companydev</id>
<properties>
<unit-test-ldap-server-host>mis-dev</unit-test-ldap-server-host>
<unit-test-database-url>jdbc:mysql://mis-dev:1234/unit_test</unit-test-database-url>
</properties>
<repositories>
<repository>
...
</repository>
</repositories>
</profile>
proxies tag
Maven tarafından kullanılacak proxy sunucusu belirtilir.
Örnek
Şöyle
yaparız
<settings>
<proxies>
<proxy>
<id>example-proxy</id>
<active>true</active>
<protocol>http</protocol>
<host>proxy.example.com</host>
<port>8080</port>
<username>proxyuser</username>
<password>somepassword</password>
<nonProxyHosts>www.google.com|*.example.com</nonProxyHosts>
</proxy>
</proxies>
</settings>
repository tagrepositories tag yazısına taşıdım.
server tag