Skip to content
tmillsclare edited this page May 23, 2011 · 17 revisions

Running the project

Setting up the project in your IDE

I will walk you through how to setup the ZK Scala using ZK Studio. The methodology is simple and borrows from basic ZK concepts.

Eclipse, ZK Studio & Scala

For this section I am going to assume you are using Eclipse. Make sure that you have both ZK Studio and Scala extensions installed.

For more details on installing Eclipse and ZK Studio please refer [here](http://books.zkoss.org/wiki/ZK Installation Guide/Setting up IDE/Eclipse with ZK Studio).

For details on installing Scala into Eclipse please refer to the scala website.

Running the project from Eclipse

Project creation

Using ZK Studio you need to create a new ZK project, for more information on doing this you can refer to this.

Once the ZK project is created switch to the Scala perspective and then add the Scala nature to your ZK Scala project. This is done by right clicking on the project, then choosing Configure -> Add Scala nature.

Cloning the repository

Firstly you are going to need a local copy of ZK Scala. To do this follow github standards, if you would like to make additions (they are encouraged) then you can follow the normal github forking policy. Let's assume you just require a readonly copy.

To clone use the following command:

git clone git://github.com/tmillsclare/zkscala.git

This should now give you a directory with the following folders src and WebContent.

Setting up the build environment

Copy and paste the src folder from zkscala into your new eclipse project folder. Then copy index.zul from WebContent into your new project's WebContent folder.

Once you have done this we need to setup the build environment. If you have a warning stating that the Classpath entry for the SCALA_CONTAINER will not be exported then right click the message and select Quick Fix. After that select the option "Mark the associated raw classpath entry as a publish/export dependency" and this issue should be fixed.

Go to the build path screen by right clicking the project and clicking Build Path -> Configure Build Path. Then on the sources tab and you should see [project-name]/src is already there. This is correct however, we also want to make sure that src/archive is also exported. To do this we exclude it from the src entry on teh build path. Double click excluded then add archive/ and press finish.

Now back on the build path make sure [project-name]/src is selected and press the [Add Folder] button. If the button is disabled, check again that [project-name]/src has focus and NOT it's children such as Included, Excluded and Native library location.

Having clicked add folder, a dialog appears, in it select the folder archive under src and press OK.

Running the project

You have now finished the setup so right click on your project and click Run As -> Run on Server to display it.

What if I want to make changes?

I highly encourage making changes and adding more examples, I am no Scala expert and only learning so contributions are welcome.

To make it easier to add changes I do not copy over the files as I instructed you to earlier. I work almost exclusively from linux so tend to setup a symbolic link to the src folder and index.zul file of my cloned git repository. Thus I can immediately work with git to take care of it using the command line.

If you aren't running linux you can always use one of the many git extension to manage it for you!