nexus maven 搭建怎么安装maven私服

用nexus搭建maven仓库做私服,需不需要在Linux上安装maven【java吧】_百度贴吧
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&签到排名:今日本吧第个签到,本吧因你更精彩,明天继续来努力!
本吧签到人数:0成为超级会员,使用一键签到本月漏签0次!成为超级会员,赠送8张补签卡连续签到:天&&累计签到:天超级会员单次开通12个月以上,赠送连续签到卡3张
关注:667,361贴子:
用nexus搭建maven仓库收藏
用nexus搭建maven仓库做私服,需不需要在Linux上安装maven
2017java学习来上市公司博为峰学java,入学即签就业协议,不就业不收费,查看java课程!java好学吗?java课程来博为峰学,java工程师就业年薪十几万!
登录百度帐号推荐应用maven私服搭建-nexus - 简书
maven私服搭建-nexus
来自官方的内容:
Sonatype Nexus是世界领先的仓库管理系统,在世界范围内Nexus OSS,Nexus Pro或Nexus Pro CLM将近50000次安装。
Sonatype仓库管理私服主要有如下6个目的:
提升编译性能和可靠性
为所有二进制软件组件及其依赖提供配置管理中心
为你所在组织和公开仓库提供一个高级可配置的代理
建立私有组件发布中心
通过改善组件的可用性、版本控制、安全、质量而提升其可维护性和可管理性。
看我蹩脚的英语,建议还是看原文;如果你有好的建议,请留言,万分感谢。
说白了,Sonatype能为我们解决至少2+1个问题:
建立自己的私服,方便二进制组件分发。(CTRL+C && CTRL+V或者FTP的时代已逝)。
提供公开仓库和自己私服的代理,不需要满世界的抓依赖包(在目前的网络环境下,再加上https,同时如果你是java开发,下个100+M的依赖包很正常;即使有本地cache,那也架不住版本的变化)。
质量问题、版本问题、安全。
发行版本说明
Nexus OSS ( OSS = Open Source Software)这个版本包含基于Sonatype 开源软件代码的基本功能和以包形式发布为开源的其他功能,免费试用许可证请查看下载后的二进制包。
Nexus Professional
Nexus Professional CLM Edition这个是旗舰版,包含了专业版本的所有功能。需要购买许可证。
Nexus Professional Trial试用版,不包含Nexus Professional
Nexus Professional CLM Edition所有的功能,官方目前((日))提供14天的试用期,同时安装包是以二进制的实行发布的():
linux : 提供sh文件直接运行安装
Mac : 提供dmg二进制安装包
windows : exe的二进制安装包
下载和解压
基本的安装还是比较简单的,这里仅是安全,不提供其他的权限和安全相关配置说明。,下载完成后解压,解压后目录列表如下图:
其中sonatype-work这个目录可以删除,其中仅包含README.txt和空目录nexus。README.txt文件内容如下:
This is the default work folder used for Sonatype Applications. The location of the individual work folders may be overridden using environment variables. For example, the Nexus work location can be defined with PLEXUS_NEXUS_WORK. If it is not defined, then this default is used. Make sure the applications have read+write permissions to this folder.大概意思: 这是Sonatype应用程序默认使用的工作文件,如果你使用PLEXUS_NEXUS_WORK环境变量定义单独的路径,应用程序工作文件夹将被该环境变量定义的路径覆盖;如果没定义,那这个默认的文件夹将被使用。请确保sonatype应用对该文件夹有读写权限,特别是linux用户,使用root用户将无法直接启动,提示:
****************************************
WARNING - NOT RECOMMENDED TO RUN AS ROOT
****************************************
If you insist running as root, then set the environment variable RUN_AS_USER=root before running this script.
If you insist running as root, then set the environment variable RUN_AS_USER=root before running this script.
主要是因为sonatype将自身的数据和索引都存储在该目录。
将解压后的内容拷贝至需要安装的目标目录,如("C:/Program Files"或“/usr/local”)
进入nexus/bin。
如果是非windows用户,执行nexus start,注意使用非root用户,同时确保sonatype-work 和 nexus目录具有读写权限( sonatype-work存储数据,nexus需要写入运行时日志)。-如果是windows用户,通过cmd控制台运行nexus.bat start
在浏览器中输入:http://localhost:8081/nexus。
如果部署虚拟机中,请将localhost替换为其他物理机器或虚拟iji的IP地址。对于非本机,如果是linux,请保证防火墙放行8081端口
nexus的配置文件位于[安装目录]/nexus/conf下,浏览该目录:
恩,你猜得不错,nexus是以jetty为作为运行容器的。
打开nexus.properties文件内容,如下:
Paste_Image.png
application-port : nexus的监听端口
application-host : nexus的监听ip地址,如果使用nginx或apache等其他http代理,可将该ip地址修改为localhost或127.0.01,增强安全性.其他配置属性请参考官方网站(
2017,认真一回。Maven nexus 安装nexus私服出现的两个问题
时间: 23:30:36
&&&& 阅读:627
&&&& 评论:
&&&& 收藏:0
标签:1. 在win10中安装nexus时提示:wrapper | OpenSCManager failed - 拒绝访问。 (0x5)
主要是没有权限。需要以管理员的身份运行
如果你是直接点击&start-nexus.bat 来启动服务的话:
如果你是 通过 cmd窗口来执行的话,需要设置命令提示符窗口的权限来执行
2. wrapper | The nexus-webapp service is not installed - The specified service does not exist
第一个问题解决之后,又出现了这个问题。
解决方式是到 D:\Program\nexus-2.0.6-bundle\nexus-2.0.6\conf 目录下,修改 nexus.properties在最后添加一行 wrapper.startup.delay=30然后先运行install-nexus.bat ,start-nexus.bat 就可以了D:\Program\nexus-2.0.6-bundle\nexus-2.0.6\bin\jsw\windows-x86-64&install-nexus.bat& && &&&wrapper&&| nexus installed.D:\Program\nexus-2.0.6-bundle\nexus-2.0.6\bin\jsw\windows-x86-64&start-nexus.bat& && &&&wrapper&&| Starting the nexus service...& && &&&wrapper&&| Waiting to start...& && &&&wrapper&&| Waiting to start...& && &&&wrapper&&| nexus started.D:\Program\nexus-2.0.6-bundle\nexus-2.0.6\bin\jsw\windows-x86-64&标签:
&&国之画&&&& &&&&chrome插件&&
版权所有 京ICP备号-2
迷上了代码!下次自动登录
现在的位置:
& 综合 & 正文
Linux安装配置maven3.0以及搭建nexus私服
一、软件准备
apache-maven-3.0-bin.tar.gz
下载地址:
http://www.apache.org/dyn/closer.cgi/maven/binaries/apache-maven-3.0-bin.tar.gz
nexus-oss-webapp-1.8.0-bundle.tar.gz
下载地址:
http://nexus.sonatype.org/downloads/
、创建需要操作
的用户组以及用户(
用户安装不用创建)
创建用户组
#useradd -g
apaduser apaduser
创建用户并指定用户组
为用户分配密码
、创建解压目录,并将
apache-maven-3.0-bin.tar.gz
文件解压到指定目录
#mkdir maven
/opt/maven
/opt/maven
#tar -zvxf apache-maven-
-bin.tar.gz
#ln –s apache-maven-3.0 apache-maven
、配置环境变量
(因为每种linux系统配置文件不一样,
cd /home/apaduser (“sudo su –“ for root user)
vi .bash_profile
#. .bash_profile
在文件中添加如下行:
M2_HOME=/opt/maven/apache-maven
export M2_HOME
PATH=$PATH:$M2_HOME/bin
export PATH
、查看版本
#cd /opt/maven/apache-maven/bin
#mvn –version
如果显示版本信息,应该会在
目录下创建
#cd /home/
目录,则可以手动添加一个
#mkdir .m2
、如果需要把
repository
目录指定到其他目录,则修改
安装目录下
中的配置文件
settings.xml
#vi /opt/maven/apache-maven/conf/settings.xml
&localRepository&….&/localRepository&
的注释打开
或者在文件中增加
在这个注释下增加
&localRepository&your repository path&/localRepository&
nexus-oss-webapp-1.8.0-bundle.tar.gz
文件到指定目录
nexus-oss-webapp-
-bundle.tar.gz
/usr/local
#tar -zvxf nexus-oss-webapp-
-bundle.tar.gz
#ln –s nexus-oss-webapp-1.8.0 nexus
usr/local/nexus
选择自己机器的版本:
#cd linux-x86-
#./nexus start
#./nexus restart
#./nexus stop
在浏览器中输入:
changethis
localhost:8081/nexus
就可以看到
的主页,点击右上角
默认用户名和密码是:
admin/admin123
运行后会自动生成一个
sonatype-work
包会存放在
sonatype-work/nexus/storage
点击左侧菜单
Repositories
分别将右侧列表中
Apache Snapshots
Codehaus Snapshots
Maven Central
repository
configuration配置选项中的
Download Remote Index
,并保存设置,
然后在列表中分别右键点击三个
Repository
2)增加新的
Repository
,有一些比较常用
repository
中可能找不到,
一般比较常用的有
//repository.jboss.org/maven2/
//repository.jboss.org/nexus/content/repositories/releases/
//download.java.net/maven/2/
//developer./maven2/
juel:juel-impl:
包,所以我还添加了一个自己找的:
//repository.exoplatform.org/content/groups/public/
添加步骤:
Add-&Proxy Repository-&
Repository ID, Repository Name,
Remote Storage Location
其他的默认即可。
Repository
Public Repositories
Public Repositories
Configuration
中,将多选
中的项全部添加到左边,然后保存。
4) 添加自己的
repository
列表中有一个
,也就是第三方
包,点击会看到一个
Artifact Upload
选项卡,点击后,填写相应的信息。Nexus搭建Maven私服(一) Maven安装
下载地址:http://maven.apache.org/download.html
下载(此版本为3.0.4):wget http://mirror./apache/maven/binaries/apache-maven-3.0.4-bin.tar.gz
解压安装:tar -xvzf apache-maven-3.0.4-bin.tar.gz
maven的环境配置: vim /etc/profile 中 添加
&export M2_HOME=../apache-maven-3.0.4
&export PATH=$PATH:$M2_HOME/bin
使环境生效&source /etc/profile
测试maven 安装成功 mvn -v
Nexus 网站
下载 http://nexus.sonatype.org/downloads/
Nexus提供了两种安装方式,一种是内嵌Jetty的bundle,只要你有JRE就能直接运行。第二种方式是WAR,你只须简单的将其发布到web容器中即可使用.
解压 tar xvzf nexus-2.0-bundle.tar.gz
进入 cd ...bin/jsw/linux-x86-64/中 运行 ./nexus start 即可。
&进入. 默认用户名密码为admin/admin123.
nexus默认是关闭远程索引下载功能的,主要是担心会造成对服务器的巨大负担,需要我们手工开启。&&&开启的方式:&&点击Administration菜单下面的Repositories,将这三个仓库Apache Snapshots,Codehaus Snapshots,Maven Central的Download Remote Indexes修改为true。然后在这三个仓库上分别右键,选择Re-index,这样Nexus就会去下载远程的索引文件。
要让maven使用nexus作为私服,需要做一些设置,使用和原来设置artifactory相似的方法。修改~/.m2/settings.xml.&&增加nexus的profile:
&profiles&
&profile& &id&nexus&/id& &repositories& &repository& &id&nexus&/id& &name&Nexus&/name& &url&http://ip:8081/nexus/content/groups/public/&/url& &releases&&enabled&true&/enabled&&/releases& &snapshots&&enabled&true&/enabled&&/snapshots& &/repository& &/repositories& &pluginRepositories& &pluginRepository& &id&nexus&/id& &name&Nexus&/name& &url&http://ip:8081/nexus/content/groups/public/&/url& &releases&&enabled&true&/enabled&&/releases& &snapshots&&enabled&true&/enabled& &/snapshots& &/pluginRepository& &/pluginRepositories&
&/profile&
&/profiles& &activeProfiles& &activeProfile&nexus&/activeProfile& &/activeProfiles&
如果你的地理位置附近有一个速度更快的central镜像,或者你想覆盖central仓库配置,或者你想为所有POM使用唯一的一个远程仓库(这个远程仓库代理的所有必要的其它仓库),你可以使用settings.xml中的mirror配置。
&mirror& &id&nexus&/id& &mirrorOf&*&/mirrorOf& &name&Nexus&/name& &url&http://IP:8081/nexus/content/groups/public/&/url& &/mirror&
&profile& &id&nexus&/id& &repositories& &repository& &id&central&/id& &name&Nexus&/name& &url&http://central&/url& &releases&&enabled&true&/enabled&&/releases& &snapshots&&enabled&true&/enabled&&/snapshots& &/repository& &/repositories& &pluginRepositories& &pluginRepository& &id&central&/id& &name&Nexus&/name& &url&http://central&/url& &releases&&enabled&true&/enabled&&/releases& &snapshots&&enabled&true&/enabled& &/snapshots& &/pluginRepository& &/pluginRepositories&
&/profile&
此配置用Maven私服覆盖central仓库配置 这样Maven对任何仓库的构件下载请求都会转到私服中.
需要开机启动maven私服服务
在 /etc/rc.d/rc.local 中加入&nexus/bin/jsw/linux-x86-64/nexus start
相关地址:&
来自立方网}

我要回帖

更多关于 maven 发布到nexus 的文章

更多推荐

版权声明:文章内容来源于网络,版权归原作者所有,如有侵权请点击这里与我们联系,我们将及时删除。

点击添加站长微信