linux下安装SVN和MAVEN,并依赖MAVEN环境打包MAVEN项目
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了linux下安装SVN和MAVEN,并依赖MAVEN环境打包MAVEN项目相关的知识,希望对你有一定的参考价值。
一、前提条件
系统环境为:
[[email protected] application]# cat /etc/redhat-release
CentOS release 6.7 (Final)
[[email protected] application]# uname -r
2.6.32-573.el6.x86_64
需要准备的安装包为:
subversion-1.6.1.tar.gz
subversion-deps-1.6.1.tar.gz
apache-maven-3.3.3-bin.tar.gz
二、SVN部分
[[email protected] application]# pwd
/application
#上传subversion-1.6.1.tar.gz和subversion-deps-1.6.1.tar.gz到此目录下
[[email protected] application]# tar xf subversion-1.6.1.tar.gz
[[email protected] application]# tar xf subversion-deps-1.6.1.tar.gz
#创建编译路径
[[email protected] application]# mkdir subversion
[[email protected] application]# ls -ld subversion
drwxr-xr-x 2 root root 4096 Sep 1 11:46 subversion
[[email protected] application]# cd subversion-1.6.1
[[email protected] subversion-1.6.1]#./configure --prefix=/application/subversion
checking openssl/opensslv.h usability... no
checking openssl/opensslv.h presence... no
checking for openssl/opensslv.h... no
configure: error: We require OpenSSL; try --with-openssl
configure failed for serf
#如果编译结束出现上述错误,那么需要安装下述软件之后再次编译
[[email protected] subversion-1.6.1]# yum install openssl openssl-devel -y
[[email protected] subversion-1.6.1]#make && make install
[[email protected] subversion-1.6.1]#cd /application/subversion/bin
[[email protected] bin]# svnserve --version
svnserve, version 1.6.11 (r934486)
compiled Jul 23 2015, 23:48:52
Copyright (C) 2000-2009 CollabNet.
Subversion is open source software, see http://subversion.tigris.org/
This product includes software developed by CollabNet (http://www.Collab.Net/).
The following repository back-end (FS) modules are available:
* fs_base : Module for working with a Berkeley DB repository.
* fs_fs : Module for working with a plain file (FSFS) repository.
Cyrus SASL authentication is available.
[[email protected] bin]# cd /application/
[[email protected] application]# ln -s /application/subversion /application/svn
[[email protected] application]# ls svn/
bin build-1 include lib share
[[email protected] application]# echo "PATH=/application/svn/bin:$PATH" >> /etc/profile
[[email protected] application]# svnserve --version
[[email protected] application]# tail -1 /etc/profile
PATH=/application/svn/bin:/application/maven/bin:/application/jdk/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin:/root/bin
[[email protected] application]# source /etc/profile
[[email protected] application]# svnserve --version
#创建SVN版本库
[[email protected] application]# mkdir /application/svnrepos -p
[[email protected] application]# svnadmin create /application/svnrepos
#修改SVN版本库配置文件
[[email protected] application]# cd svnrepos
[[email protected] svnrepos]# ls
conf db format hooks locks README.txt
[[email protected] svnrepos]# cd conf/
[[email protected] conf]# cp svnserve.conf svnserve.conf.ori
[[email protected] conf]# egrep "anon-access|auth-access|password-db" /application/svnrepos/conf/svnserve.conf
# anon-access = read
anon-access = none#使非授权用户无法访问
# auth-access = write
auth-access = write#使授权用户有写权限
### The password-db option controls the location of the password
# password-db = passwd
password-db = passwd#指明密码文件路径
#修改SVN版本库用户
[[email protected] conf]# cp passwd passwd.ori
#在最下面按照格式加入svn的用户名和密码
[[email protected] conf]# grep username passwd
username = password
#创建自定义存放项目的路径
[[email protected] conf]# mkdir /home/sourceCode -p
[[email protected] conf]# cd home/
[[email protected] home]# svn co svn://IP/java/jy_cps/jy-cps-parent /home/sourceCode
[[email protected] home]# ls sourceCode/
jy-cps-parent
[[email protected] home]# ls sourceCode/jy-cps-parent/
jy-cps-common jy-cps-mis pom.xml
三、MAVEN部分
#上传apache-maven-3.3.3-bin.tar.gz
[[email protected] application]# tar xf apache-maven-3.3.3-bin.tar.gz
[[email protected] application]# ln -s /application/apache-maven-3.3.3 /application/maven
#注意此处的maven版本必须是JDK1.7,maven版本和java版本的使用参照图请参考http://maven.apache.org/docs/history.html
[[email protected] application]# /application/maven/bin/mvn -version
Apache Maven 3.3.3 (7994120775791599e205a5524ec3e0dfe41d4a06; 2015-04-22T19:57:37+08:00)
Maven home: /application/maven
Java version: 1.7.0_79, vendor: Oracle Corporation
Java home: /application/jdk1.7.0_79/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "2.6.32-573.el6.x86_64", arch: "amd64", family: "unix"
[[email protected] application]# echo "PATH=/application/maven/bin:$PATH" >> /etc/profile
[[email protected] application]# tail -1 /etc/profile
PATH=/application/svn/bin:/application/maven/bin:/application/jdk/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin:/root/bin
[[email protected] application]# mvn -version
#创建本地maven仓库(放置maven项目依赖的jar包,因为在maven项目编译的时候,会到这个目录里来查找,如果没找到对应的jar包,那么会到maven私服或互联网maven仓库中下载)
[[email protected] application]# cd /home/
[[email protected] home]# mkdir /home/warehouse -p
#上传windows本地maven仓库的jar包到这个目录下
[[email protected] warehouse]# ls
aopalliance classworlds commons-beanutils commons-codec commons-io commons-logging javax log4j net stax xpp3
c3p0 com commons-cli commons-fileupload commons-lang dom4j junit mysql org xml-apis
[[email protected] warehouse]# ls commons-io/commons-io/2.4/commons-io-2.4.jar
commons-io/commons-io/2.4/commons-io-2.4.jar
#编译maven项目
[[email protected] warehouse]# cd /home/sourceCode/jy-cps-parent/jy-cps-mis/
[[email protected] jy-cps-mis]# mvn clean install
[[email protected] jy-cps-mis]# ls
doc pom.xml src target
#最终会生成对应的war包
[[email protected] jy-cps-mis]# ls target/jy-cps-mis-0.0.1-SNAPSHOT.war
target/jy-cps-mis-0.0.1-SNAPSHOT.war
#关于maven私服的搭建与maven项目的介绍与部署请参考我的另两篇博文:
http://ylcodes01.blog.51cto.com/5607366/1771650
http://ylcodes01.blog.51cto.com/5607366/1774050
本文出自 “你可以选择不平凡” 博客,请务必保留此出处http://ylcodes01.blog.51cto.com/5607366/1845228
以上是关于linux下安装SVN和MAVEN,并依赖MAVEN环境打包MAVEN项目的主要内容,如果未能解决你的问题,请参考以下文章