安装&配置Nexus

解压后,应该获得如下目录结构:

  • nexus-2.0.6是nexus服务主目录
  • sonatype-work是真正的仓库,同时包含了nexus的配置,如定时任务、用户配置等

nexus支持如下命令:

引用
nexus { console | start | stop | restart | status | dump }

端口配置在nexus/conf/nexus.properties文件中,文件如下:

# Sonatype Nexus
# ==============
# This is the most basic configuration of Nexus. # Jetty section
application-port=8081
application-host=0.0.0.0
nexus-webapp=${bundleBasedir}/nexus
nexus-webapp-context-path=/nexus # Nexus section
nexus-work=${bundleBasedir}/../sonatype-work/nexus
runtime=${bundleBasedir}/nexus/WEB-INF
pr.encryptor.publicKeyPath=/apr/public-key.txt

  

 

如果你需要修改nexus服务端口或IP,上面这段修改就是了。

启动后,如下界面: 

默认管理员帐号: 
用户名:admin 
密码:admin123

通常可以在maven工具里找到的包,也可以在这里找到: 

定制任务 
当然,为了让你的nexus更加智能,需要做一些定时任务,譬如定期下载索引,加快本地mvn检索速度。 
以建立定期下载索引为例,在Administration选项中找到Scheduled Tasks,在窗口页面点击Add,进行配置: 

除此之外,我还经常要添加一些额外的jar到nexus中,譬如我要追加BC的组件包到nexus中,供团队其他开发成员使用。 
找到View/Repositories,打开Repositories窗口,选择3rd party,进行如下配置: 

之后,就可以在这里找到该jar了: 

私服配置 
为了让你的maven默认访问你的私服,需要配置settings.xml:

	<mirrors>
...
<mirror>
<id>nexus</id>
<mirrorOf>*</mirrorOf>
<name>Nexus Mirror</name>
<url>http://<Your Nexus IP>/nexus/content/groups/public</url>
</mirror>
...
</mirrors>
...
<profiles>
<profile>
<id>nexus</id>
<repositories>
<repository>
<id>nexus</id>
<name>local private nexus</name>
<url><Your Nexus IP>/nexus/content/groups/public</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
<repository>
<id>nexus</id>
<name>local private nexus</name>
<url>http://<Your Nexus IP>/nexus/content/groups/public-snapshots</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository> </repositories>
<pluginRepositories>
<pluginRepository>
<id>nexus</id>
<name>local private nexus</name>
<url>http://<Your Nexus IP>/nexus/content/groups/public</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</pluginRepository>
<pluginRepository>
<id>nexus</id>
<name>local private nexus</name>
<url>http://<Your Nexus IP>/nexus/content/groups/public-snapshots</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
</profile>
</profiles>
...
<activeProfiles>
<activeProfile>nexus</activeProfile>
</activeProfiles>

  

将jar部署至Nexus

如果通过Eclipse Maven工具,或者直接操作Maven命令行,将jar部署至nexus: 
pom.xml

 
<project>
...
<distributionManagement>
<repository>
<id>nexus-releases</id>
<name>Nexus Release Repository</name>
<url>http://<Your Nexus IP>/nexus/content/repositories/releases/</url>
</repository>
<snapshotRepository>
<id>nexus-snapshots</id>
<name>Nexus Snapshot Repository</name>
<url>http://<Your Nexus IP>/nexus/content/repositories/snapshots/</url>
</snapshotRepository>
</distributionManagement>
...
</project>

  

settings.xml

<settings>
...
<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>
...
</settings>

  

最后,在项目目录中执行mvn deploy 

如果想要在发布jar的同时,把source一通发布,需要做这个配置:

			<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>

  

Maven零散笔记——配置Nexus的更多相关文章

  1. (二十八)monggodb和maven零散笔记

    (1)maven导包的问题:当在pom.xml界面的Dependencies中点击add之后输入jar包查询条件后,如果确定条件没有输错,repo中也确实存在相关jar包,而并没有查处任何结果时,可以 ...

  2. MAVEN学习笔记之私服Nexus(2)

    MAVEN学习笔记之私服Nexus(2) 私有服务器搭建 Nexus www.snatype.org下载 snatype-work 是默认nexus存储nexus a:将bin添加到环境中 Admin ...

  3. Maven使用笔记(五)Sonatype Nexus 搭建Maven 私服

    1. 为什么使用Nexus 如果没有私服,我们所需的所有构件都需要通过maven的中央仓库和第三方的Maven仓库下载到本地, 而一个团队中的所有人都重复的从maven仓库下载构件无疑加大了仓库的负载 ...

  4. linux 安装配置nexus以及maven私服应用

    ---------------------nexus---------------------- 1.编辑nexus脚本, 配置 RUN_AS_USER 参数vi /usr/local/src/nex ...

  5. maven的安装配置超详细教程【含nexus】

    1 下载 下载地址:http://maven.apache.org/download.cgi 界面效果如下: 点击之后进入的apache 软件基金的发布目录,在这里你可以下载apache的所有项目. ...

  6. Maven学习笔记—私服(包含maven的setting.xml配置)

    为什么要用远程仓库(私服) 如果没有私服,我们所需的所有构件都需要通过maven的中央仓库和第三方的maven仓库下载到本地,而一个团队中的所有人都重复的从maven仓库下载构件,这样就加大了中央仓库 ...

  7. jenkins配置Maven的私有仓库Nexus

    1.什么是nexus? Neux:MAVEN的私有仓库; 如果没有私服,我们所需的所有构件都需要通过maven的中央仓库和第三方的Maven仓库下载到本地,而一个团队中的所有人都重复的从maven仓库 ...

  8. 配置Nexus为maven的私服

    1.配置Nexus为maven的私服 第一种方式:在项目的POM中如下配置 <repositories> <repository> <id>nexus_public ...

  9. Centos7安装nexus(maven私服)以及maven的相关配置

    一.nexus安装: 1.获取nexus下载地址: 查询nexus最新版本地址:https://help.sonatype.com/repomanager3/download 当前最新版本为nexus ...

随机推荐

  1. Proteus中常用元器件名字

    运放   OPAMP 稳压管  zener MOS管 IRC 串口  COMPIM

  2. 修改host文件实现自定义域名和iis站点本地调试

    修改host文件实现自定义域名和iis站点本地调试 自定义域名:myhost.com windows版本:win7 iis版本:iis7.x vs版本:vs2010 现在开始动手设置了: 一.修改ho ...

  3. Codeforces 1038F Wrap Around (Codeforces Round #508 (Div. 2) F) 题解

    写在前面 此题数据量居然才出到\(n=40\)???(黑人问号)以下给出一个串长\(|S|=100,n=10^9\)的题解. 题目描述 给一个长度不超过\(m\)的01串S,问有多少个长度不超过\(n ...

  4. THUSC2018 爆零记

    没想到我还真能过这个...... 太玄学了= = 不过这直接导致我月考数学挂科,掉出年级前十= = 5.26 THU过了! 真是十分意外的惊喜啊$-\omega-$ 6.1 今天出发去帝都! 然而飞行 ...

  5. JAVA会员生日和密码

    import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; import ja ...

  6. URLRewrite出现的CSS及图片路径问题

    原文发布时间为:2011-02-24 -- 来源于本人的百度文章 [由搬家工具导入] 例如:把http://www.sofunz.com/house/18649重写到http://www.sofunz ...

  7. kafka术语

    kafka 架构Terminology(术语) broker(代理) Kafka集群包含一个或多个服务器,这种服务器被称为broker Topic  每条发布到Kafka集群的消息都有一个类别,这个类 ...

  8. asp.net内置对象 Response对象使用介绍

    Response对象是HttpRespone类的一个实例.该类主要是封装来自ASP.NET操作的HTTP相应信息.Response对象将数据作为请求的结果从服务器发送到客户浏览器中,并提供有关响应的消 ...

  9. LeetCode OJ-- Jump Game II **

    https://oj.leetcode.com/problems/jump-game-ii/ 给一个数列,每次可以跳相应位置上的步数,问跳到最后位置至少用几步. 动态规划: j[pos]表示从0到po ...

  10. mysql查询练习题

    建库建表 a.建立一个公司数据库(gongsi)    CREATE DATABASE gongsi b.建立一张部门表(部门编号b_id,部门名称b_name) ,             其中b_ ...