This is a walkthrough for setting up a Sakai development environment on a laptop or desktop. These instructions will also work for setting up a development server though I suggest slightly beefier settings for memory. This is currently tailored for Sakai 2.3.x but is generally applicable to 2.2.x - 2.4.x. Once you have a Sakai development environment setup you should be able to program your own Sakai tools or modify existing tools.
Note for Sakai 2.5.x+ users
If you are developing for 2.5.x, please check out the current Development Environment Setup Walkthrough which covers the newer version of Sakai with the changes for maven 2.
Notes for windows users
change the "/" to "\" for all directory paths except those specified in the maven build.properties file
add the drive letter (C:) to your paths
use %VARIABLE% instead of $VARIABLE with environment variables
set your environment variables in Control Panel -> System -> Advanced -> Environment Variables
All of sakai and related programs should be installed in an opt directory which you will need full write access to, put this directory anywhere you want, this document will assume you have placed it in your root directory
Custom install to /opt/mysql (options vary slightly based on operating system)
Linux users should install MySQL using a package or binaries if possible
Choose standard configuration
Install as a windows service (Windows only)
Launch automatically (recommended)
If you choose not to do this, make sure that you startup MySQL before you try to run Sakai
Include the bin directory in Path
Don't use an anonymous account
Set your root password to "mysqlpwd1"
Setup Sakai DB (schema) and user
Create the sakai database and sakai user (password=ironchef)
Run the following from a command line prompt:
mysql -uroot -pmysqlpwd1
Note: You can also do the following if you prefer to be prompted for the password: mysql -uroot -p
Then run these commands from the mysql prompt (one command per line):
create database sakai default character set utf8;
grant all privileges on sakai.* to 'sakai'@'localhost' identified by 'ironchef';
flush privileges;
quit
[Optional] Download and install mysql query browser
Note: Windows users should ensure that there are no spaces in the complete tomcat path as this causes errors with JSF tools in Sakai GOOD: C:\opt\tomcat\, C:\sakaistuff\installs\tomcat\ BAD: C:\program files\tomcat\, C:\opt\apache tomcat 5.5.18\
The directory created by subversion will be referred to as <sakai-src> directory
Setup sakai.properties file
Create sakai directory in $CATALINA_HOME
$CATALINA_HOME should be /opt/tomcat if you have been following these instructions
Note: There were previously two configuration files, sakai.properties and placeholder.properties. These have now been combined into sakai.properties. You can attempt to manually combine the two files from a previous version, but it's better to start with the sample included with the sakai source in the reference directory.
Copy sakai.properties from <sakai-src>/reference/docs to $CATALINA_HOME/sakai
Edit the sakai.properties file for a MySQL dev environment. Starting at the section # DATABASE CONFIGURATION:
Set BaseDataSource username
Set username@javax.sql.BaseDataSource=sakai
Set BaseDataSource password
Set password@javax.sql.BaseDataSource=ironchef
Find the section: ## HSQLDB settings and comment out 7+ lines in it
## HSQLDB settings - on by default
#vendor@org.sakaiproject.service.framework.sql.SqlService=hsqldb
#driverClassName@javax.sql.BaseDataSource=org.hsqldb.jdbcDriver
#hibernate.dialect=org.hibernate.dialect.HSQLDialect
#validationQuery@javax.sql.BaseDataSource=select 1 from SYSTEM_USERS
# two hsqldb storage options: first for in-memory (no persistence between runs), second for disk based
#url@javax.sql.BaseDataSource=jdbc:hsqldb:.
#url@javax.sql.BaseDataSource=jdbc:hsqldb:${sakai.home}/db/sakai.db
Find the section: ## MySQL settings and uncomment the 6+ lines in it
## MySQL settings - make sure to alter as appropriate
vendor@org.sakaiproject.db.api.SqlService=mysql
driverClassName@javax.sql.BaseDataSource=com.mysql.jdbc.Driver
hibernate.dialect=org.hibernate.dialect.MySQLDialect
url@javax.sql.BaseDataSource=jdbc:mysql://127.0.0.1:3306/sakai?useUnicode=true&characterEncoding=UTF-8
validationQuery@javax.sql.BaseDataSource=select 1 from DUAL
defaultTransactionIsolationString@javax.sql.BaseDataSource=TRANSACTION_READ_COMMITTED
Note that this line may be incorrect in the default file, it should read as shown:
If you do not use a username or password for your proxy just leave out those 2 lines
You only need the nonProxyHosts option if you have a local maven repo that does not require the proxy to be accessed
Use Maven to build Sakai
Open a command line shell
Change directory to /opt/<sakai-src>
Execute maven bld to build Sakai using maven
Do NOT use maven sakai the first time or your build will take 5-10 times longer!
Note: The build will take an extra 5-10 minutes to download dependencies the first time
Execute maven dpl to deploy Sakai to your tomcat using maven
Add the maven plugin to allow for partial builds in Sakai
Run the following command from the sakai source root: maven plugin:download -DartifactId=sakai -DgroupId=sakaiproject -Dversion=2.2
You can now do a "maven sakai" from any subdirectory and build just that code
For future builds, use maven sakai which does a clean, build, and deploy
(it is basically the same as doing maven cln bld dpl)
Note: If you already have eclipse 3.1.x installed, your best best is to start over with a fresh install rather than attempting to upgrade
Note: If you have not installed eclipse already, you should download the WebTools Platform: All-in-one package for Eclipse 3.3+ which includes Eclipse and all of the necessary webtools packages, this is much faster and easier than downloading them seperately, you can skip the WebTools step if you do this, here are instructions to install the Eclipse WebTools
NOTE: Installing the all-in-one-package or manually installing are far more reliable and definitely recommended over using the updater method (the last one)
NOTE: Only install released versions, the development versions tend to be unstable and buggy
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
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
Switch to the Java perspective (Window -> Open Perspective -> Java)
Make sure you are in the package explorer
Turn off Automatic builds
Select Project and uncheck Build automatically
Select File -> Import -> Existing Projects into Workspace
Enter the full path to the sakai source directory for the root directory
This should be /opt/cafe-2.2.x if you followed the steps in this document
Click Deselect All to unselect all projects
Select the following projects (you only need most of the APIs, a few utils, and all of the db projects)
alias-api
announcement-api
archive-api
authz-api
component-api
content-api
courier-api
cm-api
db-api
db-impl
db-util
entity-api
email-api
event-api
jsf
message-api
master
site-api
site-manage-api
tool-api
user-api
user-util
util-api
util-util
velocity
NOTE: You can just import all the projects also, this tends to work fine for me
Click Finish to import the selected projects
This will take awhile, probably 5+ minutes
Create a working set for Sakai (optional)
You do not have to create a working set, these are here in case you want to
Switch to the Java perspective
In the Package Explorer pane click the drop-down arrow menu and choose Select Working Set
Click the New button from the Select Working Set Dialog window
Choose Java for the Working Set Type and click Next
Enter Sakai as the name for your Working Set
Select the imported Sakai projects and click Finish
Build Sakai in Eclipse
Initially you will get build failures on almost every Sakai project, this is because they are building in the default order and their dependencies are in a different order, this has been partially addressed in Sakai 2.2
Clean all Sakai projects
Select Project -> Clean
Select Clean all projects
Check Start a build immediately
Click OK
Build All (Project -> Build All)
Do this if using working sets:
Build the Sakai working set (Select Project -> Build Working Set -> Sakai)
Repeat this step until no errors remain (should be no more than 3-4 times)
There will be hundreds of warnings, do not worry about these
Since the release of Subversion 1.5, the listed version of Subclipse doesn't wor...
Since the release of Subversion 1.5, the listed version of Subclipse doesn't work (or at least has issues). There is a newer version, Subclipse 1.4, the update site URL is http://subclipse.tigris.org/update_1.4.x
Comments (1)
Nov 03
Chris Dunstall says:
Since the release of Subversion 1.5, the listed version of Subclipse doesn't wor...Since the release of Subversion 1.5, the listed version of Subclipse doesn't work (or at least has issues). There is a newer version, Subclipse 1.4, the update site URL is http://subclipse.tigris.org/update_1.4.x
http://subclipse.tigris.org/install.html