JAVA应用技术之服务器搭建

1.配置Maven目录
    安装maven其实很简单,就像安装绿化软件一样将其下载,然后解压缩,就可以了。 然后将%maven_home%/bin写入path文件即可。 在这里我主要是讲一下如何修改.m/repository文件的路径,即maven默认jar,source源文件库的存放目录。打开%maven_home%/conf目录下的settings.xml文件,查找到localRepository标签段,我这里修改为如下所示:
<!-- localRepository
   | The path to the local repository maven will use to store artifacts.
   |
   | Default: ~/.m2/repository
   
  -->
  <localRepository>E:/repo/repository</localRepository>

这样那些文件就不会自动下载到C:\Users\LONMID\.m2\repository,而是下载到我指定的E:\repo\repository下面.

2.SVN,Hudon,Sonar 代码质量保证和持续部署
  它们的安装过程略。
所有的过程搭建成功后,运行分别svn, hudson,sonar,
svn:         
                  svnserve -d -r f:\svn_test
hudson:     
                  cd   /d    E:\hudson
                   java -jar hudson.war
(注意,如果你要修改hudson的端口的话,则使用

java -jar hudson.war --httpPort=

8088

--ajp13Port=

18009

  

)
sonar:      
                   StartSonar.bat

在地址栏中输入:    http://192.168.17.24:9000
如下所示:

捕获60.PNG


然后在地址栏中输入: http://192.168.17.24:8080



如下所示:

捕获61.PNG





点击运行,如下所示:

捕获62.PNG



3.迁移nexus至新的服务器中
首先,修改 repository目录下面的setting.xml文件,
如下所示:

  1.   <mirror>
  2.                   <id>Nexus</id>
  3.                   <name>Nexus Public Mirror</name>
  4.                   <url>http://192.168.17.24:8081/nexus/content/groups/public</url>
  5.                   <mirrorOf>central</mirrorOf>
  6.      </mirror>



  7. <profile>  
  8.        <id>nexus</id>  
  9.        <repositories>  
  10.          <repository>  
  11.              <id>nexus</id>  
  12.              <name>local private nexus</name>  
  13.              <url>http://192.168.17.24:8081/nexus/content/groups/public</url>  
  14.          </repository>  
  15.        </repositories>  
  16.      </profile>
复制代码

修改标注的部分即可。
然后修改你项目的顶级pom.xml文件。pom.xml,以智能路灯的顶级pom.xml为例,如下所示:


  1. <distributionManagement>
  2.                 <repository>
  3.                         <id>releases</id>
  4.                         <name>Releases</name>
  5.                         <url>http://192.168.17.24:8081/nexus/content/repositories/releases</url>
  6.                 </repository>
  7.                 <snapshotRepository>
  8.                         <id>snapshots</id>
  9.                         <name>Snapshots</name>
  10.                         <url>http://192.168.17.24:8081/nexus/content/repositories/snapshots</url>
  11.                 </snapshotRepository>
  12.         </distributionManagement>
复制代码


再者,运行nexus,如下命令:
         Startnexus.bat

然后在控制台中输入: 
http://192.168.17.24:8081/nexus/index.html , 并且输入帐号和密码:
admin/admin123

如下图所示:

捕获63.PNG




然后在本地运行 :
                            mvn deploy

即可将所有jar包上传至私服,如果要上传source jar包的话,则需要使用如下命令:
mvn  deploy:deploy-file
-DgroupId=com.nfschina
-DartifactId=com.nfschina.qo.pm.domain.compact
-Dversion=1.0-SNAPSHOT
-Dpackaging=jar 
-Dfile=target/com.nfschina.qo.pm.domain.compact-1.0-SNAPSHOT-sources.jar
-Durl=http://192.168.17.24:8081/nexus/content/repositories/snapshots
-DrepositoryId=snapshots 
-Dclassifier=sources

然后就可以用网页浏览我们所创建的私服务器数据了,在地址栏中输入: http://192.168.17.24:8081/nexus/content/groups/public/

(注意:我们也可以修改nexus的默认端口,在E:\nexus\nexus-oss-webapp-1.9.2.4\conf目录下的plexus.properties)
application-port=8081
application-host=0.0.0.0
runtime=${basedir}/runtime
apps=${runtime}/apps
nexus-work=${basedir}/../sonatype-work/nexus
nexus-app=${runtime}/apps/nexus
webapp=${runtime}/apps/nexus/webapp
webapp-context-path=/nexus
security-xml-file=${nexus-work}/conf/security.xml
application-conf=${nexus-work}/conf
runtime-tmp=${runtime}/tmp

# If this file is present, it will be used to configure Jetty.
jetty.xml=${basedir}/conf/jetty.xml

# Uncomment this to use the debug js files
#index.template.file=templates/index-debug.vm

如下所示:

捕获64.PNG






参考网址:  http://michael-tuan.iteye.com/blog/375686
                   http://hi.baidu.com/tk_ayj/blog/item/b5865bce8dbff236f9dc6124.html
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值