CentOS 6.5搭建Nexus Maven私服

1 篇文章 0 订阅

**

一、Nexus下载

**
下载地址:http://www.sonatype.org/nexus/go
我用的这个版本:nexus-2.14.3-02-bundle.tar.gz
**

二、Nexus解压与启动

**

1、解压 nexus-2.14.3-02-bundle.tar.gz

tar xvf nexus-2.14.3-02-bundle.tar.gz

2、解压完后生成2个目录:nexus-2.14.3-02和sonatype-work,前者包含了nexus的运行环境和应用程序,后者包含了你自己的配置和数据;

3、启动nexus(nexus依赖jdk)

cd nexus-2.14.3-02/bin/
./nexus start/stop/restart

**注意:nexus root启动异常:WARNING - NOT RECOMMENDED TO RUN AS ROOT
解决方案
修改%nexus_home%/bin/下的nexus
找到#RUN_AS_USER=改为RUN_AS_USER=root**
4. 访问网址:http://192.168.4.241:8081/nexus/ 看到Nexus欢迎页证明Nexus启动成功;
5. 右上角以admin登录,默认用户名/密码:admin/admin123。

**

三、Maven与Nexus私服配置

**

1、替换Maven默认配置文件(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">
    <servers>
        <server>
            <!-- id must be the same with pom.xml -->
            <id>release</id>
            <username>admin</username>
            <password>******</password>
        </server>

        <server>
            <!-- id must be the same with snapshotRepository section in pom.xml -->
            <id>snapshot</id>
            <!-- The username and password of the nexus server -->
            <username>admin</username>
            <password>******</password>
        </server>
    </servers>

    <mirrors>
        <mirror>
            <id>nexus</id>
            <mirrorOf>*</mirrorOf>
            <url>http://192.168.4.241:8081/nexus/content/groups/public/</url>
        </mirror>
    </mirrors>

</settings>

2、本地上传依赖到Nexus服务器的两种方式: 通过网页上传和通过maven的方式depoly,在项目的pom.xml 加入如下配置:

<!-- For deploy your own maven jars -->
  <distributionManagement>
    <!-- Nexus Release Deploy Repository -->
    <repository>
      <id>release</id>
      <name>Nexus release repository</name>
      <url>http://192.168.4.241:8081/nexus/content/repositories/releases</url>
    </repository>
    <!-- snapshot repository -->
    <snapshotRepository>
      <id>snapshot</id>
      <name>Nexus Snapshot Deploy Repository</name>
      <url>http://192.168.4.241:8081/nexus/content/repositories/snapshots</url>
    </snapshotRepository>
  </distributionManagement>

注意:此处id应与settings.xml里面的id一致


到此配置完成,可以在本地引入依赖,看私服是否生成相应jar包

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值