Page 1 of 4 123 ... LastLast
Results 1 to 10 of 36

Thread: HOWTO : Subversion & Eclipse development environment

  1. #1
    Join Date
    May 2005
    Location
    Amsterdam
    Beans
    33
    Distro
    Ubuntu 8.04 Hardy Heron

    HOWTO : Subversion & Eclipse development environment

    # All the modified or additional information will be updated on this post in order for everyone to get alwasys up-to date information.

    # After you've done this, some of you might need tomcat5 + Apache2 set up.
    # I also wrote the article here, so please have a look.


    Here is the how-to for setting up the subversion client with eclipse and the server. Hope this will help you more productive coding

    First of all, regarding "Subversion" For more detail, please refer to http://en.wikipedia.org/wiki/Subversion_(software)
    Here is the snipet about the difference between CVS & Subversion.
    Subversion was created as a replacement for CVS. Its improvements include:
    * Atomic commits. Interrupted commit operations do not cause repository inconsistency or corruption.
    * Renamed/copied/moved/removed files retain full revision history.
    * Native support for binary files, with space-efficient binary-diff storage.
    * Directories are versioned. Entire directory trees can be moved around and/or copied very quickly, and retain full revision history.
    * Constant time branching and tagging.
    * Optimized repository accesses. This reduces unnecessary network traffic to the repository host.
    * Full MIME support - the MIME Type of each file can be viewed or changed, with the software knowing which MIME types can have their differences from previous versions shown.
    "Eclipse" is a Integrated Development Environment which provides the platform of developing Java/C++ ..etc. You can add the support language by adding plugin.

    Now let's get started to prepare the development environment for Ubuntu (Dapper).

    [Client - Eclipse with plugin]
    Assume that you have already installed eclipse & j2sdk1.5-sun.
    If you face problem starting up the eclipse you can find the answer in this forum. Most likely it is related to "java_home". Just for the instant check
    Code:
    cd /etc/eclipse
    cat java_home
    If you don't see /usr/lib/j2sdk1.5-sun/ commented out in the first line, modify it. Mine looks like this..
    Code:
    ubuntu% cat java_home
    # This file determines the search order the Eclipse Platform uses to find a
    # compatible JAVA_HOME. This setting may be overridden on a per-user basis by
    # altering the JAVA_HOME setting in ~/.eclipse/eclipserc.
    /usr/lib/j2sdk1.5-sun/
    #/usr/lib/jvm/java-gcj
    #/usr/lib/kaffe/pthreads
    #/usr/lib/sablevm
    #/usr/lib/fjsdk
    #/usr/lib/j2se/1.5
    #/usr/lib/j2se/1.4
    #/usr/lib/j2sdk1.5-ibm
    #/usr/lib/j2sdk1.4-ibm
    #/usr/lib/j2sdk1.5-sun
    #/usr/lib/j2sdk1.4-sun
    Ok then , let's get started.
    Step1: Installing the plug-in (subclipse)
    Launch eclipse and go to :
    help->s/w updates ->find and install->search for new features
    Then press "new remote site" and add "http://subclipse.tigris.org/update"
    Then follow the instraction to install the plugin.

    Step2: Install library needed for subversion from eclipse
    Code:
    sudo apt-get install libsvn-javahl
    Step3: Grance at subversion perspective
    Follow this then you can see the svn perspective
    window->Opne Perspective-> Other->SVN Repository Explorer

    If you already have subversion server running, you can access to it by right clicking svn repository explorer then
    new -> create remote folder

    [Server - Subversion]
    There are 2 simple ways to use subversion. One is using subversion function over WebDav and another is subversion server using specific protocol. First I'll explain about the WebDav way.

    Step1: Install subversion package [WebDav]
    Code:
     sudo apt-get install subversion subversion-helper-scripts subversion-tools 
    sudo apt-get install apache2 libapache2-svn
    Step2: Create repository folder & bind it to subversion.
    Code:
    sudo mkdir -p /var/local/svn
    sudo svnadmin create --fs-type fsfs /var/local/svn
    sudo chown -R www-data:www-data /var/local/svn
    Step3: Set configuration for apache2 subversion module
    Code:
    sudo vi/etc/apache2/mods-enabled/dav_svn.conf
    --
    #Comment out the following 2 lines with your repo path
    #DAV svn <-Comment out this
    DAV svn
    
    #SVNPath /var/lib/svn <-Comment out this
    SVNPath /var/local/svn
    
    <LimitExcept GET PROPFIND OPTIONS REPORT>
    #Require valid-user <-Comment this if you don't need basic authentication
    Options Indexes
    Order allow,deny
    allow from all
    </LimitExcept>
    Tip1 - Basic Authentication
    In order to use basic authentication for loging on to subversion server, you need to do the followings.
    Code:
    sudo vi/etc/apache2/mods-enabled/dav_svn.conf
    # comment the following 4 lines
       AuthType Basic
       AuthName "Subversion Repository"
       AuthUserFile /etc/apache2/dav_svn.passwd
      <LimitExcept GET PROPFIND OPTIONS REPORT>
        Require valid-user
        Options Indexes
        Order allow,deny
        allow from all
      </LimitExcept>
    Then create the user account
    Code:
    #-m option for MD5 encryption of the password
    sudo htpasswd2 -cm /etc/apache2/dav_svn.passwd cavalier1 
    New password: ***** 
    Re-type new password: *****
    Adding password for user cavalier1
    $ htpasswd -m /etc/apache2/dav_svn.passwd cavalier2
    New password: *******
    Re-type new password: *******
    Adding password for user cavalier2
    Now you can access to it with basic authentication.

    Tip2 - SSL access
    Code:
    # Create ssl certificate
    # certificate will be stored at /etc/apache2/ssl
    sudo apache2-ssl-certificate
    
    # Copy conf file for ssl
    sudo cp /usr/share/apache2/config/default-443 /etc/apache2/sites-available
    First conf file for port 80
    Code:
    # Edit conf file
    sudo vim /etc/apache2/sites-available/default
    --
    #Comment following and set proper one
    # NameVirtualHost *
    NameVirtualHost *:80
    
    # <VirtualHost *>
    <VirtualHost *:80>
    Ok then conf file for port 443 (ssl)
    Code:
    sudo vim /etc/apache2/sites-available/default-443
    --
    # Find the following lines and comment out and set the appropriate ones
    # SSLCertificateFile    /etc/apache2/sites/::SERVERNAME::-ssl.crt
    SSLCertificateFile    /etc/apache2/ssl/apache.pem
    
    # SSLCertificateKeyFile /etc/apache2/sites/::SERVERNAME::-ssl.key
    SSLCertificateKeyFile /etc/apache2/ssl/apache.pem
    
    # ServerAdmin ::SERVERADMIN::
    ServerAdmin Cavalierski
    
    # ServerName ::SERVERNAME::
    ServerName www.yourdomain.com
    
    # DocumentRoot /var/vhosts/::VHOSTNAME::/htdocs-443
    DocumentRoot /var/www
    
    # <Directory /var/vhosts/::VHOSTNAME::/htdocs-443>
    <Directory /var/www>
    
    # ErrorLog /var/vhosts/::VHOSTNAME::/logs/error.log-443
    ErrorLog /var/log/apache2/error.log-443
    
    # CustomLog /var/vhosts/::VHOSTNAME::/logs/access.log-443 combined
    CustomLog /var/log/apache2/error.log-443 combined
    
    # I deleted the cgi lines as I don't need them. That's all for conf file.
    --
    # Enable ssl module
    sudo a2enmod ssl
    # Enable ssl config
    sudo a2ensite default-443
    
    # Open the port for ssl
    sudo vim /etc/apache2/ports.conf
    # Add the following line
    Listen 443
    Then reload the setting.
    Code:
    sudo /etc/init.d/apache2 reload
    It's done. You can access to it with "http://your server name/svn".
    or
    If you've done ssl part "https://your server name/svn".
    ----
    Step1: Install subversion package[svn Server]
    Code:
     sudo apt-get install subversion subversion-helper-scripts subversion-tools
    Step2: Create repository folder & bind it to subversion.
    # You can deploy your repository folder wherever you want. This is my case.

    Code:
    sudo mkdir -p /var/local/svn/projectx
    sudo svnadmin create /var/local/svn/projectx
    sudo chown -R username:usergroup /var/local/svn/projectx
    Step3: Set configuration for subversion server
    Code:
    cd /var/local/svn/projectx/conf
    sudo gedit  svnserve.conf
    --
    [general]
     anon-access = read
     auth-access = write
     password-db = passwd # This refer to passwd file in the same folder
     realm =Cavalier Repository
    --
    Ok then set the authentication for the access to the subversion server. In the same folder there is already the file named "passwd", all you need to do is edit this plain text file.

    Code:
    sudo gedit passwd
    --
     [users]
    username = password #<- you can modify here to whom you want to allow the access 
    --
    Setup for the subversion server is done You can run it as a daemon by:
    Code:
    sudo /usr/bin/svnserve -d
    or with "-r" option you can indicate the path to repos.
    # With "-r" option like "svnserve -d -r /var/local/repos", your path to the repos is hidden. If you want to access to "/var/local/repos/xproject/trank" , from the client the address to access is "svn://your.svnserve.address/xproject/trank"
    Code:
    sudo /usr/bin/svnserve -d -r /root/svn/var/local/svn/your_repos
    [Others]
    However you most likely want to run automatically at OS start up.
    Then let's try to do it by the super server.

    Super server is a program which start the service triggered by the client request. Super server watch the specified port and if there is a request listed on the conf file, it automatically start the program. This will reduce the use of CPU and even the service is down , it automatically start the service. (Often TELNET, POP which require stability are using super server)
    # However the server such as HTTPD (Apache) which has frequent access BETTER NOT use super server.

    Step1: Install xinetd(Super server program) and set it up.
    Code:
    sudo apt-get install xinetd
    sudo gedit /etc/xinetd.d/svnserve
    --
    service svnserve
    {
        disable         = no
        port            = 3690
        socket_type     = stream
        protocol        = tcp
        wait            = no
        user            = root
        server          = /usr/bin/svnserve
        server_args    = -i -r /var/local/svn/your_repos
    }
    --
    
    sudo gedit /etc/services
    # modify the port "3690/tcp" line like this below
    --
    svnserve		3690/tcp	# Subversion protocol
    --
    After the configuration , restart xinetd :
    Code:
    sudo /etc/init.d/xinetd restart
    [Workaround]
    Some people might face error such as "Malformed network data". Try following as a temporary solution.

    #Before please check if you run svnserve with "-r" option like "svnserve -d -r /var/local/repos", your path to the repos is hidden. If you want to access to "/var/local/repos/xproject/trank" , from the client the address to access is "svn://your.svnserve.address/xproject/trank"

    1) Many case svnserve file under xinetd.d is misspelled. Please check it first.
    2) If svnserve file seems ok + you are running svnserve locally, change the protocol to "file".
    Use:
    Code:
    file:///localhost/var/local/svn/your_repos
    instead of
    Code:
    svn://localhost/var/local/svn/your_repos
    3)If your are runnin svnserve on different machine. Forget about xinetd and run as a daemon.
    Code:
    sudo rm /etc/xinetd.d/svnserve
    sudo /etc/inited.d/xinetd restart
    sudo /usr/bin/svnserve -d -r /root/svn/var/local/svn/your_repos
    [Tips]
    You can alwasy check if the 3690 port is Listen status by
    Code:
    netstat -n 
    or
    netstat -an|grep 3690
    [Infos]
    Here you could get the additional good info from the community member.

    Quote Originally Posted by leo_m
    Subclipse with javahl has problems...when I try to use file protocol to configure a remote host in subclipse, that url gets appended after the eclipse installation folder, e.g, if I specify file:///subversion_repositories/repository1, subclipse using javahl tries to go to /home/leo/eclipse/file/subversion_repositories/repository1, which is not a valid path, assume eclipse was installed at /home/leo/eclipse.

    it is better to use javasvn than the javahl: it can be configured in Windows|Preferences (and then choose settings for subclipse)
    OK Done !!
    Now I have subversion server & client for the productive open source development.. Enjoy coding
    Last edited by Cavalierski; July 21st, 2006 at 11:53 AM.

  2. #2
    Join Date
    Apr 2005
    Beans
    Hidden!
    Distro
    Ubuntu

    Re: HOWTO : Subversion & Eclipse development environment

    Just a couple of notes while following this:
    - I had to run svnadmin with sudo
    - the path for the xinetd svnserve conf file was "/etc/xinetd.d" (on my box anyway)
    - the second "server" is supposed to be "server_args" I think

    on a personal opinion note, I question whether the user should be 'root'. I created a user 'svn' and chown'ed the svn directory to svn and used user = svn in the svnserve conf file. I'll post back if I run into issues.

    Otherwise, thanks for the guide. I only post this to help out the next person.

  3. #3
    Join Date
    May 2005
    Location
    Amsterdam
    Beans
    33
    Distro
    Ubuntu 8.04 Hardy Heron

    Re: HOWTO : Subversion & Eclipse development environment

    Thanx mbeach, your points are all right.
    I updated my original article. Thanx again for your feedback

    Regarding the user root, I suppose creating another user for it is more secure. However it shouldn't be a big problem I guess to use root account this time, shoud it?

    Quote Originally Posted by mbeach
    Just a couple of notes while following this:
    - I had to run svnadmin with sudo
    - the path for the xinetd svnserve conf file was "/etc/xinetd.d" (on my box anyway)
    - the second "server" is supposed to be "server_args" I think

    on a personal opinion note, I question whether the user should be 'root'. I created a user 'svn' and chown'ed the svn directory to svn and used user = svn in the svnserve conf file. I'll post back if I run into issues.

    Otherwise, thanks for the guide. I only post this to help out the next person.

  4. #4
    Join Date
    Mar 2005
    Location
    Dunedin, NZ
    Beans
    559
    Distro
    Kubuntu 7.10 Gutsy Gibbon

    Re: HOWTO : Subversion & Eclipse development environment

    If you use the name svn instead of svnserve then you don't need to edit your /etc/services file as svn is already in there with the appropriate port number.

    I too created a svn system user (no home created) and did a chown on the repository directory.

    Thanks for the HOW TO though, it started me on the right track.
    ACCU - for programmers who care

  5. #5
    Join Date
    May 2005
    Beans
    46

    Arrow local repository with subclipse & javaHL

    If you are using subversion and eclipse (and subclipse), and would like to access a local repository using the file:// protocol then you need to install libsvn-javahl. Then start eclipse with "eclipse -vmargs -Djava.library.path=/usr/lib/jni/".
    In the Eclipse menu Windows -> Preferences -> Team -> SVN and select JavaHL.
    I am using eclipse 3.1 (custom installation) with subclipse 1.0.2 and libsvn and libsvn-javahl from the Dapper repositories.
    Sincerely,
    Aouie
    Last edited by aouie; June 14th, 2006 at 06:13 PM.

  6. #6
    Join Date
    May 2006
    Beans
    9

    Re: HOWTO : Subversion & Eclipse development environment

    Hi all,

    I am totally new with this. I've just installed Ubuntu 6.06 a few days ago. I wanted to play around with Subversion.

    I follow all the steps above and I think I am doing everything correctly.
    I did also created a svn account (with no home directory).
    In Step 2:
    This is what I did, is this correct?
    sudo mkdir -p /var/local/svn/projects
    sudo svnadmin create /var/local/svn/projects
    sudo chown -R svn:svn /var/local/svn/projects

    In Step 3:
    I did exactly the same, except I gave it a different Realm Repository. How
    does this Realm name come into play? Does this even matter?

    I also add a user and password to the passwd file.

    I did install xinetd.
    I edited /etc/xinetd.d/svnserve to be the following

    service svnserve
    {
    disable = no
    port = 3690
    socket_type = stream
    protocol = tcp
    wait = no
    user = sve
    server = /usr/bin/svnserve
    server_args = -i -r /var/local/svn/projects
    }

    and edited /etc/services to the following:
    svnserve 3690/tcp # Subversion protocol

    I've restarted /etc/init.d/xinetd restart, is say it stop and started again after the command.

    So I think I am doing everything correctly. I have a few questions.
    First how can I tell that the svnserve is running?

    Secondly how can I access the svn repository. Is it svn://my.domainname/svn? Can I put that url a browser address bar or File Explorer?

    Thanks again for help.

  7. #7
    Join Date
    Feb 2005
    Location
    Geneva, Switzerland
    Beans
    976

    Re: HOWTO : Subversion & Eclipse development environment

    I had problems using Subversion.

    I've installed Subversive which acts as Subversion and now I have no problems. Developers says that it's possible to use both together.

  8. #8
    Join Date
    May 2006
    Beans
    5

    Re: HOWTO : Subversion & Eclipse development environment

    Hi,

    I've followed all of the instructions here, but I get a "Malformed network data" error when I try to create a new repository location from eclipse. What's going wrong? I'm using svn://localhost for my repository location.

  9. #9
    Join Date
    May 2005
    Location
    Amsterdam
    Beans
    33
    Distro
    Ubuntu 8.04 Hardy Heron

    Re: HOWTO : Subversion & Eclipse development environment

    Quote Originally Posted by hdpc
    So I think I am doing everything correctly. I have a few questions.
    First how can I tell that the svnserve is running?

    Secondly how can I access the svn repository. Is it svn://my.domainname/svn? Can I put that url a browser address bar or File Explorer?

    Thanks again for help.
    Hi, regarding your question,

    A1) You can check if the server is listening the port or not by
    Code:
    netstat -n
    If you run it as a daemon (with -d option), you can see it by
    Code:
    ps aux | grep svn
    A2) If you want to access to svn server, you need svn client (CUI or GUI). You cannot use the service if you access to it by your browser (firefox?) as it doesn't understand the protocol.
    If you want to access CUI,
    Code:
    svn co svn://localhost/var/local/svn/xxx
    I added article on the top post, please have a look

  10. #10
    Join Date
    May 2005
    Location
    Amsterdam
    Beans
    33
    Distro
    Ubuntu 8.04 Hardy Heron

    Re: HOWTO : Subversion & Eclipse development environment

    Quote Originally Posted by mattb1982
    Hi,

    I've followed all of the instructions here, but I get a "Malformed network data" error when I try to create a new repository location from eclipse. What's going wrong? I'm using svn://localhost for my repository location.
    As a tentative solution, I updated the first post. Please have a look.

Page 1 of 4 123 ... LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •