Configuring the Maven maven Ali Ali cloud mirror mirror warehouse configuration

Maven repository configuration of Ali cloud images

 

Method 1: Global

Ali may be added to the cloud image in maven setting.xml configuration, every time so that no pom added mirrored configuration repository, add a child node below the node mirrors:

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

Note: <mirrorOf> can be set to do what central warehouse mirror to mirror, writing <mirrorOf> central </ mirrorOf> Central warehouse called "central" is; do mirror writing <mirrorOf> for all central warehouse * </ mirrorOf>. The default Maven central repository id is central. id is unique.
Important: Unless you are sure, it is not advisable to use <mirrorOf> * </ mirrorOf> way.

setting.xml profile location

Adding mirrored configuration 

Second way: single project configuration

Single project configuration, you need to modify pom file. pom file, there is no mirror elements. In the pom file by overwriting the default configuration of the central warehouse, central warehouse achieve change of address. 
Modify the project's pom file:

Copy the code
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>com.test</groupId>
    <artifactId>conifg</artifactId>
    <packaging>war</packaging>
    <version>0.0.1-SNAPSHOT</version>

    <repositories>
        <repository>
            <id>central</id>
            <name>aliyun maven</name>
            <url>http://maven.aliyun.com/nexus/content/groups/public/</url>
            <layout>default</layout>
            <! - whether to open the release member Download ->
            <releases>
                <enabled>true</enabled>
            </releases>
            <! - whether to turn snapshots member Download ->
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
        </repository>
    </repositories>

</project>

Method 1: Global

Ali may be added to the cloud image in maven setting.xml configuration, every time so that no pom added mirrored configuration repository, add a child node below the node mirrors:

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

Note: <mirrorOf> can be set to do what central warehouse mirror to mirror, writing <mirrorOf> central </ mirrorOf> Central warehouse called "central" is; do mirror writing <mirrorOf> for all central warehouse * </ mirrorOf>. The default Maven central repository id is central. id is unique.
Important: Unless you are sure, it is not advisable to use <mirrorOf> * </ mirrorOf> way.

setting.xml profile location

Adding mirrored configuration 

Second way: single project configuration

Single project configuration, you need to modify pom file. pom file, there is no mirror elements. In the pom file by overwriting the default configuration of the central warehouse, central warehouse achieve change of address. 
Modify the project's pom file:

Copy the code
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>com.test</groupId>
    <artifactId>conifg</artifactId>
    <packaging>war</packaging>
    <version>0.0.1-SNAPSHOT</version>

    <repositories>
        <repository>
            <id>central</id>
            <name>aliyun maven</name>
            <url>http://maven.aliyun.com/nexus/content/groups/public/</url>
            <layout>default</layout>
            <! - whether to open the release member Download ->
            <releases>
                <enabled>true</enabled>
            </releases>
            <! - whether to turn snapshots member Download ->
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
        </repository>
    </repositories>

</project>

Guess you like

Origin www.cnblogs.com/flyshaodq/p/11857887.html