Override mvn settings.xml in pom.xml. Identify only specific projects

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

<?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 to my pom.xml project

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

But he does not pick up my remote project specific repo and starts the download, what am I doing wrong?

+5
source share
1 answer

setting.xml allows you to override definitions in pom.xml , and not vice versa. If you do not want to use the override in settings.xml in a specific assembly, you can prepare another settings file and call it explicitly:

 $ mvn install -s /path/to/no-repo-override.xml 
+6
source

Source: https://habr.com/ru/post/1264709/


All Articles