<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    posts - 167,  comments - 30,  trackbacks - 0

    maven大家都了解了是個(gè)什么玩意兒,直接上部署過程了。
    新建個(gè)目錄mkdir /data/maven, 
    進(jìn)入該目錄并執(zhí)行如下操作步驟:

    maven官網(wǎng)下載包:

    #wget http://mirror.bit.edu.cn/apache/maven/maven-3/3.1.1/binaries/apache-maven-3.1.1-bin.tar.gz

     解壓maven

    # tar -zxvf apache-maven-3.1.1-bin.tar.gz

     進(jìn)入apache-maven-3.1.1,新建隱藏目錄.m2(mkdir .m2),再在該.m2目錄下創(chuàng)建setting.xml文件,文件內(nèi)容如下:

    <?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.1.1/repo/</localRepository>

    <pluginGroups> </pluginGroups> <!--設(shè)置代理服務(wù)器 -->

    <proxies> <proxy>

    <id>my-proxy</id>

    <active>true</active>

    <protocol>http</protocol>

    <host>202.84.17.41</host>

    <port>8080</port>

    </proxy> </proxies>

    <!-- 設(shè)置私服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所有版本下載地址:http://www.sonatype.org/nexus/archived

    nexus官網(wǎng)下載最新的版本.

    # wget http://www.sonatype.org/downloads/nexus-latest-bundle.tar.gz

     解壓nexus

    # tar -zxvf nexus-2.6.4-02-bundle.tar.gz

     啟動(dòng)腳本:

    mavenStart.sh

    #!/bin/bash

    M2_HOME=/data/maven/apache-maven-3.1.1

    JAVA_HOME=/usr/local/jdk/bin

    export M2_HOME

    PATH=$JAVA_HOME:$PATH:$HOME/bin:$M2_HOME/bin

    export PATH

    /data/maven/nexus-2.1.1/bin/jsw/linux-x86-64/nexus start

    停止腳本:

    mavenStop.sh

    #!/bin/bash

    /data/maven/nexus-2.1.1/bin/jsw/linux-x86-64/nexus stop

     正常啟動(dòng)nexus

    # sh mavenStart.sh

    ****************************************

    WARNING - NOT RECOMMENDED TO RUN AS ROOT

    ****************************************

    Starting Nexus OSS...

    Started Nexus OSS.

    錯(cuò)誤1:若出現(xiàn)如下錯(cuò)誤:

    ***********************************

    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

    解決方式:修改$NEXUS_HOME/jsw/linuxx86-64/nexus文件中RUN_AS_USER=root

     錯(cuò)誤2:啟動(dòng)幾秒鐘后,自動(dòng)停止了nexus進(jìn)程,報(bào)錯(cuò)如下:

    Launching a JVM...

    wrapper  | JVM exited while loading the application.

    jvm 3    | Exception in thread "main" java.lang.UnsupportedClassVersionError: org/sonatype/nexus/bootstrap/jsw/JswLauncher : Unsupported major.minor version 51.0

    jvm 3    |     at java.lang.ClassLoader.defineClass1(Native Method)

    jvm 3    |     at java.lang.ClassLoader.defineClassCond(ClassLoader.java:632)

    jvm 3    |     at java.lang.ClassLoader.defineClass(ClassLoader.java:616)

    jvm 3    |     at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)

    jvm 3    |     at java.net.URLClassLoader.defineClass(URLClassLoader.java:283)

    jvm 3    |     at java.net.URLClassLoader.access$000(URLClassLoader.java:58)

    jvm 3    |     at java.net.URLClassLoader$1.run(URLClassLoader.java:197)

    jvm 3    |     at java.security.AccessController.doPrivileged(Native Method)

    jvm 3    |     at java.net.URLClassLoader.findClass(URLClassLoader.java:190)

    jvm 3    |     at java.lang.ClassLoader.loadClass(ClassLoader.java:307)

    jvm 3    |     at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)

    jvm 3    |     at java.lang.ClassLoader.loadClass(ClassLoader.java:248)

    jvm 3    | Could not find the main class: org.sonatype.nexus.bootstrap.jsw.JswLauncher.  Program will exit.

    解決方式:可能原因是jdk版本低 沒有去下載jdk1.7,而是下載了nexus-2.1.1-bundle.tar.gz,測試了下,jdk1.6是完全支持滴~

     重新修改配置并啟動(dòng):

    瀏覽器中輸入:http://IP:8081/nexus

    顯示界面如下:


    默認(rèn)用戶名和密碼:admin/admin123

    點(diǎn)擊左側(cè) Repositories,顯示如下:

    將如下三項(xiàng)目中的Configuration中的Download Remote indexs修改為true
     

    然后,右鍵à選擇Repair Index Nexus遠(yuǎn)程下載索引文件。


    3rd party Configuration中的Deploment Policy修改為Allow Redeploy

    以上就基本已將nexus私服配置完成。

    通過選擇Select Artifact(s) for upload,上傳單獨(dú)開發(fā)的jar包方式:



     二、 maven插件安裝及nexus私服的使用:

    我的電腦中以前已經(jīng)安裝過maven了,在控制臺(tái)下輸入mvn -version可以查看到當(dāng)前maven版本:


    修改D:\apache-maven-3.0.5\conf\setting.xml文件中變更maven repository地址。

    默認(rèn)是在用戶本地臨時(shí)目錄下,我的是C:\Documents and Settings\server\.m2\repository

    配置修改如下:

    <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">

      <!-- localRepository

       | The path to the local repository maven will use to store artifacts.

       |

       | Default: ~/.m2/repository

      <localRepository>/path/to/local/repo</localRepository>

      -->

      <localRepository>E:/maven/repo</localRepository>

      <!-- interactiveMode

       | This will determine whether maven prompts you when it needs input. If set to false,

       | maven will use a sensible default value, perhaps based on some other setting, for

       | the parameter in question.

       |

       | Default: true

      <interactiveMode>true</interactiveMode>

      -->

     控制臺(tái)下,運(yùn)行mvn help:system, 從遠(yuǎn)程倉庫下載..


    eclipse /Myeclipse安裝插件的方式最常見的有兩種:

        1. 一種是在線安裝,這,貌似是用的最多的,就是:Help  -->  Install New Software,然后輸入 HTTP 地址來安裝,但有一個(gè)很明顯的缺點(diǎn),就是慢!
        2. 一種是離線安裝,用 link 的方式來安裝,這種方式可拔性更好,可以隨時(shí)將插件插上和拔下,非常方便。

    第二中方式可以參考博客:

    http://m.tkk7.com/fancydeepin/archive/2012/07/13/382965.html

    我比較傾向于使用Myeclipse高度集成化的工具.

    安裝成功后,工具中WindowsàPreferences


    安裝maven


     

    配置setting.xml


     以上配置完成后,現(xiàn)有maven工程pom.xml文件中修改nexus私服地址后,會(huì)自動(dòng)下載依賴的jar,控制臺(tái)中不斷輸出信息:



    posted on 2013-11-19 11:48 David1228 閱讀(23743) 評論(1)  編輯  收藏 所屬分類: JAVA其他

    FeedBack:
    # re: Maven及Nexus私服搭建[未登錄]
    2015-09-28 17:27 | Ron
    謝謝,很有幫助!
    在2.11.1版本中,啟動(dòng)文件路徑變?yōu)椋簄exus-2.11.1-01/bin/nexus  回復(fù)  更多評論
      

    <2013年11月>
    272829303112
    3456789
    10111213141516
    17181920212223
    24252627282930
    1234567

    常用鏈接

    留言簿(4)

    隨筆分類

    隨筆檔案

    文章檔案

    新聞分類

    新聞檔案

    相冊

    收藏夾

    Java

    Linux知識(shí)相關(guān)

    Spring相關(guān)

    云計(jì)算/Linux/虛擬化技術(shù)/

    友情博客

    多線程并發(fā)編程

    開源技術(shù)

    持久層技術(shù)相關(guān)

    搜索

    •  

    積分與排名

    • 積分 - 358598
    • 排名 - 154

    最新評論

    閱讀排行榜

    評論排行榜

    主站蜘蛛池模板: 亚洲中文字幕一二三四区苍井空| 亚洲欧洲日韩综合| 久99久无码精品视频免费播放| 亚洲精品国产福利一二区| a一级爱做片免费| 在线观看亚洲一区二区| 三年片在线观看免费观看高清电影| 国产亚洲玖玖玖在线观看| 国产一区视频在线免费观看 | 一个人看www免费高清字幕| 亚洲精品无码AV人在线播放| 午夜免费啪视频在线观看| 亚洲人成网站色在线观看| 亚洲国产成人五月综合网| 久久精品一本到99热免费| 天天综合亚洲色在线精品| 亚洲精品国产精品乱码在线观看| 中文字幕在线免费观看| 黄页视频在线观看免费| 亚洲欧洲日产专区| 中文字幕日韩亚洲| 国产国产人免费人成免费视频 | 免费无遮挡无码永久视频| 久久亚洲AV成人无码国产电影| 亚洲男人的天堂在线播放| 免费观看日本污污ww网站一区| 久久久久国色av免费看| 美女被羞羞网站免费下载| 亚洲网址在线观看| 久久亚洲国产伦理| 亚洲日本在线观看视频| 国产亚洲精品免费| 午夜两性色视频免费网站| 久久综合九色综合97免费下载| 一级特黄a免费大片| 亚洲AV成人无码久久WWW| 亚洲熟妇无码一区二区三区导航| 伊人久久综在合线亚洲2019| 日本红怡院亚洲红怡院最新| 亚洲综合色在线观看亚洲| 亚洲国产专区一区|