您的位置:首页 > 编程语言 > Java开发

阿里云SVN部署与EClipse使用整理

2015-04-11 17:08 113 查看



来源:/article/6222361.html

阿里云搭建SVN服务器

1:安装svn

apt-get install subversion

2. 开启svn服务器

svnserve -d

检查是否开启:ps aux | grep svnserve

若出现如下内容:

wkr 6537 0.0 0.0 13784 956 ? Ss 16:18 0:00 svnserve -d

wkr 7593 0.0 0.0 5784 864 pts/0 S+ 21:57 0:00 grep –color=auto svnserve

表示服务已开启。(注意:一定要有第1行,只有第2行说明服务未启动)

停止svn服务: killall svnserve

3. 建立仓库

svnadmin create /home/svnrepos

理论上,仓库可以建立在任何目录中。

注意:重启svnserve 执行 svnserve -d -r /home

这样在eclipse客户端把工程导入svn的时候 url需要填写

svn://ip/svnrepos/project_name

如果启动的时候带如下参数:svnserve -d -r /home/svnrepos

客户端:svn://ip/project_name 这样子会报错。验证失败

4. 修改配置文件

编辑 svnserve.conf

vi /home/svnrepos/conf/svnserve.conf

把anon-access = read 改为 none,auth_access = write

password-db = passwd authz-db = authz 的注释去掉,还有[general]的注释也要去掉(这个默认没有注释)。

注:当你去掉注释的时候,不要简单的把前面的#去掉,要把前面的空格一块去掉,不然在Eclipse中使用的时候会出现配置文件格式错误的问题。

注意:如果authz-db = authz 这个注释掉了,则不需要配置/home/svnrepos/conf/authz

5. 修改帐户文件

vi /home/svnrepos/conf/passwd

### This file is an example password file for svnserve.

### Its format is similar to that of svnserve.conf. As shown in the

### example below it contains one section labelled [users].

### The name and password for each user follow, one account per line.

[users]

# harry = harryssecret

# sally = sallyssecret

user1 = pass1 # 输入你定义的用户名和密码,密码显然没有加密

6. 修改授权文件

gedit /home/svnrepos/conf/authz

修改或者输入下面2行:

[svnrepos:/] ##格式为 版本库名称 + :/

user1 = rw

其中,repos1是仓库名称,user1是用户名,rw代表读写。

7.客户端连接

svn co svn://ip/oplinux

用户名密码:rsync

8.实现SVN与WEB同步,可以CO一个出来,也可以直接配在仓库中

1)设置WEB服务器根目录为/alidata/www/webroot

2)checkout一份SVN

svn co svn://localhost/alidata/www/svndata/myproject /alidata/www/webroot
修改权限为WEB用户

chown -R www:www /alidata/www/webroot/myproject
3)建立同步脚本

cd /alidata/www/svndata/oplinux/hooks/
cp post-commit.tmpl post-commit
编辑post-commit,在文件最后添加以下内容

export LANG=en_US.UTF-8
SVN=/usr/bin/svn
WEB=/alidata/www/webroot/
$SVN update $WEB –username myname –password myname
chown -R www:www $WEB
增加脚本执行权限

chmod +x post-commit
这样,我们上传svn后,生产站点就能立马显示出来了,自动化程度高了很多。

参照文章:http://blog.csdn.net/zjianbo/article/details/8577784

Eclipse SVN 安装

来源:http://blog.csdn.net/vebasan/article/details/6186344

一、给Eclipse安装SVN,最常见的有两种方式:手动方式和使用安装向导方式。具体步骤如下:

方式一:手动安装

1、从官网下载site-1.6.9.zip文件,网址是:subclipse.tigris.org

2、从中解压出features与plugins文件夹,复制到E:/MyEclipse/myPlugin/svn里面,其它的*.xml文件不要。

3、在E:/MyEclipse/MyEclipse X.X/dropins下新建文件svn.link,内容是:path=E://MyEclipse//myPlugin//svn 保存。

4、删除E:/MyEclipse/MyEclipse X.X/configuration/org.eclipse.update文件夹

5、重启myeclipse就一切正常了。

方式二:使用Eclipse安装向导

打开Eclipse

help->Software Updates->find and install(如果没有这个就用help->Software Updates->Add/Remove Software即可)

选择search for new features to install, Next

点击new remote site

输入name:subclipse 1.6.x,url:http://subclipse.tigris.org/update_1.6.x,点OK

或者:

Name: Subclipse 1.6.x (Eclipse 3.2+) URL: http://subclipse.tigris.org/update_1.6.x
Name: Subclipse 1.4.x (Eclipse 3.2+) URL: http://subclipse.tigris.org/update_1.4.x
Name: Subclipse 1.2.x (Eclipse 3.2+) URL: http://subclipse.tigris.org/update_1.2.x
Name: Subclipse 1.0.x (Eclipse 3.0/3.1) URL: http://subclipse.tigris.org/update_1.0.x
选中subclipse,点击finish

一直NEXT,这里注意下,有些时候会出现 Subclipse Integration for Mylyn 3.x (Optional) (3.0.0) requires plug-in "org.eclipse.mylyn.tasks.core (3.0.0)", or compatible.错误,这个不要紧,在弹出框中选择subclipse,把Subclipse Integration for Mylyn 3.x选项去掉即可

Next一路安装完成!

二、Eclipse中使用SVN(以MyEclipse8.0为例)

1、共享项目(把本地的项目共享到subversion服务器上)

打开MyEclipse8.0,假设要共享projTest是项目名称

右键项目projTest->Team->Share Project->Svn,

单库模式下url填写svn://svn server address/,多库模式下url填写svn://svn server address/Repository1,其中Repository1是库的名称

next直到finish,proj1就被共享到svn服务器上了,但是代码并没上传,还需要commit一次

右键项目projTest,team->commit,项目内容就被上传到svn服务器了

2、签出项目(把svn服务器上的项目下载的到本地)

打开MyEclipse8.0

window->open perspective->svn repository explorer(如果没有在other里选择)

在左边空白处右键->new->repository location

单库模式下url填写svn://svnserveraddress/,多库模式下url填写svn://svnserveraddress/Repository1(同步骤二)

右键projTest->check out

next直到finish,该项目就被签出到本地,切换到java视图就能看到该项目了
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: