Child pages
  • Import Sakai source into Eclipse
Skip to end of metadata
Go to start of metadata
  1. [OPTIONAL] Run the following maven commands in your sakai-src root folder (e.g. /opt/cafe-2.5.x)
    This will clean out any eclipse files that are in there already:

    mvn eclipse:clean
    
  2. [OPTIONAL] Generate the eclipse files using maven (this is not required and not recommended)
    This will generate valid eclipse .project and .classpath files from the maven build

    mvn eclipse:eclipse
    
    • Special Case: If your workspace is in a different location, I've found that this option is needed passed to maven, otherwise the dependencies get incorrect.  -Declipse.workspace=..

      • Passing the full path to the local workspace or current directory might also work
    • If you are using the Maven Plugin for Eclipse then you should run this instead:

      mvn eclipse:m2eclipse
      
  3. Startup eclipse if it is not running
  4. Create a new workspace for Sakai
    1. Click on File -> Switch Workspace
    2. Enter "WS-Sakai" in place of the default "workspace" directory
    3. Click OK (eclipse will restart)
      • The following steps should be done in the WS-Sakai workspace
  5. Add Maven Repository libraries to classpath
    • NOTE: This is for backwards compatibility with projects using the M2_REPO variable so it can be skipped
    1. Select Window -> Preferences -> Java -> Build Path -> Classpath Variables
    2. Add MAVEN_REPO classpath variable with the path to the local maven repository (Sakai 2.4 or lower)
      • The path should be: $USER_HOME/.maven/repository
    3. Add M2_REPO classpath variable with the path to the local maven repository (Sakai 2.5 or higher)
      • The path should be: $USER_HOME/.m2/repository
  6. Switch to the Java perspective (Window -> Open Perspective -> Java)
    • Make sure you are in the package explorer
  7. Turn off Automatic builds
    • Select Project and uncheck Build automatically
  8. Select File -> Import -> Existing Projects into Workspace
    1. You can either import the entire sakai source tree (e.g. /opt/sakai-2.9.x) or selectively choose specific sub-projects you'll be working on (e.g. /opt/sakai-2.9.x/announcement) 
    2. Click Finish to import the selected projects
      • This will take awhile, probably 5+ minutes
    3. Clean all Sakai projects
      1. Select Project -> Clean
      2. Select Clean all projects
      3. Check Start a build immediately
      4. Click OK
    4. Build All (Project -> Build All)
      • There will be hundreds of warnings, do not worry about these
  9. Turn back on Automatic builds
    • Select Project and check Build automatically
    • Select project and then use the down triangle menu to add Filters (target, m2-target)
  • No labels

3 Comments

  1. With cafe/branches/2-6-x: mvn eclipse:m2eclipse -> Required goal not found: eclipse:m2eclipse in org.apache.maven.plugins:maven-eclipse-plugin:2.8, I may be missing something.

  2. Be sure to up your eclipse.ini settings (somewhere below the  install directory): 

    -XX:MaxPermSize=1024m -Xms256m -Xmx512m

  3. There's an annoying issue debugging in Eclipse with tomcat. Whenever you redeploy an application it throws uncaught neverending exceptions on ThreadPoolExecutor. There is a fast workaround for this.

    In the Preferences Dialog, the Debug pane underJava in the tree hierarchy, has the option titled "Suspend execution on uncaught exceptions", which can be unchecked. Stack Over Flow Reference

    There are more workarounds, but it's not clear how it's going to really get fixed, but it's super annoying! https://bugs.eclipse.org/bugs/show_bug.cgi?id=384073