2011年07月12日16:32 

下面介绍在Linux操作系统下安装配置maven和搭建nexus私服。
  一、安装前的准备
  下载 jdk http://www.oracle.com/technetwork/java/javase/downloads/jdk-6u26-download-400750.html
  jdk-6u26-linux-x64.bin
  下载maven http://mirrors.geoexpat.com/apache//maven/binaries/
  apache-maven-3.0.3-bin.tar.gz
  下载nexus http://nexus.sonatype.org/downloads/
  nexus-oss-webapp-1.9.1.1-bundle.tar.gz
  二、安装jdk
  使用root用户。
  添加执行权限 chmod a+x jdk-6u26-linux-x64.bin
  安装 ./ jdk-6u26-linux-x64.bin 按Enter 完成安装。
  三、maven安装及配置
  1、创建需要操作 maven 的用户组以及用户( 如果用 root 用户安装不用创建)。
  1) #groupadd mavenuser // 创建用户组
  2) #useradd -g mavenuser mavenuser // 创建用户并指定用户组
  3) #passwd mavenuser // 为用户分配密码
  2、解压安装
  1) #cd /data
  2)#mkdir maven
  3)#chown -R mavenuser : mavenuser /data/maven
  4)#chmod 755 /data/maven
  5)#su -l xinhua
  6)#tar -zvxf apache-maven-3.0.3-bin.tar.gz
  3、配置
  在用户主目录 查看是否有 .m2 目录
  如果没有建立 mkdir .m2
  在.m2 目录建立 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">
<!-- 指定jar包存放路径-->
<localRepository>/data/maven/apache-maven-3.0.3/repo/</localRepository>
<pluginGroups> </pluginGroups> <!--设置代理服务器 -->
<proxies> <proxy>
<id>my-proxy</id>
<active>true</active>
<protocol>http</protocol>
<host>202.84.17.41</host>
<port>8080</port>
</proxy> </proxies>
<!-- 设置私服server-->
<servers>
<server>
<id>nexus</id>
<username>admin</username>
<password>admin</password>
</server> </servers> <!-- 配置私服作为镜像,只允许maven使用私服--> <mirrors>
<mirror>
<id>nexus</id>
<mirrorOf>*</mirrorOf>
<url>http://localhost:8081/nexus/content/groups/public</url>
</mirror> </mirrors> <profiles>
<profile>
<id>nexus</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>
</profiles>
<activeProfiles>
<activeProfile>nexus</activeProfile>
</activeProfiles></settings>
  四、nexus安装
  解压 tar -zxvf nexus-oss-webapp-1.9.1.1-bundle.tar.gz
  五、编写启动脚本
  启动脚本:
  vi mavenStart.sh
  将下面脚本添加进去
  #!/bin/bash
  export LANG='zh.GB18030'
  M2_HOME=/data/maven/apache-maven-3.0.3
  export M2_HOME
  JAVA_HOME=/data/jdk1.6.0_26/bin
  PATH=$JAVA_HOME:$PATH:$HOME/bin:$M2_HOME/bin
  export PATH
  /data/maven/nexus-oss-webapp-1.9.1.1/bin/jsw/linux-x86-64/nexus start
  停止脚本:
  vi mavenStop.sh
  将下面脚本添加进去
  #!/bin/bash
  /data/maven/nexus-oss-webapp-1.9.1.1/bin/jsw/linux-x86-64/nexus stop6

  六、nexus使用及配置
  1、运行
  服务端启动mavenStart.sh 脚本
  在浏览器中输入: http://ipaddress:8081/nexus
  就可以看到 nexus 的主页,点击右上角 Log in
  默认用户名和密码是: admin/admin123
  2、配置
  点击左侧 Repositories
  将所有Type 是 proxy 的 configuration配置选项中的 Download Remote Index 配置改为 True
  如果需要代理将配置最下面的Override Http Proxy Setting 勾上并填写代理服务器地址和端口,最后保存设置
  然后在列表中分别右键点击 ReIndex
  3、添加自己的jar到nexus
  选中 3rd party , Artifact Upload 标签
  GAV Definition 选择GAV Parameters
  填写 Group Artifact version packaging
  然后选择jar包 上传提交即可。

Linux安装配置maven以及搭建nexus私服(编写启动脚本)的更多相关文章

  1. Linux 安装配置maven3.0 以及搭建nexus私服

    http://carvin.iteye.com/blog/785365 一.软件准备 1.apache-maven-3.0-bin.tar.gz 下载地址:http://www.apache.org/ ...

  2. 搭建nexus私服(maven)

    这里提供nexus的直接下载页面的链接: https://www.sonatype.com/download-oss-sonatype maven获取依赖jar包是从中央仓库获取,但很莫名的出现jar ...

  3. Linux_Centos中搭建nexus私服

    1.在Linux下搭建Nexus私服 1).下载并且解压      下载  nexus-2.11.2-03-bundle.zip      unzip nexus-2.11.2-03-bundle.z ...

  4. 搭建nexus私服,无法下载相关jar包,报错Repository proxy-mode is BLOCKED_AUTO

    在搭建nexus私服的时候,之前没直接用来下载maven的相关插件jar包,一直可以使用, 结果今天要编译hadoop的时候,在linux上新用maven就报错了,无法下载maven的相关插件(如下) ...

  5. Linux安装配置php环境的方法

    本文实例讲述了Linux安装配置php环境的方法.分享给大家供大家参考,具体如下: 1.获取安装文件: http://www.php.net/downloads.php php-5.3.8.tar.g ...

  6. linux经常使用(一)linux 安装配置 jdk之 找不到安装文件文件夹及source /etc/profile 报unexpected end of file 错误 解决

    linux 安装配置 jdk 应该算是一个非常主要的东西.可是我到如今才自己第一次 正式安装.果然出现了问题.. 问题就是 安装之后 找不到 安装路径 ,进而没法配置环境变量. 现象例如以下: 提示 ...

  7. Linux安装配置apache

    Linux安装配置apache   1.获取软件: http://httpd.apache.org/  httpd-2.2.21.tar.gz 2.安装步骤: 解压源文件: 1 tar zvxf ht ...

  8. Eclipse安装配置Maven

    Eclipse安装配置Maven 1 安装配置Maven 1.1 下载Maven 从Apache网站 http://maven.apache.org/ 下载并且解压缩安装Apache Maven.   ...

  9. (mac)Idea安装配置maven

    一.mac安装配置maven 1)官网下载(http://maven.apache.org/download.cgi) binary   .tar.gz 下载解压到某处 2)配置环境变量 $ open ...

随机推荐

  1. iOS中的多线程 NSOperation

    在ios中,使用多线程有三种方式,分别是:NSThread.NSOperation和NSOperationQueue.GCD,在本节,主要讲解一下NSOperation的使用. NSOperation ...

  2. 用php实现交互式工具——How do I write a command-line interactive PHP script?

    I want to write a PHP script that I can use from the command line. I want it to prompt and accept in ...

  3. 10gocm-&gt;session3-&gt;数据备份与恢复

    这个实验考查我们当数据库出现问题宕机.数据丢失的情况下怎样挽回我们的损失,怎样在最短时间内恢复我们的数据库服务. RMAN规划 host target库 catalog库 ocm01 ocmdb   ...

  4. Java程序猿的JavaScript学习笔记(1——理念)

    计划按例如以下顺序完毕这篇笔记: Java程序猿的JavaScript学习笔记(1--理念) Java程序猿的JavaScript学习笔记(2--属性复制和继承) Java程序猿的JavaScript ...

  5. FireDAC中的SQLite(一)

    Windows client software,FireDAC supports two SQLite library linking modes: Static linking: the x86 s ...

  6. 【S6】当心C++编译器最烦人的分析机制

    1.考虑一个包含int的文件,复制到list,如下: ifstream dataFile("ints.bat"); list<int> data(istream_ite ...

  7. 被查封7周之后,全球最大BT网站“海盗湾”又重新活过来了【36kr】

    原文地址 原文地址 "免费"和"版权","自由"和"监管"永远在较量啊,矛盾共同体,事物的两面性~ 被查封7周之后,全球 ...

  8. tomcat中的日志开关文件(logging.properties)介绍

    以tomcat-6.0.29为例: http://www.ossez.com/thread-18138-1-1.html #配置tomcat的日志输出方式,这里表示文件输出和控制台输出.handler ...

  9. Using a Microsoft Account to Logon and Resulting Internet Communication in Windows 8

    Using a Microsoft Account to Logon and Resulting Internet Communication in Windows 8 此主题尚未评级 - 评价此主题 ...

  10. SLF4J warning or error messages and their meanings

    来自:http://www.slf4j.org/codes.html#StaticLoggerBinder The method o.a.commons.logging.impl.SLF4FLogFa ...