centos搭建Nexus私服以及jar包上传

安装相关

1.我下载的版本nexus-3.7.0-04-unix.tar.gz

2.tar -zxvf 解压

3.进入bin目录

4../nexus run & 启动

5.设置开启启动

ln -s /jianbing/install/nexus/nexus-3.7.0-04/bin/nexus /etc/init.d/nexus3

chkconfig --add nexus3

chkconfig nexus3 on

6.修改启动用户为root

vim nexus.rc

7.修改nexus3启动时要使用的jdk版本

vim nexus 14行

设置成自己的javahome路径

8.修改nexus3默认端口

cd..../etc/

vim nexus-default.properties

9.修改nexus3数据以及相关日志的存储位置

cd /bin/

vim nexus.vmoptions

使用相关

setting.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">
    <pluginGroups />
    <proxies />
    <servers>
      <server>
        <id>nexus</id>
        <username>admin</username>
        <password>admin123</password>
      </server>
    </servers>
    
    <localRepository>E:\newMaven\apache-maven-3.1.1\repo2</localRepository>
    
    <mirrors>
	    <mirror>
            <id>nexus</id>
            <mirrorOf>*</mirrorOf>
            <url>http://101.37.116.225:8081/repository/maven-public/</url>
        </mirror>
    </mirrors>
    
    <profiles>
        <profile>
            <id>nexus</id>
            <repositories>
            <repository>
            <id>central</id>
            <url>http://central</url>
            <releases><enabled>true</enabled></releases>
            <snapshots><enabled>true</enabled></snapshots>
        </repository>
      </repositories>
     <pluginRepositories>
        <pluginRepository>
            <id>central</id>
            <url>http://central</url>
            <releases><enabled>true</enabled></releases>
            <snapshots><enabled>true</enabled></snapshots>
        </pluginRepository>
      </pluginRepositories>
    </profile>
  </profiles>
  <activeProfiles>
        <activeProfile>nexus</activeProfile>
  </activeProfiles>

</settings> 复制代码
发布项目到nexus仓库配置POM文件

<distributionManagement>
        <repository>
            <id>nexus</id>
            <name>Releases</name>
            <url>http://{your-nexus-ip}/repository/maven-releases</url>
        </repository>
        <snapshotRepository>
            <id>nexus</id>
            <name>Snapshot</name>
            <url>http://{your-nexus-ip}/repository/maven-snapshots</url>
        </snapshotRepository>
    </distributionManagement>​复制代码

使用命令发布项目:mvn clean deploy

手动上传jar

·没有pom文件的

mvn deploy:deploy-file -DgroupId=<group-id>
 -DartifactId=<artifact-id>
 -Dversion=<version>
 -Dpackaging=<type-of-packaging>
 -Dfile=<path-to-file>
 -DrepositoryId=<id-to-map-on-server-section-of-settings.xml>
 -Durl=<url-of-the-repository-to-deploy>复制代码

·带有pom文件的

mvn deploy:deploy-file -DpomFile=<path-to-pom>
 -Dfile=<path-to-file>
 -DrepositoryId=<id-to-map-on-server-section-of-settings.xml>
 -Durl=<url-of-the-repository-to-deploy>复制代码


转载于:https://juejin.im/post/5a7fecf6f265da4e914b59cd

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值