当前位置: 首页 > news >正文

Linux中安装Nexus+Maven

下载并安装nexus-2.14.8-01-bundle.tar.gz

https://www.sonatype.com/download-sonatype-trial?submissionGuid=c6b88dc4-bda4-41c8-a41a-19e66ecd35d3

上传到192.168.0.239的Linux虚拟机目录/usr/local中



解压

tar -zxvf nexus-2.14.8-01-bundle.tar.gz -C /usr/local/

mv nexus-2.14.8-01 nexus

查看nexus.properties,使用jetty作为容器

vi /usr/local/nexus/conf/nexus.properties

编辑nexus对应脚本,修改RUN_AS_USER

vi /usr/local/nexus/bin/nexus




启动Nexus

sh  /usr/local/nexus/bin/nexus  start


查看Nexus服务页面

在本地Windows机器浏览器中访问http://192.168.0.239:8081/nexus




Nexus设置为开机启动

vi /etc/rc.d/rc.local

添加 /usr/local/nexus/bin/nexus  start


修改wrapper.conf

vi /usr/local/nexus/bin/jsw/conf/wrapper.conf

wrapper.java.command=/usr/local/localsoftware/jdk1.8.0_121/bin/java


重启Linux系统,启动后在本地Windows机器上访问http://192.168.0.239:8081/nexus ,使用admin/admin123登录




Maven下载与安装



下载apache-maven-3.5.3-bin.tar.gz,上传至192.168.0.239Linux虚拟机的/usr/local目录

解压

tar -zxvf apache-maven-3.5.3-bin.tar.gz -C /usr/local/


配置maven环境变量

vi /etc/profile

添加MAVEN_HOME

export MAVEN_HOME=/usr/local/apache-maven-3.5.3

修改PATH 

export PATH=$JAVA_HOME/bin:$MAVEN_HOME/bin:$ZOOKEEPER_HOME/bin:$STORM_HOME/bin:$PATH

设置环境变量生效

source /etc/profile


配置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">  
    
    <pluginGroups></pluginGroups>  
    <proxies></proxies>  
    <!--本地仓库的位置 -->
    <localRepository>/usr/local/local_repository</localRepository>
    
    <!--私服的验证信息 -->
    <servers>  
       <server>  
       <id>nexus-releases</id>  
       <username>admin</username>  
       <password>admin123</password>  
     </server>  
     <server>  
       <id>nexus-snapshots</id>  
       <username>admin</username>  
       <password>admin123</password>  
     </server>  
   </servers>  
   
   <!--maven对全部仓库的访问拦截到私服,若私服关闭,则不会去中央仓库下载jar包 -->
   <mirrors>   
     <mirror>   
       <id>nexus-releases</id>   
       <mirrorOf>*</mirrorOf>   
       <url>http://192.168.0.239:8081/nexus/content/groups/public</url>   
     </mirror>  
     <mirror>   
       <id>nexus-snapshots</id>   
       <mirrorOf>*</mirrorOf>   
       <url>http://192.168.0.239:8081/nexus/content/groups/public-snapshots</url>   
     </mirror>   
   </mirrors>   
    
   <!--配置仓库的一些信息,用于覆盖maven中央仓库的一些配置 --> 
   <profiles>  
    <profile>  
       <id>nexus</id>  
       <repositories>  
         <repository>  
           <id>nexus-releases</id>  
           <url>http://192.168.0.239:8081/nexus/content/groups/public</url>  
           <releases><enabled>true</enabled></releases>  
           <snapshots><enabled>true</enabled></snapshots>  
         </repository>  
         <repository>  
           <id>nexus-snapshots</id>  
           <url>http://192.168.0.239:8081/nexus/content/groups/public-snapshots</url>  
           <releases><enabled>true</enabled></releases>  
           <snapshots><enabled>true</enabled></snapshots>  
         </repository>  
       </repositories>  
       <pluginRepositories>  
          <pluginRepository>  
                 <id>nexus-releases</id>  
                  <url>http://nexus-releases</url>  
                  <releases><enabled>true</enabled></releases>  
                  <snapshots><enabled>true</enabled></snapshots>  
                </pluginRepository>  
               <pluginRepository>  
                  <id>nexus-snapshots</id>  
                   <url>http://nexus-snapshots</url>  
                 <releases><enabled>true</enabled></releases>  
                  <snapshots><enabled>true</enabled></snapshots>  
              </pluginRepository>  
          </pluginRepositories>  
     </profile>  
   </profiles>

   <!--激活上面配置的仓库信息 -->     
   <activeProfiles>  
       <activeProfile>nexus</activeProfile>  
   </activeProfiles>      
 </settings>  

新建本地仓库的目录

mkdir /usr/local/local_repository



Maven项目配置私服+发布到私服

<!-- 配置私服工厂 -->   
<repositories>
	<repository>
		<id>nexus</id>
		<url>http://192.168.0.239:8081/nexus/content/groups/public/</url>
		<releases>
			<enabled>true</enabled>
		</releases>
		<snapshots>
			<enabled>true</enabled>
		</snapshots>
	</repository>
</repositories>      
<pluginRepositories>
	<pluginRepository>
		<id>nexus</id>
		<url>http://192.168.0.239:8081/nexus/content/groups/public/</url>
		<releases>
			<enabled>true</enabled>
		</releases>
		<snapshots>
			<enabled>true</enabled>
		</snapshots>
	</pluginRepository>
</pluginRepositories>

<!-- 配置发布到私服 -->
<distributionManagement>  
        <!-- 两个ID必须与 setting.xml中的<server><id>nexus-releases</id></server>保持一致-->  
        <repository>  
            <id>nexus-releases</id>  
            <name>Nexus Release Repository</name>  
            <url>http://192.168.0.239:8081/nexus/content/repositories/releases</url>  
        </repository>  
        <snapshotRepository>  
            <id>nexus-snapshots</id>  
            <name>Nexus Snapshot Repository</name>  
            <url>http://192.168.0.239:8081/nexus/content/repositories/snapshots</url>  
        </snapshotRepository>  
</distributionManagement>
  




相关文章:

  • Oracle数据库创建实例
  • Nginx中log_format日志格式参数及说明
  • Eclispe SVN 创建分支
  • Eclipse SVN 分支合并+代码冲突处理
  • Java中异常处理机制
  • Linux操作命令总结(六)
  • MySQL中的表连接(外连接、内连接、交叉连接、自连接)
  • location.href的用法
  • MySQL中不相关子查询和相关子查询
  • Linux-eth0 eth0:1 和eth0.1关系、ifconfig以及虚拟IP实现介绍
  • Windows中查看8080端口的占用情况并关闭相关进程
  • Java中使用HttpClient封装post请求和get请求工具方法
  • Tomcat的JVM参数配置
  • java.lang.OutOfMemoryError及解决方案
  • Eclipse中新建maven项目注意事项
  • HTTP那些事
  • Linux下的乱码问题
  • Sass Day-01
  • Shell编程
  • Spring声明式事务管理之一:五大属性分析
  • Swoft 源码剖析 - 代码自动更新机制
  • 第三十一到第三十三天:我是精明的小卖家(一)
  • 免费小说阅读小程序
  • 深入 Nginx 之配置篇
  • 使用 5W1H 写出高可读的 Git Commit Message
  • 转载:[译] 内容加速黑科技趣谈
  • python最赚钱的4个方向,你最心动的是哪个?
  • ​Java并发新构件之Exchanger
  • ​ubuntu下安装kvm虚拟机
  • ​创新驱动,边缘计算领袖:亚马逊云科技海外服务器服务再进化
  • ​低代码平台的核心价值与优势
  • ​中南建设2022年半年报“韧”字当头,经营性现金流持续为正​
  • # 再次尝试 连接失败_无线WiFi无法连接到网络怎么办【解决方法】
  • ###51单片机学习(2)-----如何通过C语言运用延时函数设计LED流水灯
  • #laravel 通过手动安装依赖PHPExcel#
  • #数学建模# 线性规划问题的Matlab求解
  • (ISPRS,2023)深度语义-视觉对齐用于zero-shot遥感图像场景分类
  • (二)Pytorch快速搭建神经网络模型实现气温预测回归(代码+详细注解)
  • (附源码)计算机毕业设计SSM教师教学质量评价系统
  • (三) prometheus + grafana + alertmanager 配置Redis监控
  • (一)C语言之入门:使用Visual Studio Community 2022运行hello world
  • (转) 深度模型优化性能 调参
  • (转)Scala的“=”符号简介
  • (转)可以带来幸福的一本书
  • .gitignore文件设置了忽略但不生效
  • .Net 8.0 新的变化
  • .Net CoreRabbitMQ消息存储可靠机制
  • .net 按比例显示图片的缩略图
  • .NET/C# 利用 Walterlv.WeakEvents 高性能地中转一个自定义的弱事件(可让任意 CLR 事件成为弱事件)
  • .NET开源的一个小而快并且功能强大的 Windows 动态桌面软件 - DreamScene2
  • @select 怎么写存储过程_你知道select语句和update语句分别是怎么执行的吗?
  • [C++] new和delete
  • [HEOI2013]ALO
  • [IOI2018] werewolf 狼人
  • [Linux] CE知识随笔含Ansible、防火墙、VIM、其他服务