8. Setup an Eclipse Dynamic Web Project for Skyway Builder

PROBLEM

The New Spring DSL project wizard will automatically create a new Eclipse dynamic web project and configure it for code generation, however there may be occasions where you want to create the dynamic web project manually or generate to a pre-existing dynamic web project.

SOLUTION

A Spring DSL project can be configured to generate to any dynamic web project, but there is some additional setup related to code generation. The current version of Skyway Builder will always create a new dynamic web project as the target project (to generate code into), but the Spring DSL project can be easily reconfigured to generate to a different pre-existing dynamic web project.

I created the Dynamic Web Project in Eclipse, and I specified TodoGWT as the name of the project and war as the Content Directory. While the default content directory name for dynamic web projects is WebContent, the content directory must be changed to war due to a GWT requirement.

HOW IT WORKS

The first step is to setup the pre-existing project for code geneneration. While the developer has alot of flexibility in setting up a project, the default setup consists of:

Setup of pre-existing Eclipse dynamic web project

  1. Creating a folder named "generated" (Project –> right-click –> New –> Folder) - the folder where Skyway will by default generate the Spring and Java code

  2. Creating a folder named "resources" (Project –> right-click –> New –> Folder) - the folder where Skyway will by default generate the Spring context files

  3. Configuring the "generated" and "resources" folders as source folders in Eclipse (Project –> right-click –> Build Path –> Configure Build Path -> Source tab)

The next step is to setup the Spring DSL project to generate to the pre-existing dynamic project instead of the project that was created by default.

Configuring Spring DSL project to generate to pre-existing Eclipse dynamic web project

  1. Open Spring DSL editor (double-click on Spring DSL icon in the Spring DSL project)

  2. Using Category Mapping tab, reconfigure target project (Project) to the pre-existing project. Please note that changing the target project for one category will change the target project for all of them.