Eclipse-Sakai Multi-Project Setup

One of the advantages of using Eclipse as your IDE of choice is that each Sakai module (e.g., common, kernel, portal, provider, etc.) available for download from Sakai's SVN repository is configured as an Eclipse project. Each module includes Eclipse's .classpath and .project files, the contents of which mesh with each Sakai module's project.xml file. To view these files and their contents switch to Eclipse's Resource perspective.

Assumptions

  1. Mac OS environment
  2. Java 1.4.2 installed
  3. Tomcat 5.5.x installed together with Compat *.jar
  4. Maven installed and build.properties defined
  5. Eclipse 3.1.x installed
  6. MyEclipse 4.0.x installed (optional)
  7. Subversion client installed


SVN client for the Mac

A good SVN client for the Mac is the command-line version.

You can find it at: http://metissian.com/projects/macosx/subversion

To install:
1.  Run the installer
2. Set your path to include /usr/local/bin (where the "svn" binary is placed).

You can copy the binary from /usr/local/bin/svn to somewhere on your path if you want, rather than changing your path.


Retrieve, build and deploy Sakai from source (see sample script automating the following steps below)

  1. Database: Startup MySQL/Oracle database if not using default HSQL database
  2. Tomcat: perform fresh install of Tomcat (recommended whenever downloading Sakai source from SVN)
  3. SVN: create a local SVN folder external to Eclipse workspace directories (e.g.; Users/arwhyte/aw_dev/svnsakai).
  4. SVN: retrieve files from Sakai SVN repository into local SVN folder (e.g., svn co https://source.sakaiproject.org/svn/trunk/sakai)
  5. Maven: execute Maven build and deploy goal to Tomcat (i.e., maven sakai
  6. Start tomcat and launch Sakai (e.g. startup.sh or in debug mode catalina.sh jpda start)

Eclipse/MyEclipse setup

  1. Create eclipse workspace folder
  2. Start Eclipse
  3. Import Subclipse plugin (Help > Software Updates > Find and Install . . . > Search for new features to install > next > new local site (Subclipse at http://subclipse.tigris.org/update) . . . .
  4. Modify workspace preferences
    • Under General > Startup and shutdown deactivate unnecessary plugins (e.g., extraneous MyEclipse plugins)
    • Under MyEclipse > Application Server enable Tomcat 5 and specify home location
    • Under Java > Buildpath > Classpath Variables add missing CLASSPATH references (e.g., HIBERNATE_HOME, JSSE.jar, JSF_HOME, MAVEN_REPO, OKI_HOME, SPRING_HOME, TOMCAT_HOME, SPRING_HOME and VELOCITY_HOME)
  5. Under Project disable (unclick) Build Automatically
  6. Import external Sakai modules (File > Import... > Existing Projects into Workspace > Select root directory (browse to Eclipse workspace and select projects to import) > Finish)
  7. Under Project > Clean... clean individual projects as necessary
  8. Under Project enable (check) Build Automatically


Importing Sakai modules as Eclipse projects

Mike Osterman suggests "[w]hen importing the multitude of Sakai project into Eclipse 3.1.x, I've found that you can import them all in one fell swoop by selecting File > Import... > Existing Projects into Workspace and then indicating the root of Sakai in the Select root directory dialogue."


Sample Script: getsvnsakai.csh

shellscripts $ cat getsvnsakai.csh
#!/bin/csh

# SET MYPATH
# set MYPATH=`pwd`

# PICK SAKAI TAG AND CHECKOUT TYPE

# HEAD CHECK OUT
set TYPE=trunk
set TAG=sakai

echo SAKAI CHECKOUT TYPE: $TYPE TAG: $TAG
echo

# SET TOMCAT PORTS AND VERSION

set TC_PORT=8080
set TC_SHUT=8005
set TOMCAT=5.5.9

echo TOMCAT Version: $TOMCAT Port: $TC_PORT Shutdown port: $TC_SHUT
echo

# SET MYSQL CONNECTOR VERSION
set MYSQLCONN=3.1.10

echo MySQL VERSION: $MYSQLCONN
echo

# SET AXIS VERSION
set AXIS=1_1

echo AXIS VERSION: $AXIS
echo

# DIRECTORY CLEANUP
cd ~/aw_dev/svnsakai
pwd
echo

rm -rf old-$TAG
mv $TAG old-$TAG

echo EXTRACTING TOMCAT
echo

cd ~/aw_dev
pwd
echo

rm -rf tomcat/
tar xf ../aw_downloads/apache/tomcat_5.5.9/jakarta-tomcat-5.5.9.tar
mv jakarta-tomcat-5.5.9 tomcat

echo EXTRACTING TOMCAT COMPAT JAR
echo

tar xf ../aw_downloads/apache/tomcat_5.5.9-compat/jakarta-tomcat-5.5.9-compat.tar

echo EXTRACTING JMX, XERCES AND XML-APIS JARS
echo

cp ../aw_downloads/apache/tomcat_5.5.9-compat/jakarta-tomcat-5.5.9/bin/jmx.jar tomcat/bin/jmx.jar
cp ../aw_downloads/apache/tomcat_5.5.9-compat/jakarta-tomcat-5.5.9/common/endorsed/xercesImpl.jar tomcat/common/endorsed/xercesImpl.jar
cp ../aw_downloads/apache/tomcat_5.5.9-compat/jakarta-tomcat-5.5.9/common/endorsed/xml-apis.jar tomcat/common/endorsed/xml-apis.jar

echo GET MySQL CONNECTOR JAR
echo

cp ../aw_apps/mysql_connector/mysql-connector-java-$MYSQLCONN/mysql-connector-java-$MYSQLCONN-bin.jar tomcat/common/lib/mysql-connector-java-$MYSQLCONN-bin.jar

echo ADD SAKAI PROPERTIES FILES
echo

cd tomcat
mkdir sakai
cd ..

cp tomcat_sakai.properties/sakai.properties tomcat/sakai/sakai.properties
cp tomcat_sakai.properties/placeholder.properties tomcat/sakai/placeholder.properties

echo ADD SAKAI ADMIN TO TOMCAT-USERS.XML
echo

# Add line <user username="admin" password="admin" roles="sakaiuser"/>
cp tomcat_conf/tomcat-users.xml tomcat/conf/tomcat-users.xml

echo UPDATE TOMCAT SERVER.XML
echo

cd  tomcat/conf
pwd
echo

cp server.xml server.sav
cat server.sav | sed s/8080/$TC_PORT/ | sed s/8005/$TC_SHUT/ > server.xml
diff server.sav server.xml

echo GET AXIS
echo

cd ~/aw_dev
pwd
echo

# copy entire directory (-R)
cp -R ../aw_apps/axis/axis-$AXIS/webapps/axis tomcat/webapps/axis

echo ADD ACTIVATION, MAIL AND XMLSEC JARS TO tomcat/webapps/axis/WEB-INF/lib
echo

cp ../aw_apps/axis/axis_missingjars/activation.jar tomcat/webapps/axis/WEB-INF/lib/activation.jar
cp ../aw_apps/axis/axis_missingjars/mail.jar tomcat/webapps/axis/WEB-INF/lib/mail.jar
cp ../aw_apps/axis/axis_missingjars/xmlsec.jar tomcat/webapps/axis/WEB-INF/lib/xmlsec.jar

echo GET SAKAI FROM SVN
echo

cd ~/aw_dev/svnsakai
pwd
echo

svn co https://source.sakaiproject.org/svn/$TYPE/$TAG

cd $TAG
# pwd
# echo

# maven -i

maven sakai

# maven sakai -Dmaven.tomcat.home=/Users/arwhyte/aw_dev/tomcat/ -Dmaven.repo.remote=http://www.ibiblio.org/maven/,http://cvs.sakaiproject.org/maven/

# maven sakai -Dmaven.tomcat.home=$MYPATH/tomcat/ -D maven.repo.remote=http://www.ibiblio.org/maven/,http://cvs.sakaiproject.org/maven/

Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.
  1. Aug 24, 2005

    Thomas Amsler says:

    When you checkout the code via SVN, the top level Sakai directory, e.g. sakai201...

    When you checkout the code via SVN, the top level Sakai directory, e.g. sakai_2-0-1, has an eclipse .project file, which will not let you add all the projects a once.

    Solution, delete the .project in that top level Sakai folder and you are good to go.

    1. Nov 05, 2005

      Mike Osterman says:

      Thomas thanks for confirming this. I thought I was the only one that had this pr...

      Thomas - thanks for confirming this. I thought I was the only one that had this problem. Not sure why that .project file is there in the first place...

      1. Jan 11, 2006

        Parker Morse says:

        It looks like that .project file is gone in 2.1.

        It looks like that .project file is gone in 2.1.