Chinaunix首页 | 论坛 | 博客
  • 博客访问: 11484193
  • 博文数量: 48
  • 博客积分: 7017
  • 博客等级: 少将
  • 技术积分: 2073
  • 用 户 组: 普通用户
  • 注册时间: 2006-08-24 09:50
文章分类

全部博文(48)

文章存档

2011年(4)

2010年(15)

2009年(15)

2008年(14)

我的朋友

分类: Java

2009-03-04 14:29:45

    公司最近有个驻外项目需要用到源码版本控制工具对项目开发版本进行控制,再此工具采用svn进行控制,版本:subversion-1.5.6.tar.gz,系统环境:redhat enterprise linux 5,开发工具MyEclipse 5.5.1 GA。
    本文将介绍:
      svn的安装配置;
      MyEclipse的svn插件安装;
      MyEclipse获取项目源码;
1.svn的安装配置:
  svn下载软件:
1.2.安装时没有采用apache于svn的整合,因此还需要用到apache的两个插件:
  apr、apr-util插件下载地址:
1.3.先安装apr、apr-util插件,再安装svn源码报。
 apr安装(解压等操作略,进入到解压后的目录):
#./configure --prefix=/usr/local/svnversion/apr
#make
#make install
apr-util安装(解压等操作略,进入到解压后的目录):
#./configure --prefix=/usr/local/svnversion/apr-util --with-apr=/usr/local/svnversion/apr
#make
#make install
svnversion安装(解压等操作略,进入到解压后的目录):
#./configure --prefix=/usr/local/svnversion/svn --with-apr=/usr/local/svnversion/apr --with-apr-util=/usr/local/svnversion/apr-util
#make
#make install
到此完成了所有软件的安装。
1.4 svn配置:
进入svn安装目录(/usr/local/svnversion):
首先创建一个工程的版本库:
#cd /usr/local/svnversion
#mkdir projects
#/usr/local/svnversion/svn/bin/svnadmin create projects/test_project
执行以上命令后,在projects目录下会生成一个test_project目录,并且这个目录会有一些svn自动生成的文件或文件夹。
#cd projects/test_project/conf
编辑svnserve.conf文件,找到如下内容:

[general]
### These options control access to the repository for unauthenticated
### and authenticated users.  Valid values are "write", "read",
### and "none".  The sample settings below are the defaults.
#anon-access = read
#auth-access = write
### The password-db option controls the location of the password
### database file.  Unless you specify a path starting with a /,
### the file's location is relative to the directory containing
### this configuration file.
### If SASL is enabled (see below), this file will NOT be used.
### Uncomment the line below to use the default password file.
#password-db = passwd
### The authz-db option controls the location of the authorization
### rules for path-based access control.  Unless you specify a path
### starting with a /, the file's location is relative to the the
### directory containing this file.  If you don't specify an
### authz-db, no path-based access control is done.
### Uncomment the line below to use the default authorization file.
#authz-db = authz
### This option specifies the authentication realm of the repository.
### If two repositories have the same authentication realm, they should
### have the same password database, and vice versa.  The default realm
### is repository's uuid.
# realm = My First Repository
修改为:

[general]
### These options control access to the repository for unauthenticated
### and authenticated users.  Valid values are "write", "read",
### and "none".  The sample settings below are the defaults.
anon-access = none
auth-access = write

### The password-db option controls the location of the password
### database file.  Unless you specify a path starting with a /,
### the file's location is relative to the directory containing
### this configuration file.
### If SASL is enabled (see below), this file will NOT be used.
### Uncomment the line below to use the default password file.
password-db = passwd
### The authz-db option controls the location of the authorization
### rules for path-based access control.  Unless you specify a path
### starting with a /, the file's location is relative to the the
### directory containing this file.  If you don't specify an
### authz-db, no path-based access control is done.
### Uncomment the line below to use the default authorization file.
authz-db = authz
### This option specifies the authentication realm of the repository.
### If two repositories have the same authentication realm, they should
### have the same password database, and vice versa.  The default realm
### is repository's uuid.
# realm = My First Repository
将svnserve.conf保存推出。
再修改该目录下的passwd文件,在该文件的最后追加一条记录,并保存退出:
[users]
# harry = harryssecret
# sally = sallyssecret
linux6 = 111111
之后修改该目录中的authz文件,找到如下内容:
### This file is an example authorization file for svnserve.
### Its format is identical to that of mod_authz_svn authorization
### files.
### As shown below each section defines authorizations for the path and
### (optional) repository specified by the section name.
### The authorizations follow. An authorization line can refer to:
###  - a single user,
###  - a group of users defined in a special [groups] section,
###  - an alias defined in a special [aliases] section,
###  - all authenticated users, using the '$authenticated' token,
###  - only anonymous users, using the '$anonymous' token,
###  - anyone, using the '*' wildcard.
###
### A match can be inverted by prefixing the rule with '~'. Rules can
### grant read ('r') access, read-write ('rw') access, or no access
### ('').
[aliases]
# joe = /C=XZ/ST=Dessert/L=Snake City/O=Snake Oil, Ltd./OU=Research Institute/CN=Joe Average
[groups]
# harry_and_sally = harry,sally
# harry_sally_and_joe = harry,sally,&joe
# [/foo/bar]
# harry = rw
# &joe = r
# * =
# [repository:/baz/fuz]
# @harry_and_sally = rw
# * = r
修改为:### This file is an example authorization file for svnserve.
### Its format is identical to that of mod_authz_svn authorization
### files.
### As shown below each section defines authorizations for the path and
### (optional) repository specified by the section name.
### The authorizations follow. An authorization line can refer to:
###  - a single user,
###  - a group of users defined in a special [groups] section,
###  - an alias defined in a special [aliases] section,
###  - all authenticated users, using the '$authenticated' token,
###  - only anonymous users, using the '$anonymous' token,
###  - anyone, using the '*' wildcard.
###
### A match can be inverted by prefixing the rule with '~'. Rules can
### grant read ('r') access, read-write ('rw') access, or no access
### ('').
[aliases]
# joe = /C=XZ/ST=Dessert/L=Snake City/O=Snake Oil, Ltd./OU=Research Institute/CN=Joe Average
[groups]
# harry_and_sally = harry,sally
# harry_sally_and_joe = harry,sally,&joe
g_svnadmin = linux6
# [/foo/bar]
# harry = rw
# &joe = r
# * =
# [repository:/baz/fuz]
# @harry_and_sally = rw
# * = r
[/]
@g_svnadmin = rw
linux6= rw
到此配置文件修改已完成。
下面启动svn服务:
#/usr/local/subversion/svn/bin/svnserve -d -r /usr/local/subversion/projects/test_project
接下来,只要往svn服务器中导入项目工程就可以使用了,这里我的工程放在/opt/web_project目录下,那么导入命令为:
#/usr/local/subversion/svn/bin/svn import /opt/web_project/ -m "Initial import"
其中,-m是添加注释。到此svn客户端就可以访问svn服务器了开始工作了。
java项目一般采用myeclipse进行开发,那么如何在其上集成svn呢,见下:
 
在线安装svn插件
打开myeslipse的菜单栏 Help-- Find and Install-- 按new Remote Site,
Name填 svn , URL填 ,一直next到finished为止
菜单栏 Window-- Show View-- other-- 选择打开SVN目录下的SVN资源库
新建-- 资源库位置, URL填http://svn.javascud.org/svn/springside/trunk
网速快的话,一会功夫svn就安装完成了。
 
 
阅读(1672) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~