powder366
powder366

Reputation: 4421

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

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?

Upvotes: 18

Views: 26026

Answers (1)

Mureinik
Mureinik

Reputation: 310993

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

Upvotes: 26

Related Questions