Are these two parameters the same in maven?

I want to restrict maven to use only the private / not public maven repository, do these two parameters have the same effect?

1. Set the mirror in settings.xml

<mirrors>
        <mirror>
            <id>my-internal-site</id>
            <mirrorOf>*</mirrorOf>
            <name>our maven repository</name>
            <url>http://myserver/repository</url>
        </mirror>
    </mirrors>

2.Create a repository in pom.xml

<repositories>
    <repository>
      <id>my-internal-site</id>
      <name>our maven repository</name>
      <url>http://myserver/repo</url>
    </repository>
  </repositories>

Again, the requirement is that maven never goes to public repositories, even if some dependencies are not there in the internal repository. thank

+5
source share
2 answers

No, they do not have the same effect.

The second option is to add a new repository as an “addition” to the central one, but does not prevent Maven from checking the central one by itself.

Maven , all ( mirrorOf *). .

, , , , settings.xml.

~/.m2/settings.xml , , - "" Maven, , conf/settings.xml. , "" , .

+3

, :

, , .

. , , Maven .

, , mirror settings.xml.

Maven.

0

All Articles