nexus搭建maven私服,nexus搭建maven

來源:互聯網
上載者:User

nexus搭建maven私服,nexus搭建maven
下載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,

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.