Maven零散笔记——配置Nexus
安装&配置Nexus
解压后,应该获得如下目录结构:
- nexus-2.0.6是nexus服务主目录
- sonatype-work是真正的仓库,同时包含了nexus的配置,如定时任务、用户配置等
nexus支持如下命令:
端口配置在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的更多相关文章
- (二十八)monggodb和maven零散笔记
(1)maven导包的问题:当在pom.xml界面的Dependencies中点击add之后输入jar包查询条件后,如果确定条件没有输错,repo中也确实存在相关jar包,而并没有查处任何结果时,可以 ...
- MAVEN学习笔记之私服Nexus(2)
MAVEN学习笔记之私服Nexus(2) 私有服务器搭建 Nexus www.snatype.org下载 snatype-work 是默认nexus存储nexus a:将bin添加到环境中 Admin ...
- Maven使用笔记(五)Sonatype Nexus 搭建Maven 私服
1. 为什么使用Nexus 如果没有私服,我们所需的所有构件都需要通过maven的中央仓库和第三方的Maven仓库下载到本地, 而一个团队中的所有人都重复的从maven仓库下载构件无疑加大了仓库的负载 ...
- linux 安装配置nexus以及maven私服应用
---------------------nexus---------------------- 1.编辑nexus脚本, 配置 RUN_AS_USER 参数vi /usr/local/src/nex ...
- maven的安装配置超详细教程【含nexus】
1 下载 下载地址:http://maven.apache.org/download.cgi 界面效果如下: 点击之后进入的apache 软件基金的发布目录,在这里你可以下载apache的所有项目. ...
- Maven学习笔记—私服(包含maven的setting.xml配置)
为什么要用远程仓库(私服) 如果没有私服,我们所需的所有构件都需要通过maven的中央仓库和第三方的maven仓库下载到本地,而一个团队中的所有人都重复的从maven仓库下载构件,这样就加大了中央仓库 ...
- jenkins配置Maven的私有仓库Nexus
1.什么是nexus? Neux:MAVEN的私有仓库; 如果没有私服,我们所需的所有构件都需要通过maven的中央仓库和第三方的Maven仓库下载到本地,而一个团队中的所有人都重复的从maven仓库 ...
- 配置Nexus为maven的私服
1.配置Nexus为maven的私服 第一种方式:在项目的POM中如下配置 <repositories> <repository> <id>nexus_public ...
- Centos7安装nexus(maven私服)以及maven的相关配置
一.nexus安装: 1.获取nexus下载地址: 查询nexus最新版本地址:https://help.sonatype.com/repomanager3/download 当前最新版本为nexus ...
随机推荐
- TortoiseGit保存用户名和密码的方法
TortoiseGit在提交或者pull时总会提示你输入用户名密码,非常麻烦,那如何解决呢? 1. 对于TortoiseGit 1.8.1.2及其后的版本,右键选择settings ——> Gi ...
- [bzoj4259][bzoj4503] 残缺的字符串 [FFT]
题面 传送门 bzoj上的这两题是一样的...... 正文 我看到这道题,第一想法是跑魔改过的KMP,然后很快发现不可行 于是想换个角度思考 其实,本题最大的问题就在于通配符的存在:它可以匹配任意一个 ...
- SGU 乱搞日志
SGU 100 A+B :太神不会 SGU 101 Domino: 题目大意:有N张骨牌,两张骨牌有两面有0到6的数字,能相连当且仅当前后数字相同,问能否有将N张骨牌连接的方案?思路:裸的欧拉回路,注 ...
- g2o安装
1.安装依赖项 sudo apt-get install libeigen3-dev libsuitesparse-dev libqt4-dev qt4-qmake 2.安装依赖项 libqglvi ...
- powerdesign设置字体大小
http://www.2cto.com/database/201406/308923.html
- Swift实战-单例模式
设计模式(Design pattern)是一套被反复使用.多数人知晓的.经过分类编目的.代码设计经验的总结.GoF提出了23种设计模式,本系列将使用Swift语言来实现这些设计模式 概述 整个应用生命 ...
- UVA1218 Perfect Service
Time Limit: 3000MS 64bit IO Format: %lld & %llu /*by SilverN*/ #include<iostream> #inc ...
- [网络流24题] COGS 搭配飞行员
14. [网络流24题] 搭配飞行员 ★★☆ 输入文件:flyer.in 输出文件:flyer.out 简单对比时间限制:1 s 内存限制:128 MB [问题描述] 飞行大队 ...
- Jobedin外企招聘网:6个要点不能不知道(转载)
又到一年跳槽季,无数职场人士都在蠢蠢欲动,在工作之余,寻找更好的工作. Jobedin外企招聘网,特别提醒:年末跳槽,一定要在拿到新公司的Offer后,才能向现公司提出辞职.不然新工作没找到,却可能丢 ...
- eWebEditor不支持IE7以上版本Bug修改
修改: \Include\Editor.js //把此行 if (element.YUSERONCLICK) eval(element.YUSERONCLICK + "anonymous() ...