Maven - Is it possible to specify mirror in pom.xml?
That wouldn't make sense. POM files are not just to build projects, they are also uploaded to shared repositories. Now imagine that your POM ends up on Maven Central. What should happen when I add your project as dependency to one of my projects?
A better solution is to use a Maven proxy server.
Mirror can't be in the pom.xml. but it can be put add to your project's files.
When using maven 3.3.1+, you can use the core extension project-settings-extension to load the project settings, and put project specific mirrors into ${basedir}/.mvn/settings.xml
in your project.
in ${basedir}/.mvn/extensions.xml
<extensions xmlns="http://maven.apache.org/EXTENSIONS/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/EXTENSIONS/1.0.0 http://maven.apache.org/xsd/core-extensions-1.0.0.xsd">
<extension>
<groupId>com.github.gzm55.maven</groupId>
<artifactId>project-settings-extension</artifactId>
<version>0.1.1</version>
</extension>
</extensions>
in ${basedir}/.mvn/settings.xml
<settings>
<mirrors>
<mirror>
<id>id</id>
<url>https://url-for-this-project/</url>
<mirrorOf>central</mirrorOf>
</mirror>
</mirrors>
</settings>
In the pom it's not possible to define mirror entries furthermore it would be bad practice if definition of mirrors were possible (which is not the case). Similar for repositories definition in pom's (which are possible, but considered bad practice).
Best solution for such kind of thing is to install a repository manager which acts like a "own central repository."