Eclipse
From DesigningPatterns
Contents |
Background
Eclipse is an IDE. It originally was written for Java, but now it supports multiple languages.
Installation
- Ensure that the latest JDK is installed.
- Also, if needed for the project, ensure that MySQL is installed.
- Download Eclipse from here.
- Eclipse has no installer right now, so just unpack the archive to the desired destination directory. If using Windows, create a desktop shortcut.
- Download PuTTYgen.
- Generate a key-pair with PuTTYgen; export the public key in OpenSSH format.
- Put the public key in the remote SVN server's authorized key list. Check that the key pair works by accomplishing a ssh login (with PuTTY, for instance) without a password.
- Download Subclipse, which is an SVN plugin for Eclipse. Download with Eclipse's Software Updates option from [1]. Download all of the required packages and SVNKit (which is a subversion client). The SVNKit client adapter also must be installed.
- Create a new project from SVN in Eclipse. Add a repository corresponding to the SVN server's repository. Configure the SVN client with the OpenSSH format private key.
- Change the key bindings to emacs in Eclipse (Window => Preferences => General => Keys)
- Select "Refresh Automatically" in Windows => Preferences => General => Workspace; this will cause the Project Explorer to refresh automatically if any files are added/removed (not sure why this is not the default!).
- Download the m2eclipse plugin, which provides eclipse/maven integration. This is needed in order to Eclipse to understand Maven dependencies. Note that m2eclipse >= .97 must be downloaded (the development eclipse updates path is http://m2eclipse.sonatype.org/update-dev/)
- In Window => Preferences => Java => Installed JRES, ensure that eclipse is configured with a JDK (*not* a JRE).
- In Window => Preferences => Maven, check "Download Artifact Sources" and "Download Artifact Javadoc" (so that m2eclipse automatically will download source code and javadoc files for any dependencies, when available).
- Right click on the project; under the Maven drop-down menu item, click "Enable Dependency Management" to activate m2eclipse (note that this only will work correctly if a
pom.xmlexists in the base directory). - In
ECLIPSE_ROOT/eclipse.ini, ensure that the permanent generation size is at least 512M:
--launcher.XXMaxPermSize
512M
- Set any global Ant properties through Window => Preferences => Ant => Runtime => Properties.
Things to Remember
- The project's default line delimiter *always* should be UNIX-style (Project => Properties => Resource)
- The Ant View, once configured with the project's
build, allows any target to be executed via a point and click interface. - Eclipse will assume that all files need to be checked-in (even build artifacts). Use SVN's
svn:ignoreproperty to tell Eclipse that a file or directory should *NOT* be checked in (this can be done for the project with Team => Set Property; I findsvn propedit svn:ignore .in UNIX easier). - The Problems View can show all of the errors and warnings that Eclipse flags during its internal build.
- If one is using a custom Ant file for building, one needs to setup Eclipse's internal build properly so that it will flag errors correctly. m2eclipse helps by telling Eclipse about the project dependencies; one also may need to tell Eclipse about all of the source paths (Project => Properties => Java Build Path).
- Eclipse can automatically organize Java import statements. Highlight all source code directories, right-click, and select Source => Organize Imports.
- Ensure that "Build Automatically" is checked on the project menu, so that Eclipse will flag errors in real-time.
Issues
- Eclipse is not very knowledgeable about generated source code. In particular, it cannot handle a configured Source Path that is generated by the build; the root of the generated Source Path must exist. This could be accomplished by versioning the generated Source Path directory, but we have opted against this solution because, in general, we want to be able to simply blow away all build artifacts. Instead, we just kick of an Ant build manually in Eclipse to create this directory after a clean (or an import).
- For some reason, when manually launching an Ant build (via the Ant View), Eclipse always builds the project first (resulting in a double Ant build).
