搭建Maven私有仓库

Nexus官网下载:Nexus Repository Manager OSS :https://www.sonatype.com/download-oss-sonatype

1.解压

$ tar -zxvf nexus-3.14.0-04-unix.tar.gz

2.启动

$ nexus-3.14.0-04/bin/nexus start

3.访问

4.登陆

账号密码:admin   admin123

5.创建仓库

6.上传jar包

7.pom文件配置下载

<dependencies>
    <dependency>
            <groupId>com.hy</groupId>
            <artifactId>api-client</artifactId>
            <version>1.0.4</version>
    </dependency>
</dependencies>
<repositories>
    <!-- 配置nexus远程仓库 -->
    <repository>
            <id>nexus</id>
            <name>Nexus Snapshot Repository</name>
            <url>http://192.168.1.19:8081/repository/maven-public/</url>
            <releases>
                <enabled>true</enabled>
            </releases>
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
   </repository>
</repositories>
    <!-- 配置从哪个仓库中下载构件,即jar包 -->
<pluginRepositories>
   <pluginRepository>
            <id>nexus</id>
            <name>Nexus Snapshot Repository</name>
            <url>http://192.168.1.19:8081/repository/maven-public/</url>
            <releases>
                <enabled>true</enabled>
            </releases>
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
    </pluginRepository>
</pluginRepositories>

 

posted @ 2019-01-10 14:01  键盘侠S  阅读(219)  评论(0编辑  收藏  举报