2/13/2009

Unable to copy and paste multiple files in Eclipse project explorer

One thing I often do inside a java IDE is to copy files from one package to another. The IDE (either Eclipse or NetBeans) does the refactoring automatically including renaming the package. I usually copy multiple files of mixed types (e.g., java source files, ant build.xml files, web.xml, etc) in one operation.

I recently found I can't do that in Eclipse project explorer (3.4.1 ganymede). I can only copy files of the same content type in one command. That is, I can copy-paste-refactor multiple java files, or multiple xml files from one package to another. But it would fail if I try to copy java source files AND xml files.

It seems the copying part failed. When I tried to paste files of mixed types, the files copied in the last command were pasted, not the one supposed to have been copied.

This has been working pretty well in NetBeans 6.1 and 6.5.

2/03/2009

Install subversion 1.5.5 on Ubuntu

The latest subversion is 1.5.5 (as of now 2/3/2009), but it's not available yet in Ubuntu repository or web site (svn 1.4.6). So I tried to install it manually. I only need the client, not the server, so I would skip those parts that are only for server. I went through the following steps and finally was able to install it. Take it at your own risk.

0. Switch (su) to root.

1. Go to http://subversion.tigris.org/getting.html, and click the link Source Releases Area. Download subversion 1.5.5 source archive and the dependency tarball to Desktop (note: 2 separate gz files: subversion-1.5.5.tar.gz & subversion-deps-1.5.5.tar.gz). This site also lists binary downloads for various platforms. I checked Ubuntu and other Linux platforms, but they don't have 1.5.5 yet.

2. Unpack subversion source and dependency tarballs (note that both must be unpacked inside the same directory)

cd $HOME/tmp
tar xzvf $HOME/Desktop/subversion-1.5.5.tar.gz
tar xzvf $HOME/Desktop/subversion-deps-1.5.5.tar.gz
3. Try to configure and install it
cd $HOME/tmp/subversion-1.5.5
./configure --without-berkeley-db --without-apache --without-neon --without-swig
make
make install
4. If it failed at step 3, most likely some dependencies are still missing. In my case, openssl is reported missing, though I'm sure openssl is already installed. Anyway, download and install openssl. It should be straight-forward to install openssl from source:

Go to openssl.org to download the latest stable version of openssl (currently openssl-0.9.8j). Note: OpenSSL 0.9.8 has a problem that can cause SSL negotiation failure (SSL negotiation failed: SSL error: decryption failed or bad record mac). For more details, see http://wiki.open.collab.net/wiki/Subversion_Client_FAQ
cd $HOME/tmp
tar xzvf $HOME/Desktop/openssl-0.9.8j.tar.gz
cd openssl-0.9.8j
./config
make
make install
5. Try installing subversion 1.5.5 again, with --with-openssl=/usr/local/ssl option, assuming openssl is installed to /usr/local/ssl.
cd $HOME/tmp/subversion-1.5.5
./configure --without-berkeley-db --without-apache --without-neon
--without-swig --with-openssl=/usr/local/ssl
6. If it fails due to zlib not present, try installing zlib1g-dev:
sudo apt-get install zlib1g-dev  (without sudo, if running as root)
7. Try installing subversion 1.5.5 again, with --with-zlib=... option:
./configure --without-berkeley-db --without-apache --without-neon
--without-swig --with-openssl=/usr/local/ssl --with-zlib=/usr/include
That should do it. Subversion 1.5.5 (at least the client) has been installed successfully!
/tmp > which svn
/usr/local/bin/svn

/tmp > svn --version
svn, version 1.5.5 (r34862)
compiled Feb 3 2009, 14:23:41

Copyright (C) 2000-2008 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 access (RA) modules are available:

* ra_svn : Module for accessing a repository using the svn network protocol.
- handles 'svn' scheme
* ra_local : Module for accessing a repository on local disk.
- handles 'file' scheme
* ra_serf : Module for accessing a repository via WebDAV protocol using serf.
- handles 'http' scheme
- handles 'https' scheme

Update: After using this subversion client for about a month, I found a problem when committing changes to a repository with https. It only happens when running the commit sub-command using http protocol. It's probably related to the openssl issue mentioned above.

Change svn project to java project in Eclipse

I checked out a project from subversion repository using Eclipse (3.4.1 ganymede). I chose to check it out into a new Eclipse project, but it turned out to be a non-java, svn project was created. In the project properties, there is no associated builder. Its .project file looks like this:

<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>project1</name>
<comment>project1</comment>
<projects>
</projects>
<buildSpec>
</buildSpec>
<natures>
</natures>
</projectDescription>
Now I want to turn it into a java project so it can be built with a java builder. I tried a few menus and other places inside Eclipse to no avail. Then I found I can just edit .project file, and that did the trick. Close Eclipse before doing these manual editing.
$HOME/workspace/project1/.project:
----------------------------------
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>project1</name>
<comment>project1</comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>
I also added a .classpath file:
$HOME/workspace/project1/.classpath:
-----------------------------------
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<!-- change the default bin directory to classes directory -->
<classpathentry kind="output" path="classes"/>
</classpath>

Finally, start Eclipse, open project1, and modify its source path, libraries, and other project properties.