Project structure
Direct translation from Google translator
Once the wizard has generated our project we can get started by opening Eclipse and selecting as our workspace the folder that was indicated in the wizard. This opens an instance of Eclipse with an empty workspace. The first thing to do is to import the two projects that have been created. For this we will not use the import option.
From the File menu select New->Project... (not java project) and in the dialogue that appears select the General->Project option and click Next. Use "org.gvsig.viewer" as the project name to complete the process. Do the same for the "org.gvsig.viewer.app" project.
Tip
You may find it useful to consult information relating to this in the Developer Guide in the gvSIG project structure section and also in Things to consider before developing a plugin.
Let's take a look at the generated code. The projects that have been created are:
- org.gvsig.viewer. This is a Maven project with multiple subprojects. In these we find the logic part, with its API and implementation, the user interface (and associated API and implementation) associated with the logical components, and a project that allows us to test the logic and interfaces without having to start gvSIG. In general the various components that we find here will be independent of the Andami framework as well as the gvSIG plugins, being dependent only on other libraries. The projects that we will find are:
- org.gvsig.viewer.lib with the logic of our project
- org.gvsig.viewer.lib.api
- org.gvsig.viewer.lib.impl
- org.gvsig.viewer.swing with the user interface of our
logical components.
- org.gvsig.viewer.swing.api
- org.gvsig.viewer.swing.impl
- org.gvsig.viewer.main our main testing.
- org.gvsig.viewer.lib with the logic of our project
- org.gvsig.viewer.app This Maven project is also a multimodule project, that is it has sub-projects. These will contain the implementation of the various plugins that will be added to gvSIG. Normally you will use the components of the org.gvsig.viewer project and be responsible for the integration of these in gvSIG. In the template used for the generated sample project there is only one subproject, org.gvsig.viewer.app.mainplugin, since we will be providing a single plugin. If we had needed to contribute more than one plugin we would have a subproject for each plugin.
We could work with this but since Eclipse is not able to recognise the structure of Maven subprojects it will be much easier to import the child projects as Eclipse projects.
Select the File->import menu option and in the import dialog and select General->Existing Projects Into Workspace and click next. Click "Select root directory" and select the folder "/home/gvsig/workspce/viewer/org.gvsig.viewer/org.gvsig.viewer.lib". In doing this we suggest adding these projects:
- org.gvsig.viewer.lib.api
- org.gvsig.viewer.lib.impl
These will be selected so just press the button end.
Now repeat the process indicating as "root directory" the following folders:
- /home/gvsig/workspce/viewer/org.gvsig.viewer/org.gvsig.viewer.swing
- /home/gvsig/workspce/viewer/org.gvsig.viewer/org.gvsig.viewer.main
- /home/gvsig/workspce/viewer/org.gvsig.viewer.app/org.gvsig.viewer.app.mainplugin
We have now imported all the projects related to our development into our workspace.