Linux 安装配置maven3.0 以及搭建nexus私服
http://carvin.iteye.com/blog/785365
一、软件准备
1、apache-maven-3.0-bin.tar.gz 下载地址:http://www.apache.org/dyn/closer.cgi/maven/binaries/apache-maven-3.0-bin.tar.gz
2、nexus-oss-webapp-1.8.0-bundle.tar.gz 下载地址:http://nexus.sonatype.org/downloads/
二、maven安装配置
1、创建需要操作maven的用户组以及用户(如果用root用户安装不用创建)
- #groupadd configer //创建用户组
- #useradd -g configer configer //创建用户并指定用户组
- #passwd configer //为用户分配密码
2、创建解压目录,并将apache-maven-3.0-bin.tar.gz文件解压到指定目录
- #cd /opt
- #mkdir maven
- #chown -R configer:configer /opt/maven
- #chmod 755 /opt/maven
- #su -l configer
- #tar -zvxf apache-maven-3.0-bin.tar.gz
2、配置环境变量
- #vi /home/configer/.bash_profile
在文件中添加如下行:
- M2_HOME=/opt/maven/apache-maven-3.0
- export M2_HOME
- PATH=$PATH:$M2_HOME/bin
- export PATH
3、查看版本
- #cd /opt/maven/apache-maven-3.0/bin
- #mvn --version
如果显示版本信息,应该会在${user}目录下创建.m2目录
4、查看.m2目录
- #cd /home/configer/.m2
- 如果没有.m2目录,则可以手动添加一个
- #mkdir .m2
5、如果需要把maven的repository目录指定到其他目录,则修改maven安装目录下conf中的配置文件settings.xml文件
- #vi /opt/maven/apache-maven-3.0/conf/settings.xml
- 将文件中<localRepository>....</localRepository>的注释打开
- 或者在文件中增加 在这个注释下增加
- <localRepository>your repository path</localRepository>
二、搭建nexus私服
1、解压nexus-oss-webapp-1.8.0-bundle.tar.gz文件到指定目录
- #tar -zvxf nexus-oss-webapp-1.8.0-bundle.tar.gz
2、启动nexus
- #cd /opt/maven/nexus-oss-webapp-1.8.0/bin/jsw
- 选择自己机器的版本:
- #cd linux-x86-32/
- #./nexus start
- 重启:
- #./nexus restart
- 停止:
- #./nexus stop
3、运行nexus
在浏览器中输入:http://localhost:8081/nexus
就可以看到nexus 的主页,点击右上角Log in
默认用户名和密码是:admin/admin123
运行后会自动生成一个nexus工作目录sonatype-work,nexus下载的jar包会存放在
sonatype-work/nexus/storage中
4、配置
1)点击左侧菜单Repositories
分别将右侧列表中
- Apache Snapshots
- Codehaus Snapshots
- Maven Central
三个repository 的Download Remote Index 配置改为True,并保存设置,
然后在列表中分别右键点击三个Repository,点击ReIndex
2)增加新的Repository,有一些比较常用jar包在nexus提供的repository中可能找不到,
一般比较常用的有
- JBOSS的两个:
- http://repository.jboss.org/maven2/
- http://repository.jboss.org/nexus/content/repositories/releases/
- SUN的:
- http://download.java.net/maven/2/
- K-INT的:
- http://developer.k-int.com/maven2/
- 因为找juel:juel-impl:2.2.1 这个jar包,所以我还添加了一个自己找的:
- http://repository.exoplatform.org/content/groups/public/
添加步骤:
- 点击Add->Proxy Repository->填写Repository ID, Repository Name, 以及Remote Storage Location 其他的默认即可。
3) 将新增的Repository添加到Public Repositories中
在Public Repositories 的Configuration中,将多选Select中的项全部添加到左边,然后保存。
4) 添加自己的jar包
- 在repository列表中有一个3rd party,也就是第三方jar包,点击会看到一个Artifact Upload选项卡,点击后,填写相应的信息。
- GAV Definition 一般选择 GAV Parameters
- 然后添加Group:Artifact:Version:Package
- 示例 juel:juel-impl:2.2.1:jar
然后选择要上传的jar包,保存即可
5) nexus中设置代理服务器
选择左侧administrator菜单中的Server选项,在右侧打开的页面的中下部,有一个选择项:Default HTTP Proxy Settings(optional) 将复选框选中,填写相应的代理服务器信息即可。
6) 编写自己的settings.xml,文件内容如下:
- <settings>
- <proxies>
- <proxy>
- <id>normal</id>
- <active>true</active>
- <protocol>http</protocol>
- <username>deployment</username>
- <password>deploy</password>
- <host>localhost:8081/nexus</host>
- <port>80</port>
- <nonProxyHosts>localhost:8081/nexus</nonProxyHosts>
- </proxy>
- </proxies>
- <mirrors>
- <mirror>
- <!--This is used to direct the public snapshots repo in the
- profile below over to a different nexus group -->
- <id>nexus-public-snapshots</id>
- <mirrorOf>public-snapshots</mirrorOf>
- <url>http://localhost:8081/nexus/content/groups/public-snapshots</url>
- </mirror>
- <mirror>
- <!--This sends everything else to /public -->
- <id>nexus</id>
- <mirrorOf>*</mirrorOf>
- <url>http://localhost:8081/nexus/content/groups/public</url>
- </mirror>
- </mirrors>
- <profiles>
- <profile>
- <id>development</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>
- <profile>
- <!--this profile will allow snapshots to be searched when activated-->
- <id>public-snapshots</id>
- <repositories>
- <repository>
- <id>public-snapshots</id>
- <url>http://public-snapshots</url>
- <releases><enabled>false</enabled></releases>
- <snapshots><enabled>true</enabled></snapshots>
- </repository>
- </repositories>
- <pluginRepositories>
- font-size: 1em; m
Linux 安装配置maven3.0 以及搭建nexus私服的更多相关文章
- Linux安装配置maven以及搭建nexus私服(编写启动脚本)
2011年07月12日16:32 下面介绍在Linux操作系统下安装配置maven和搭建nexus私服. 一.安装前的准备 下载 jdk http://www.oracle.com/technetw ...
- Maven3.0 服务器配置搭建
搭建nexus私服,原因很简单,不必多说,本文重点说下最新版的Maven 3.0.x系列的安装步骤. 最新版的网上中文资料很少,参考后都没成功.最后在官网的英文资料中得到答案,成功搞定. 1.确定我们 ...
- Linux安装配置apache
Linux安装配置apache 1.获取软件: http://httpd.apache.org/ httpd-2.2.21.tar.gz 2.安装步骤: 解压源文件: 1 tar zvxf ht ...
- windows Maven3.0 服务器配置搭建
搭建nexus私服,原因很简单,不必多说,本文重点说下最新版的Maven 3.0.x系列的安装步骤. 最新版的网上中文资料很少,参考后都没成功.最后在官网的英文资料中得到答案,成功搞定. 1.确定我们 ...
- Linux安装配置varnish web加速器
Linux安装配置varnish web加速器 Varnish是一款高性能的开源HTTP加速器,它可以来做纯粹的代理服务器,负载均衡,但varnish最主要的功能是缓存加速,也是它最出色的 ...
- Linux安装配置php环境的方法
本文实例讲述了Linux安装配置php环境的方法.分享给大家供大家参考,具体如下: 1.获取安装文件: http://www.php.net/downloads.php php-5.3.8.tar.g ...
- linux经常使用(一)linux 安装配置 jdk之 找不到安装文件文件夹及source /etc/profile 报unexpected end of file 错误 解决
linux 安装配置 jdk 应该算是一个非常主要的东西.可是我到如今才自己第一次 正式安装.果然出现了问题.. 问题就是 安装之后 找不到 安装路径 ,进而没法配置环境变量. 现象例如以下: 提示 ...
- windows7下安装配置phonegap3.0 (cordavo)开发环境 (涉及android sdk配置)
之前在mac上安装调试过phonegap,现在公司用的是windows7,所以不得不再进行一次windows下的配置工作,顺便也写下来了 主要麻烦的地方是要在win7下添加好几个环境变量,这一块地方特 ...
- Linux安装Redis 6.0.5 ./install_server.sh报错
Linux安装Redis 6.0.5 ./install_server.sh报错 linux 安装Redis6.0.5时 进行到./install_server.sh时报错, This systems ...
随机推荐
- 数据存储(两)--SAX发动机XML记忆(附Demo)
Android SDK支撑SAX读取技术XML,SAX通过连续的读取方式来处理XML文件.这要求每个读数XML对应的事件触发,以处理该节点的文件的节点.以下是基于一个例子来告诉SAX使用: publi ...
- Device "/dev/sdg" is not a partition【再续】
之前创建asm磁盘的时候总结过一下错误:http://blog.csdn.net/rhys_oracle/article/details/17029333 当今天情况是这种.例如以下: 在使用open ...
- JavaEE(11) - 消息驱动EJB
1. MDB作为异步消费者的本质 2. MDB的运行机制 3. 使用@MessageDriven修饰MDB(需要messageListenerInterface) 4. 实现MessageListen ...
- UVALive 5099 Nubulsa Expo 全球最小割 非网络流量 n^3
主题链接:点击打开链接 意甲冠军: 给定n个点m条无向边 源点S 以下m行给出无向边以及边的容量. 问: 找一个汇点,使得图的最大流最小. 输出最小的流量. 思路: 最大流=最小割. 所以题意就是找全 ...
- Dynamics CRM2013/2015 禁止欢迎屏幕(Disable the Welcome Screen)
首先打开Dynamic CRM 2013将有一个欢迎界面的例子,下面的图,它不会为了图检查框出现.OK然后,下一次打开就没有. 可是当我们打开F12开发者工具,清除域的缓存后再次打开CRM,这个欢迎 ...
- Flex列在一个表格式的数字值
1.问题背景 一般的.表格中展示的比率.对照率的处理是:保留两位小数,并向上保留 2.实现实例 <? xml version="1.0" encoding="utf ...
- 设置韩澳大利亚sinox弄winxp清除字体和界面美观
澳大利亚开始与汉sinox一直以为接口暗淡,字体比较模糊,否winxp光明,导致眼比较辛苦的眼睛.比方说,可能不那么黯淡刺眼,有益眼睛,但我不能忍受字体模糊.即使调整分辨率,,但是字体模糊还是没有改观 ...
- 一个SQL面试题
面试问题都是基于 bug统计分析续(一)基于SQL的Bug统计方法 中3-2节的讨论抽象出来的. 题目:如果一张表有AC两列,怎么找各种C里不同A的数目.并列出相相应的C的值,并找出每种C下A最多的A ...
- 运行时间(Java版本)—转换毫秒到时分秒日期
第一种方式: import java.util.Calendar; import java.util.TimeZone; public class Test { /** * 将毫秒转换为年月日时分秒 ...
- 前端学习笔记(zepto或jquery)——对li标签的相关操作(五)
对li标签的相关操作——has与find的差异性 demo代码: <ul> <li><p>1</p></li> <li>2< ...