下載nexus
首先,從以下地址下載nexus:
http://www.sonatype.com/download-oss-sonatype
選擇下載nexus-2.13.0-01-bundle.tar.gz,適用於所有平台,本文將在linux系統下安裝,操作系統信息如下:
Linux version 3.10.0-123.el7.x86_64 (mockbuild@x86-017.build.eng.bos.redhat.com) (gcc version 4.8.2 20140120 (Red Hat 4.8.2-16) (GCC) ) #1 SMP Mon May 5 11:16:57 EDT 2014
注意nexus是基於Java開發的,這里之所以沒去下載nexus-3.0.0-03-unix.tar.gz是因為它要求安裝JDK8及以上,由於我的linux操作系統安裝的jdk是7,所以選擇nexus-2.13.0-01-bundle.tar.gz,否則出現如下錯誤:
No suitable Java Virtual Machine could be found on your system.
The version of the JVM must be at least 1.8 and at most 1.8.
Please define INSTALL4J_JAVA_HOME to point to a suitable JVM.
啟動nexus服務
將安裝包拷貝到linux操作系統路徑下,解壓,然后cd到bin目錄,可輸入以下nexus命令:
Usage: ./nexus { console | start | stop | restart | status | dump }
./nexus start
注意,如果你是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.
原因已經提示的很清楚了,因為使用了root用戶。解決方法很簡單,換個其它用戶即可;
或者設置環境變量export RUN_AS_USER=root,如下:
export RUN_AS_USER=root
啟動nexus后,打印如下信息:
[root@localhost bin]# ./nexus start
****************************************
WARNING - NOT RECOMMENDED TO RUN AS ROOT
****************************************
Starting Nexus OSS...
Started Nexus OSS.
這里提個醒,一定要注意java的版本,以及8081端口是否被占用等
一切順利的話,我們在瀏覽器輸入http://10.0.10.53:8081/nexus/(這里10.0.10.53是nexus安裝的服務器ip),即可訪問nexus客戶端,默認的用戶名和密碼:admin admin123
如下圖:
上傳jar包到nexus
首先是下載jar包,oracle的驅動包,由於Oracle授權問題,maven中央倉庫沒提供,我們自己下載,
http://www.oracle.com/technetwork/database/enterprise-edition/jdbc-112010-090769.html
然后按如下圖進行操作:
在Artifact Upload頁面,進行如下操作,具體就不細說了,見圖:
弄完之后,我們可以在如下頁面看到自己上傳的jar包;
POM.XML配置
拷貝上圖右下角的XML信息到pom.xml,即
<dependency> <groupId>com.oracle</groupId> <artifactId>ojdbc6</artifactId> <version>11.2.0.4.0</version> </dependency>
另外配置下倉庫信息,如下
<repositories> <repository> <id>nexus</id> <name>nexus</name> <url>http://10.0.10.53: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://10.0.10.53:8081/nexus/content/groups/public/</url> <releases> <enabled>true</enabled> </releases> <snapshots> <enabled>true</enabled> </snapshots> </pluginRepository> </pluginRepositories>
想驗證是否成功的話,可以查看maven日志,會發現從你的私服下載jar包
后續
關於nexus,還有很多其它功能沒去嘗試,這里只是簡單的使用一下,后續有空可以深入研究。
SSH Secure Shell 3.2.9,