Issue
I’m trying to configure Maven to be used inside my company. However, i reach the phase in which I must configure the repositories to be used.
- The common configuration for all user is set in the setting.xml file under MAVEN_HOME
- A user’s configuration is set in the setting.xml file under USER_HOME.
- A project’s special configuration is set in the pom.xml
In my case, the second type of configuration should be used (A configuration for each user). However, a mismatch occurs while having a look at the Maven documentation. There is 2 cases either to use a <mirrors>
or <repositories>
under a default profile.
What is the recommended and in case the 2 are set what's the one it will be taken by Maven engine http://repository.poo/ or http://repository.foo/ ?
<mirrors>
<mirror>
<id> </id>
<mirrorOf>* </mirrorOf>
<name> </name>
<url>http://repository.foo </url>
</mirror>
</mirrors>
or
<profiles>
<profile>
<id> </id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<repositories>
<repository>
<id></id>
<name></name>
<url>http://repository.poo/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>
Solution
You will almost certainly need the <repositories>
if you have your own company repository and you want something other than the maven default.
You may need a mirror if you want to override something, for instance you may want to cache maven central artifacts in a local Nexus.
Take a look at https://maven.apache.org/guides/mini/guide-mirror-settings.html
If in doubt leave the mirror.
Answered By - Essex Boy
Answer Checked By - Mary Flores (JavaFixing Volunteer)