首页 > 代码库 > Maven下载私服上的jar包

Maven下载私服上的jar包

1、配置M2_HOME/conf/settions.xml

<server>    <id>maven-public</id>    <username>admin</username>    <password>admin123</password></server>
<mirror>    <id>maven-public</id>    <mirrorOf>maven-public</mirrorOf>    <name>maven-public</name>    <url>http://127.0.0.1:8081/repository/maven-public/</url></mirror>

2、配置需要下载jar包的项目的pom.xml

<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/xsd/maven-4.0.0.xsd">    <modelVersion>4.0.0</modelVersion>    <groupId>com.126.at.boazy</groupId>    <artifactId>boazy-test-download</artifactId>    <version>0.0.1-SNAPSHOT</version>    <dependencies>        <dependency>            <groupId>com.126.at.boazy</groupId>            <artifactId>boazy-test-upload</artifactId>            <version>0.0.1-SNAPSHOT</version>        </dependency>    </dependencies>    <repositories>        <repository>            <id>maven-public</id>            <name>maven-public</name>            <url>http://127.0.0.1:8081/repository/maven-public/</url>            <snapshots>                <enabled>true</enabled>            </snapshots>            <releases>                <enabled>true</enabled>            </releases>        </repository>    </repositories></project>

 技术分享

Maven下载私服上的jar包