This section describes the installation process for developers working on OLAT code. Please ensure that you have already installed the necessary prerequisites as described in Section 2.1, “Prerequisites” and that these are functioning correctly.
Throughout we assume that you are working with Eclipse and have the Web Tools Platform (WTP) and Concurrent Version Systems (CVS) support installed. We have found that it is best to install WTP when packaged with Eclipse (e.g., by downloading the Eclipse IDE for Java Developers) rather than attempt to install WTP to an existing Eclipse installation.
Maven is the build tool used by OLAT and we encourage you to become familar with it (you may be interested to know that the Maven: The Complete Reference is available online)
Step by Step Development Installation :
perform fresh checkout from cvs (not simply cvs-update) of olat3 and olatcore (use a new workspace if you have this folders already in your workspace)
Note that when you rename olatcore to something else, you manually have to adjust the path to olatcore in the modules section in olat3/pom.xml!
In Terminal: make sure that you are using maven 2.2 or higher (mvn -V)
In Terminal: go to olat3 directory
In Terminal: create eclipse project settings and creates .classpath files
mvn eclipse:eclipse,
mvn install (installs copies all jars and resources to the target folder).
If you run out of memory while runnig this commant set MAVEN_OPTS="-Xmx1024m" in front of the mvn command.
In Eclipse: refresh ola3 and olatcore projects
In Eclipse: setup tomcat server by clicking on olat3->Run As->Run on Server->Manually define a new server
In Eclipse: under Servers find your server and change content of the server.xml to:
<?xml version="1.0" encoding="UTF-8"?>
<Server port="8005" shutdown="SHUTDOWN">
<Service name="Catalina">
<!-- Define a non-SSL Coyote HTTP/1.1 Connector on port 8080 -->
<Connector port="8080"/>
<Engine defaultHost="localhost" name="Catalina">
<Host appBase="webapps" name="localhost">
<Context path="/olat" docBase="/yourhome/workspace/olat3/olat/target/olat" debug="0" reloadable="false" >
</Context>
</Host>
</Engine>
</Service>
</Server>
(optional) In Eclipse: setup VM arguments by clicking on olat3->Run Configurations->Arguments->VM Arguments and pasting:
-Djava.io.tmpdir="/tmp/olatdata"
-Xmx512m -Xms512m
In Eclipse link the core sources (olatcore/src/main/java) and core resources (olatcore/src/main\resources) to olat3 project. Go to olat3->Properties->Java Build Path->Source->Edit the two path entries to your env.
Before you start create an empty olat.local.properties and save it to /yourTomcatDir/lib (OLAT searches for this file on the classpath and /tomcat/lib is part of it). But OLAT should start with just the default config!
Usually you will get a timeout exception when you start a new OLAT. After double clicking on the server entry you can increase the timeout for the startup.
(not needed normally). If your tomcat starts very quickly but you cannnot access OLAT it might be that tomcat did not find the OLAT context. Right click the server entry and click publish to inform eclipse about a new context.
Background (optional for further interest) :
The whole start up is no longer done by the custom olat_config.xml mechanism and instead all is done with the Spring framework.
In short: web.xml contains the Spring configuration files paths (see: contextConfigLocation) used for Spring injection at OLAT load(OlatServlet.init() comes after Spring...). If done, Spring injects the servlet context into files which implement ServletContextAware.
Dependencies are done with the "depends-on" bean attribute
There is only one Spring context for the whole OLAT which you can access via CoreSpringFactory (only needed in rare special cases!)
changes in olat.local.properties are reflected upon each restart of Tomcat (no more mvn olat:propeties needed).
Developers can use the embedded HSQLDB and do not need to create a database manually (Default installation of data and database points to java.io.tmpdir which you can overwrite with
-Djava.io.tmpdir=/yourdir if you like or adjust the olat.local.properties file as before).
For OLAT configuration see olat.properties. You can overwrite each property in your
olat.local.properties.
The following are the most frequently used Maven goals. Generally speaking for normal development it suffices to invoke
compile or package under the developer profile i.e.,
mvn package
Table 2.3. Common Build Goals
clean | Removal of all generated and distributed assets. Remove application and log directories. |
compile | Compilation of Java assets and distribution of related XML files, properties files and server configurations |
package | Packging of all compiled and distributed assets into your local deployment target (as an aside a WAR is also generated.) |
install |
Sets up the database (depending on your database properties) and
places generated assets in your local repository (i.e., where your M2_REPO points to)
If you are only interested in invoking this target in order to install the database then you can do so
directly by issuing the olat:dbinstall goal.
|
test | Perform JUnit tests and generated a HTML based report. |
site | Generation of a website, found under olat/target/site, including extensive information of interest to developers
(e.g., output of static code analysers, project information etc.) Be advised that this target takes a while to complete. |