Linux下搭建Nexus3私服仓库

ubuntu安装nexus-3.0.2-02
下载地址https://www.sonatype.com/download-oss-sonatype
参考资料http://www.cnblogs.com/qq27271609/p/5497815.html

安装

解压安装包

tar -xvf nexus-3.0.2-02-unix.tar.gz

root账户启动nexus需要设置环境变量RUN_AS_USER=root

export RUN_AS_USER=root

启动nexus

./bin/nexus start

浏览器输入http://ip:8081

用admin/admin123登录,开启部署策略

settings.xml

<?xml version="1.0" encoding="UTF-8"?>
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" 
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
          xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
  <localRepository>C:\Users\Kosh\.m2\repository</localRepository>
    <servers>
        <server>
          <id>nexus</id>
          <username>admin</username>
          <password>admin123</password>
        </server>
    </servers>

    <mirrors>
        <mirror>
          <id>nexus</id>
          <url>http://139.196.8.178:8081/repository/maven-public/</url>
          <mirrorOf>central</mirrorOf>
        </mirror>
    </mirrors>
</settings>

pom.xml

<distributionManagement>
    <repository>
        <id>nexus</id>
        <name>Nexus Release</name>
        <url>http://139.196.8.178:8081/repository/maven-releases/</url>
    </repository>
    <snapshotRepository>
        <id>nexus</id>
        <name>Nexus Snapshot</name>
        <url>http://139.196.8.178:8081/repository/maven-snapshots/</url>
    </snapshotRepository>
</distributionManagement>

发布第三方包

输入如下命令:

mvn deploy:deploy-file -DgroupId=log4j -DartifactId=log4j -Dversion=1.2.17 -Dpackaging=jar -DrepositoryId=3rdparty -Dfile=E:\IDEA\log4j-1.2.17.jar -Durl=http://localhost:8081/repository/3rdparty/ -DgeneratePom=false

其中groupId artifactId version 根据实际情况填写 repositoryId跟settings.xml中的保持一致
url在repository的设置当中可以看到

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • Spring Cloud为开发人员提供了快速构建分布式系统中一些常见模式的工具(例如配置管理,服务发现,断路器,智...
    卡卡罗2017阅读 134,981评论 19 139
  • 搭建 nexus 私服(centos6.7) 备注:Centos 6.7 、 nexus-2.12.1-01-bu...
    逐暗者阅读 2,526评论 3 9
  • 首先私服是一种衍生出来的特殊的Maven远程仓库,构建私服的好处请看3.5私服 可以帮助大家建立私服的仓库管理软件...
    zlcook阅读 10,654评论 0 32
  • 你好啊,我是十年前的自己。按自己的规划,我2017年嫁出去,18或19 要孩子。对哦,老公是什么样子的?是你理想中...
    凌夜阅读 386评论 1 3
  • 在大雨的世界里 穿过一片拥有稠密树木的路 雨声簌簌落落 雨花自由绽放 如一朵朵坠落的烟火 被雨水包裹的世界 陷入宁...
    闲落花阅读 225评论 0 4