小男孩‘自慰网亚洲一区二区,亚洲一级在线播放毛片,亚洲中文字幕av每天更新,黄aⅴ永久免费无码,91成人午夜在线精品,色网站免费在线观看,亚洲欧洲wwwww在线观看

分享

Linux下使用Nexus做Maven倉庫管理

 richsky 2013-10-29

一:JDK

1.Installation

  • Download the lasted version of the JDK from: http://java. ,now is JDK1.7.0_10.
  • Unpack the arcive to /usr/lib/jvm/java with the below command line:

         tar -zxvf jdk-7u10-linux-i586.tar.gz

2. Set java environment variable

# vi /etc/profile

# This is added by selina for set java environment:

JAVA_HOME=/usr/lib/jvm/java/jdk1.7.0_10

JRE_HOME=/usr/lib/jvm/java/jdk1.7.0_10/jre

export JAVA_HOME

export JRE_HOME

export PATH=$JAVA_HOME/bin:$JRE_HOME/bin:$PATH

export CLASSPATH=.:$JAVA_HOME/lib:$JRE_HOME/lib:$CLASSPATH

# end of set java environmnet

save and exit.

# source /etc/profile //with immediate effect

# java -version or echo $JAVA_HOME

check whether take effect :logout then

# java -version or echo $JAVA_HOME

 

二:Maven

1.Installation

  • Download the lasted version of the Maven from http://maven./download.html ,now is 3.0.4 .
  • Unapack the archive to /usr/local with beow the command line :
  •        tar -zxvf  apache-maven-3.0.4-bin.tar.gz
  • rename apache-maven-3.0.as maven3
  •      mv apache-maven-3.0.4 maven3

2.Set Maven environment variable

# vi /etc/profile

 # This is added by selina for set Maven environment:

MAVEN_HOME=/usr/local/maven3

export MAVEN_HOME

export PATH=$MAVEN_HOME/bin:$PATH

# end of set java environmnet

save and exit.

# source /etc/profile //with immediate effect

mvn -v or echo $MAVEN_HOME

check whether take effect :logout then

# mvn -v or echo $MAVEN_HOME

Note that if you use "mvn -v" to see ,will show maven and jave version info indicate that successfully installed and configured.

 

三:Nexus

1.Installation

Download the lasted version of the Nexus from http://nexus./downloads/ ,now is nexus-2.2-01.

Unpack the archive to /usr/local with the below command line

   tar -zxvf nexus-2.2-01-bundle.tar.gz

and remane to nexus2 with the below command line

   mv nexus-2.2-01-bundle nexus2

2. Run Nexus

$ cd /usr/local/nexus2/bin/jsw/linux-x86-32

$ ./nexus start (restart/stop...) # use ordinary account not root

if successd ,Go to browser http://ip:8081/nexus ,account and passowd is admin and admin123

(if you want to change port number ,pls go to ./nexus2/conf/nexus.properties to set ,the default is 8081)

issues:

(1)if successfully installed ,will show :

       Starting Nexus OSS...

      Stared Nexus OSS

But ,after installing nexus ,excute command "./nexus start" failed ,show the below message:

       Starting Nexus OSS...

      Failed to start Nexus OSS.

Solution : this is casued by priviledge of nexus directory ,it belongs to root user .After change the owner of the nexus directory to the current user ,rerun the command "./nexus start",it works.

sudo chown -R selina:selina ../../nexus

(2)Can't browser

when http://ip:8081/nexus ,failed ,need to see log message from: ./nexus/logs/wrapper.log ,show "Unable to start JVM: No such file or directory" in here ,

Solution : editing "<nexus_root>/bin/jsw/conf/wrapper.conf" and changing "wrapper.java.commad" the full path to my java executable

wrapper.java.commad={JAVA_HOME}/bin/java

Again to http://ip:8081/nexus ,failed ,see log message ,show " error..Temp directory:/usr/lcoal/sonatype-work/nexus/tmp "

Solution : chmod -R 777 /usr/local/sonatype-work/nexus/tmp

 

 Congratulations ,well done.Click the "Login In" on the top right corner.the default username is admin ,password is admin123.Linux下使用Nexus做Maven倉庫管理

登錄后最重要的事情就是打開遠(yuǎn)程索引下載,操作為選擇菜單Administrator->Repositories,然后在右邊打開的列表中依次選擇type字段為proxy的記錄,在下方的編輯區(qū)中修改"Download Remote Indexes"值為true,再從這三個(gè)倉庫上點(diǎn)右鍵選擇"Reapir Index",這一步別忘,Repair Index后,Nexus會(huì)從后臺(tái)去官方地址下載倉庫索引文件,大概20M大小,根據(jù)網(wǎng)速快慢下載相應(yīng)時(shí)間后選擇倉庫時(shí)會(huì)以樹形目錄的方式顯示倉庫內(nèi)容。(注意:如果repaire-index后,在“browser index"里仍然看不到東西,要確定/usr/lcoal/sonatype-work/nexus目錄是否有寫權(quán)限 )Central的"Remote storage location"默認(rèn)的是http://repo1./maven2,因這是國外網(wǎng)站,忒慢,如此找到了以下這個(gè)源鏡像:http://repo.maven./maven2Linux下使用Nexus做Maven倉庫管理想要maven使用剛剛配置的nexus服務(wù)作為倉庫服務(wù)器需要修改settings.xml文件。

在maven中存在兩個(gè) settings.xml,一個(gè)位于maven2的安裝目錄conf下面,作為全局性配置。對(duì)于團(tuán)隊(duì)設(shè)置,保持一致的定義是關(guān)鍵,所以 maven/conf下面的settings.xml就作為團(tuán)隊(duì)共同的配置文件。保證所有的團(tuán)隊(duì)成員都擁有相同的配置。當(dāng)然對(duì)于每個(gè)成員,都需要特殊的 自定義設(shè)置,如用戶信息,所以另外一個(gè)settings.xml就作為本地配置。默認(rèn)的位置為:${HOME} /.m2/settings.xml目錄
 

<settings> 
<!--<localRepository>這個(gè)是存放eclipse項(xiàng)目需要費(fèi)用的jar包(在eclipse項(xiàng)目添加maven依賴的時(shí)候,eclipse自動(dòng)從nexus服務(wù)器中下載jar包,然后存到這個(gè)路徑,默認(rèn)路徑是~/.m2/repository,可以不修改-->
  <localRepository>/resource/java/repos/maven-repo</localRepository>

<servers> 
      <server> 
         <!-- 這是server的id(注意不是用戶登陸的id),該id與pom.xml 中distributionManagement中repository元素的id相匹配。--> 
         <!--遠(yuǎn)程nexus 服務(wù)器的用戶名與密碼,作用就是當(dāng)要向nexus deploy 自已寫的jar 時(shí),會(huì)用到在pom.xml 中distributionManagement ,在那里會(huì)引用此處的id --> 
         <id>releases</id> 
         <username>admin</username> 
         <password>admin123</password> 
</server>
 <server> 
         <id>snapshots</id> 
         <username>admin</username> 
         <password>admin123</password> 
</server>
</servers> 

<mirrors>
<mirror>
      <!--This sends everything else to /public -->
     <!--該鏡像的唯一標(biāo)識(shí)符。id用來區(qū)分不同的mirror元素。 -->
     
      <id>nexus</id>
      <!--該鏡像的URL。構(gòu)建系統(tǒng)會(huì)優(yōu)先考慮使用該URL,而非使用默認(rèn)的服務(wù)器URL --> 
      <url>http://localhost:8081/nexus/content/groups/public</url>
      <!--被鏡像的服務(wù)器的id。例如,如果我們要設(shè)置了一個(gè)Maven中央倉庫http://repo1./maven2)的鏡像,就需要將該元素設(shè)置成central。這必須和中央倉庫的id central完全一致。 --> 
            <mirrorOf>central</mirrorOf> 

 </mirror>
</mirrors>

<profiles>
<!--個(gè)性配置。類似于pom.xml中的profile元素。單獨(dú)定義profile后,并不會(huì)生效,需要通過滿足條件來激活-->
<profile>
     <!--該配置的唯一標(biāo)識(shí)符。 -->  
     <id>development</id>  
      <repositories>  
         <!--包含需要連接到遠(yuǎn)程倉庫的信息 -->       
         <repository>
            <!--遠(yuǎn)程倉庫唯一標(biāo)識(shí)-->          
            <id>central</id>          
            <name>local private nexus</name>             
           <url>http://127.0.0.1:8081/nexus/content/groups/public</url>                     
             <!--如何處理遠(yuǎn)程倉庫里發(fā)布版本的下載-->            
             <releases><enabled>true</enabled></releases>
             <snapshots><enabled>false</enabled></snapshots>
        </repository>     
      </repositories>    
      <pluginRepositories>   
        <pluginRepository>        
           <id>central</id>           
           <name>local private nexus</name>     
           <url>http://127.0.0.1:8081/nexus/content/groups/public</url>                                      <releases><enabled>true</enabled></releases>         
           <snapshots><enabled>false</enabled></snapshots>      
       </pluginRepository>   
    </pluginRepositories>
</profile>
</profiles>
<activeProfiles>
    <activeProfile>development</activeProfile>
</activeProfiles>
</settings>


然后,在從你的工程里的pom.xml中加入以下內(nèi)容:

 
<distributionManagement>
 <repository>
<!--ID要與maven中的setting.xml中的ID一致-->
  <id>releases</id>
  <name>Nexus Release Repo</name>
  <url>http://localhost:8081/nexus/content/repositories/releases</url>
 </repository>
 <snapshotRepository>
<!--ID要與maven中的setting.xml中的ID一致-->
  <id>snapshots</id>
  <name>snapshots</name>
  <url>http://localhost:8081/nexus/content/repositories/snapshots</url>
 </snapshotRepository>
</distributionManagement>


網(wǎng)絡(luò)其它好文章鏈接:http://my.oschina.net/aiguozhe/blog/101537 

  

 

 

    本站是提供個(gè)人知識(shí)管理的網(wǎng)絡(luò)存儲(chǔ)空間,所有內(nèi)容均由用戶發(fā)布,不代表本站觀點(diǎn)。請注意甄別內(nèi)容中的聯(lián)系方式、誘導(dǎo)購買等信息,謹(jǐn)防詐騙。如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請點(diǎn)擊一鍵舉報(bào)。
    轉(zhuǎn)藏 分享 獻(xiàn)花(0

    0條評(píng)論

    發(fā)表

    請遵守用戶 評(píng)論公約

    類似文章 更多