nginx 搭建maven 私有仓库

本文介绍了如何利用nginx搭建Maven私有仓库。通过安装nginx,配置为静态资源服务器,然后修改maven的settings.xml及工程pom.xml,实现向服务器发布和下载jar包。遇到IDE不自动拉取远程仓库时,可以通过执行mvn install或mvn package来解决。
摘要由CSDN通过智能技术生成

搭建maven仓库有多种方法,实际上只需要有一个可以访问的http服务就可以搭建一个maven仓库。在这里介绍通过nginx作为web容器的搭建方法。

1.安装nginx  nginx 的安装

2.配置nginx 静态资源服务器  nginx静态资源服务器配置

我的配置如下

server {
        listen       80;
        server_name  localhost;

        #charset koi8-r;

        #access_log  logs/host.access.log  main;

        location / {
            root   html;
            index  index.html index.htm;
        }
        location /remoteRepo/{
            root   /usr/local/;
            autoindex on;
    }

    新建目录 /usr/local/remoteRepo
    注意目录的权限否者可能不能上传(使用chown 和 chmod)

访问截图

3.maven 向服务器发布jar包

      3.1修改maven settings,xml  添加server

      

<servers>
    <!-- server
     | Specifies the authentication information to use when connecting to a particular server, identified by
     | a unique name within the system (referred to by the 'id' attribute below).
     |
     | NOTE: You should either specify username/password OR privateKey/passphrase, since these pairings are
     |       used together.
     |
    <server>
      <id>deploymentRepo</id>
      <username>repouser</username>
      <password>repopwd</password>
    </server>
    -->

    <!-- Another sample, using keys to authenticate.
    <server>
      <id>siteServer</id>
      <privateKey>/path/to/private/key</privateKey>
      &l
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值