Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Override mvn settings.xml in your pom.xml. Define only project specific repos

Tags:

maven

I have the following in .m2, disabling the default remote repo:

<?xml version="1.0" encoding="UTF-8"?> 
<settings>
<mirrors>
  <mirror>
    <id>my.mirror</id>
    <name>My Mirror</name>
    <url>https://repo.maven.apache.org/alwaysfail</url>
    <mirrorOf>*</mirrorOf>
  </mirror>
</mirrors>

Now I added this in my project pom.xml

<repositories>
    <repository>
        <id>myproject.repo</id>
        <url>https://repo.maven.apache.org/maven2</url>
    </repository>
</repositories>

But it does not pick up my project specific remote repo and start downloading, what am I doing wrong?

like image 761
powder366 Avatar asked Feb 25 '17 11:02

powder366


People also ask

Does POM xml override settings xml?

It's important to note that values from an active profile in settings. xml will override any equivalent profile values in a pom. xml or profiles.

What is difference between POM xml and settings xml?

settings. xml contains system and/or user configuration, while the pom. xml contains project information. All build configuration ends up in the pom.


1 Answers

setting.xml allows you to override definitions in pom.xml, not the other way round. If you want to not use the overriding in settings.xml in a particular build, you could prepare another settings file and call it explicitly:

$ mvn install -s /path/to/no-repo-override.xml
like image 137
Mureinik Avatar answered Oct 05 '22 03:10

Mureinik