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

Mac上eclipse安装SVN+JavaHL

2015-12-22 11:39 429 查看

前言

1.说明:MacPorts和HomeBrew是Mac OS X中的包管理器,类似于Ubuntu中的apt-get和Red Hat的yum,用于安装、卸载、更新软件等

2.要安装和运行MacPorts,必须要安装Xcode和Command Line Tools,那么就去Mac App Store下载安装Xcode,免费的,1.65个G。Xcode安装完,打开,点击Xcode-Preferences,切换到Downloads视图,点击下边Command
Line Tools后面的Install按钮进行安装。



3.Warning: The Xcode Command Line Tools don't appear to be installed; most ports will likely fail to build.

Warning: Install them by running `xcode-select --install'.    --安装The Xcode Command ,执行xcode-select --instal

4.打开JavaHL的Wiki文档:http://subclipse.tigris.org/wiki/JavaHL
subclipse与JavaHL的版本对应关系:



官方建议使用JavaHL作为client,稳定性,速度性都比SVNKit好很多



正文

解决:

        根据上图中得链接提示,跳转到http://www.macports.org/install.php下载MacPorts并安装。

然后将/opt/local/bin和/opt/local/sbin添加到$PATH搜索路径中
编辑/etc/profile文件中,加上

export PATH=/opt/local/bin:$PATH

export PATH=/opt/local/sbin:$PATH

MacPorts使用

更新ports tree和MacPorts版本,强烈推荐第一次运行的时候使用-v参数,显示详细的更新过程。
sudo port -v selfupdate   -- 如果没有/etc/profile的权限,直接切换到/opt/local/bin
执行命令(或者执行export):

devzkndeMacBook-Pro:bin
devzkn$ sudo ./port -v selfupdate



port 常用命令:

搜索索引中的软件
port search name

安装新软件
sudo port install name

卸载软件
sudo port uninstall name

查看有更新的软件以及版本
port outdated

升级可以更新的软件
sudo port upgrade outdated

Eclipse的插件需要subclipse需要JavaHL,下面通过MacPorts来安装

sudo
port install subversion-javahlbindings

devzkndeMacBook-Pro:bin
devzkn$ sudo ./port install subversion-javahlbindings



安装完之后,终端执行 sudo port install subversion-javahlbindings +no_bdb +universal
      如果出现错误:

Error: Port subversion-javahlbindings not found

      继续执行 sudo port -v selfupdate

 

以上步骤完成之后,即可重新启动eclipse,此时subclipse即可使用了。--

最后重启eclipse,在preferences->Team->svn里,若显示JavaHL的版本信息,说明成功了。

mac下eclipse的svn插件的安装

一、在Eclipse上安装svn插件有两种选择,一种是Subclipse,一种是Eclipse Subversion。前者是svn的官网eclipse插件,后者是eclipse的官方svn插件

这里就讲Subeclipse的安装方法:

1.安装Subeclipse很简单,只要上http://subclipse.tigris.org 找到Eclipse update site URL,然后在Eclipse里直接install就行了(现在最新  http://subclipse.tigris.org/update_1.8.x)

在eclipse中help--》install new software --》add 

我选择的subclipse最新的版本http://subclipse.tigris.org/update_1.8.x 

2.安装完Subclipse后重新启动Eclipse,然后会弹出提示说svn插件需要JavaHL的支持,

看了下其实在svn官网说明了(http://subclipse.tigris.org/servlets/ProjectProcess;jsessionid=F40FF3633F5E4229446A81759CCADE2E?pageID=p4wYuA)如下:

 

One or both of the following Subversion Client API providers must also be installed:
JavaHL - this is recommended as it is the API provided as part of Subversion itself.  See this wiki
page for more information.
SVNKit - this is a pure Java implementation of the Subversion API provided and supported by a 3rd
party.

二、下面就是搞定javaHL

具体了解和安装过程官网地址http://subclipse.tigris.org/wiki/JavaHL

网址中有用的其实就如下:


OS X

OSX comes with a SVN command line client, but unfortunately they do not include the JavaHL library.

The best thing to do is to install one of the OSX package managers for open-source software, such as MacPorts or HomeBrew.
If you are doing software development on OSX, you are going to eventually want or need different open-source Unix applications. So it is worth the effort to set one of these up and they make it easy for you to get Subversion and always have the latest version.
You will also have easy access to other open source applications via similar simple commands.

For MacPorts, the commands to run are:

 
sudo port install subversion-javahlbindings +no_bdb +universal


For HomeBrew the command is:

 
brew install --universal --java subversion


Pay attention to any post-install instructions related to creating a symlink in /Library/Java/Extensions. You need to follow these instructions so that the JavaHL library is available by default to the JVM.

(在http://www.macports.org/install.php下载MacPorts

在安装完MacPorts以后,在终端下执行下面的命令sudo port install subversion-javahlbindings +no_bdb +universal,安装javahl


最后重启eclipse,在preferences->Team->svn里,若显示JavaHL的版本信息,说明成功了。

总结

常见错误:

1.Warning: The Xcode Command Line Tools don't appear to be installed; most ports will likely fail to build.

会执行到:--->  Configuring python27 失败



安装The Xcode Command之后:



2.Incompatible JavaHL library loaded.  Subversion 1.7.x required.



这个错误是说不匹配的JavaHL版本被加载,需要的版本是1.7.x

我安装的是1.9.3

--->  Attempting to fetch subversion-javahlbindings-1.9.3_0+no_bdb+universal.darwin_14.i386-x86_64.tbz2 from http://packages.macports.org/subversion-javahlbindings


解决方法:



为了方便,我们把subclipse1.8.22卸载,换成1.12.x,这样就匹配了。

卸载subclipse步骤:打开eclipse,点击Eclipse-About Eclipse:

点击Installation Details按钮,选中与subclipse相关的选项,然后点击Uninstall按钮就可以卸载了。



eclipse中最常使用的SVN插件是subclipse,先到subclipse官网:http://subclipse.tigris.org下载该插件。

如上图,点击“Download and Install”转到下载页面。



接下来,有两种方式来安装subclipse,二选一即可。

一、

1、复制Eclipse update site URL:后边的链接:http://subclipse.tigris.org/update_1.12.x

2、打开eclipse,点击Help-Install New SoftWare,打开窗口:

二、

1、点击Zipped downloads后面的链接,将该插件下载到本地。

2、同上2

3、在name一栏中输入:subclipse ,点击Archive按钮,选择刚刚下载的插件包。

我选择了1进行安装;

Subclipse 1.8.x Update Site - http://subclipse.tigris.org/update_1.12.x


ok,



3.svn
up   冲突解决

Conflict discovered in 'test.txt'. 
Select: (p) postpone, (df) diff-full, (e) edit, 
        (mc) mine-conflict, (tc) theirs-conflict, 
        (s) show all options: 
svn detects that theres a conflict here and require you to take some kind of action. 

If you type ‘s’ here you will get a list of the commands and meaning 
如果你输入s选项,则会列出所有svn解决冲突的选项,如下所示: 

(e)  edit             - change merged file in an editor               #直接进入编辑 
(df) diff-full        - show all changes made to merged file          #显示更改至目标文件的所有变化 
(r)  resolved         - accept merged version of file 

(dc) display-conflict - show all conflicts (ignoring merged version)  #显示所有冲突 
(mc) mine-conflict    - accept my version for all conflicts (same)    #冲突以本地为准 
(tc) theirs-conflict  - accept their version for all conflicts (same) #冲突以服务器为准 

(mf) mine-full        - accept my version of entire file (even non-conflicts)#完全以本地为准 
(tf) theirs-full      - accept their version of entire file (same)    #完全以服务器为准 

(p)  postpone         - mark the conflict to be resolved later        #标记冲突,稍后解决 
(l)  launch           - launch external tool to resolve conflict 
(s)  show all         - show this list 

4..devzkndeMacBook-Pro:功能点
devzkn$ svn update

svn: E155036: 请参阅命令 'svn upgrade'
svn: E155036: The working copy at '/Users/devzkn/Documents/Projectdoc/MOT-NNCR-03642_和包客户端ios3.7'
is too old (format 29) to work with client version '1.9.3 (r1718519)' (expects format 31). You need to upgrade the working copy first.

 

 

解决方法:到co工程的根目录

devzkndeMacBook-Pro:MOT-NNCR-03642_和包客户端ios3.7 devzkn$ svn upgrade

已升级的“.”

否则找不到/.svn/entries

svn: E000002: 不能打开文件“/Users/devzkn/Documents/Projectdoc/MOT-NNCR-03642_和包客户端ios3.7/开发技术文档/.svn/entries”: No such file or directory

Kevin 16:38:45

 
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: