Eclipse IDE

From OpenIndivo Documentation Wiki

Jump to: navigation, search

A guide to set up Indivo development using the Eclipse IDE (submitted by Malcomm).

Note: Maven integration into Eclipse should be considered pre-production at this time. --Malcomm 14:39, 19 December 2007 (PST)

Contents

Plugins

In general it is best to use the Update Manager to install all the plugins.

Maven

The q4e (Q for Eclipse is an Apache Maven plugin for the Eclipse IDE) is being submitted as a Technology Project for the Eclipse foundation and it seems to be the most functional. The rest of this page will be based on the q4e plugin.

Install:

  • Install guide for q4e.
  • From the update site the main plugin is under Community and is named Q for Eclipse. Select the plugin and make sure to click on the button "Select required".

Subversion

  • Subversion: Subclipse
    • Subclipse is not a required plugin if you use a subversion client outside of Eclipse.

Working in Eclipse

At the time of writing this, I have found that it is best to do a subversion checkout and a Maven build outside of Eclipse before starting this process. Once that is complete, one can use Eclipse's project import to bring a specific project into an Eclipse workspace. --Malcomm 13:19, 19 December 2007 (PST)

In future releases of q4e one should be able to:

  • Browse the Subversion repository in Eclipse and checkout a project.
    • You can do this today, but the Maven 2 Project Creation Wizard is not working correctly. --Malcomm 13:27, 19 December 2007 (PST)
  • Create a brand new Maven project

Eclipse Project Import

Once the q4e plugin has been installed you can use it to import a project from outside of Eclipse. This means that you have already checked out Indivo to a location that your local machine can reach. I will assume that Indivo's trunk branch has been checked out here:

${homedir}/projects/indivo/trunk

The q4e plugin works off the pom.xml and will do all the work needed to make the project work in Eclipse. To import all the Indivo projects:

  • File -> Import
  • Select: General -> Maven 2 Project (Next)

Image:Maven2-import-project-1.png

  • Select the root where the main pom.xml file is stored.
    • For example: ${homedir}/projects/indivo/trunk

Image:Maven2-import-project-2.png

  • Select Finish
    • This will start a somewhat lengthy import process and should do all the Maven dependencies as appropriate.
    • Note: please refer to the Notes section below for potential problem areas.
    • Note: I did have some difficulties doing this before I built Indivo outside of Eclipse first. I would recommend doing a checkout of Indivo and then issue the following from the root of the Indivo trunk:
mvn clean
mvn install

Bugs/Issues

Here is a list of issues that are causing problems right now:

Notes

In general the q4e plugin looks to be on the right track, but it's not really ready for prime time. The plugin will manage the Eclipse classpath so that it will work off of your .m2/repository, so that is nice, but some of the other features just don't work.

I had some problems when importing all of the project into an Eclipse workspace:

Problems w/ java.lang.Object

The project was not built since its build path is incomplete. 
Cannot find the class file for java.lang.Object. Fix the build path then try building this project

The type java.lang.Object cannot be resolved. It is indirectly referenced from required .class files	....
  • Packages contain "src.main". This basically means the import of the project did not set up the source folder(s) correctly.

First thing to try:

  1. Delete the Project from my workspace (make sure to select "Do not delete contents")
  2. Re-import the project as a Maven 2 Project.
  • Note: this seemed to work for the the trunk/core project

Problems with Indivo artifacts (JARs) not in my .m2 directory

Project 'core' is missing required library: 
'C:\Documents and Settings\malcomm\.m2\repository\org\indivo\indivo-protocol\3.2-SNAPSHOT\indivo-protocol-3.2-SNAPSHOT.jar'

For whatever reason I can't seem to get the q4e plugin to download the Maven dependencies for Indivo. For example, the Indivo core project requires:

${homedir}/.m2/repository/org/indivo/indivo-protocol/3.2-SNAPSHOT/indivo-protocol-3.2-SNAPSHOT.jar

To fix this I just did this from the root (trunk branch):

mvn clean
mvn install

Eclipse's "." Files

Eclipse will place a .project and .classpath in each project (codes, config, core, file, ... etc.). These files should only be used by Eclipse, but there is a general question of whether or not these files should be checked into the code repository. An example of what these look like:

  • .project:
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
        <name>core</name>
        <comment></comment>
        <projects>
        </projects>
        <buildSpec>
                <buildCommand>
                        <name>org.eclipse.jdt.core.javabuilder</name>
                        <arguments>
                        </arguments>
                </buildCommand>
                <buildCommand>
                        <name>org.devzuz.q.maven.jdt.core.mavenIncrementalBuilder</name>
                        <arguments>
                        </arguments>
                </buildCommand>
        </buildSpec>
        <natures>
                <nature>org.eclipse.jdt.core.javanature</nature>
                <nature>org.devzuz.q.maven.jdt.core.mavenNature</nature>
        </natures>
</projectDescription>
  • .classpath:
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
        <classpathentry including="**/*.java" kind="src" path="src/main/java"/>
        <classpathentry including="**/*.java" kind="src" output="target/test-classes" path="src/test/java"/>
        <classpathentry kind="con" path="org.devzuz.q.maven.jdt.core.mavenClasspathContainer"/>
        <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
        <classpathentry kind="output" path="target/classes"/>
</classpath>
    • Note: org.devzuz.q.maven.jdt.core.mavenClasspathContainer is how the q4e plugin integrates the Maven local repository into Eclipse.

In the past I know that groups have felt very strongly about having anything that is IDE specific checked into their code repository. I think there are two ways of handling this:

  • Check them in
    • This would require that anyone that is using Eclipse would need to standardize on the Eclipse plugin (q4e).
  • Set the SVN property to ignore these files
Personal tools