一:JDK
1.Installation
2. Set java environment variable
# vi /etc/profile
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
save and exit.
# source
/etc/profile
# java -version or echo $JAVA_HOME
check whether take effect :logout then
# java -version or echo $JAVA_HOME
二:Maven
1.Installation
2.Set Maven environment variable
# vi /etc/profile
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
#
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.sonatype.org/downloads/
Unpack
and remane to nexus2 with the below command line
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 :
But ,after installing nexus ,excute command "./nexus start" failed ,show the below message:
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
Solution
:
wrapper.java.commad={JAVA_HOME}/bin/java
Again
to http://ip:8081/nexus
Solution : chmod -R 777 /usr/local/sonatype-work/nexus/tmp
登錄后最重要的事情就是打開遠程索引下載,操作為選擇菜單Administrator->Repositories,然后在右邊打開的列表中依次選擇type字段為proxy的記錄,在下方的編輯區(qū)中修改"Download
Remote Indexes"值為true,再從這三個倉庫上點右鍵選擇"Reapir Index",這一步別忘,Repair
Index后,Nexus會從后臺去官方地址下載倉庫索引文件,大概20M大小,根據(jù)網(wǎng)速快慢下載相應時間后選擇倉庫時會以樹形目錄的方式顯示倉庫內容。(注意:如果repaire-index后,在“browser
index"里仍然看不到東西,要確定/usr/lcoal/sonatype-work/nexus目錄是否有寫權限
)Central的"Remote storage location"默認的是http://repo1.maven.org/maven2,因這是國外網(wǎng)站,忒慢,如此找到了以下這個源鏡像:http://repo.maven.apache.org/maven2想要maven使用剛剛配置的nexus服務作為倉庫服務器需要修改settings.xml文件。
在maven中存在兩個
settings.xml,一個位于maven2的安裝目錄conf下面,作為全局性配置。對于團隊設置,保持一致的定義是關鍵,所以
maven/conf下面的settings.xml就作為團隊共同的配置文件。保證所有的團隊成員都擁有相同的配置。當然對于每個成員,都需要特殊的
自定義設置,如用戶信息,所以另外一個settings.xml就作為本地配置。默認的位置為:${HOME}
/.m2/settings.xml目錄
<settings>
<!--<localRepository>這個是存放eclipse項目需要費用的jar包(在eclipse項目添加maven依賴的時候,eclipse自動從nexus服務器中下載jar包,然后存到這個路徑,默認路徑是~/.m2/repository,可以不修改-->
<servers>
</server>
</server>
</servers>
<mirrors>
<mirror>
</mirrors>
<profiles>
<!--個性配置。類似于pom.xml中的profile元素。單獨定義profile后,并不會生效,需要通過滿足條件來激活-->
<profile>