> 文档中心 > maven 国内源配置

maven 国内源配置


目的

记录Maven国内镜像

国内镜像

阿里

        <mirror>      <id>nexus-aliyun</id>      <name>Nexus aliyun</name>      <url>http://maven.aliyun.com/nexus/content/groups/public/</url>      <mirrorOf>central</mirrorOf>    </mirror>

ibiblio镜像

        <mirror>      <id>ibiblio</id>      <name>Mirror from Maven ibiblio</name>      <url>http://mirrors.ibiblio.org/pub/mirrors/maven2/</url>      <mirrorOf>central</mirrorOf>    </mirror>

开源中国

        <mirror>    <id>CN</id> <name>OSChina Central</name>    <url>http://maven.oschina.net/content/groups/public/</url>    <mirrorOf>central</mirrorOf>    </mirror>

示例

<settings xmlns="http://maven.apache.org/SETTINGS/1.2.0"   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"   xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.2.0 http://maven.apache.org/xsd/settings-1.2.0.xsd">  <!-- localRepository   | The path to the local repository maven will use to store artifacts.   |   | Default: ${user.home}/.m2/repository  /path/to/local/repo  -->  <!-- interactiveMode   | This will determine whether maven prompts you when it needs input. If set to false,   | maven will use a sensible default value, perhaps based on some other setting, for   | the parameter in question.   |   | Default: true  true  -->  <!-- offline   | Determines whether maven should attempt to connect to the network when executing a build.   | This will have an effect on artifact downloads, artifact deployment, and others.   |   | Default: false  false  -->    <pluginGroups>    <!-- pluginGroup     | Specifies a further group identifier to use for plugin lookup.    com.your.plugins    -->  </pluginGroups>    <proxies>    <!-- proxy     | Specification for one proxy, to be used in connecting to the network.     |          optional      true      http      proxyuser      proxypass      proxy.host.net      80      local.net|some.host.com        -->  </proxies>    <servers>    <!-- server     | Specifies the authentication information to use when connecting to a particular server, identified by     | a unique name within the system (referred to by the 'id' attribute below).     |     | NOTE: You should either specify username/password OR privateKey/passphrase, since these pairings are     |used together.     |          deploymentRepo      repouser      repopwd        -->    <!-- Another sample, using keys to authenticate.          siteServer      /path/to/private/key      optional; leave empty if not used.        -->  </servers>    <mirrors>    <!-- mirror     | Specifies a repository mirror site to use instead of a given repository. The repository that     | this mirror serves has an ID that matches the mirrorOf element of this mirror. IDs are used     | for inheritance and direct lookup purposes, and must be unique across the set of mirrors.     |          mirrorId      repositoryId      Human Readable Name for this Mirror.      http://my.repository.com/repo/path         -->        <mirror>      <id>nexus-aliyun</id>      <name>Nexus aliyun</name>      <url>http://maven.aliyun.com/nexus/content/groups/public/</url>      <mirrorOf>central</mirrorOf>    </mirror>        <mirror>      <id>ibiblio</id>      <name>Mirror from Maven ibiblio</name>      <url>http://mirrors.ibiblio.org/pub/mirrors/maven2/</url>      <mirrorOf>central</mirrorOf>    </mirror>    <mirror>        <id>CN</id> <name>OSChina Central</name>    <url>http://maven.oschina.net/content/groups/public/</url>    <mirrorOf>central</mirrorOf>    </mirror>  </mirrors>    <profiles>    <!-- profile     | Specifies a set of introductions to the build process, to be activated using one or more of the     | mechanisms described above. For inheritance purposes, and to activate profiles via      | or the command line, profiles have to have an ID that is unique.     |     | An encouraged best practice for profile identification is to use a consistent naming convention     | for profiles, such as 'env-dev', 'env-test', 'env-production', 'user-jdcasey', 'user-brett', etc.     | This will make it more intuitive to understand what the set of introduced profiles is attempting     | to accomplish, particularly when you only have a list of profile id's for debug.     |     | This profile example uses the JDK version to trigger activation, and provides a JDK-specific repo.          jdk-1.4       1.4                jdk14   Repository for JDK 1.4 builds   http://www.myhost.com/maven/jdk14   default   always               -->    <!--     | Here is another profile, activated by the system property 'target-env' with a value of 'dev',     | which provides a specific path to the Tomcat instance. To use this, your plugin configuration     | might hypothetically look like:     |     | ...     |      |   org.myco.myplugins     |   myplugin     |     |        |     ${tomcatPath}     |        |      | ...     |     | NOTE: If you just wanted to inject this configuration whenever someone set 'target-env' to     |anything, you could just leave off the  inside the activation-property.     |          env-dev          target-env   dev              /path/to/tomcat/instance              -->  </profiles>  <!-- activeProfiles   | List of profiles that are active for all builds.   |      alwaysActiveProfile    anotherAlwaysActiveProfile    --></settings>