wiki:PLATFORM_DEPLOYMENT_BUILD_ECLIPSE
Last modified 16 years ago Last modified on 01/27/09 13:09:42

Error: Macro BackLinksMenu(None) failed
compressed data is corrupt

Platform deployment build in Eclipse

Prerequisites

Before you can import the Sophie 2.0 project in Eclipse, you must have Maven and Subversion installed and integrated in it. For detailed information on how to do that, please refer to the Setup section of DEVELOPMENT_OVERVIEW.

Importing for the first time

To deploy the Sophie 2.0 project in Eclipse you have to follow these steps:

  • Choose the Import... option from the File menu or by right-clicking in Package Explorer.
  • Select General -> Maven Projects and click Next (or use the search box to search for Maven).
  • Browse to your local copy of the repository and choose sophie2-platform for Root Directory.
  • (recommended) Check Add project(s) to working set and:
    • Click the New... button next to the Working set field;
    • Select Java as a Working set type and click Next;
    • Choose the name for the working set (i.e. sophie2-working-set) and click Finish.
  • Click Finish.
  • Right-click on the project in Package Explorer and select Maven -> Update Dependencies to finish integration.
  • Note that the first time that you import the project it will take a while before the process is complete.

Running Sophie2

Now you have an Eclipse working set containing the Sophie 2.0 modules. The base module of the project is sophie2-platform. To run the project:

  • Go to sophie2-platform/dev-tools.
  • To run Sophie2 Author right-click on author.FakeAuthorMain.launch and select Run as -> author.FakeAuthorMain
  • To run Sophie2 Server right-click on server.FakeServerMain.launch and select Run as -> author.FakeServerMain
    • Note that you might have to select Run configurations... if no other options are available.
  • When the Reader is available, you can run it the same way.

These are not the real OSGi containers but only emulations for running the application under Eclipse IDE - otherwise, you have to wait at least two minutes for Maven to build for every little change in the source code.

Creating a new module

When you have to create a new module, follow these steps:

  • Copy sophie2-platform/dev-tools/org.sophie2.proto.project to sophie2-platform/modules OR unzip sophie2-platform/dev-tools/org.sophie2.proto.project.zip to sophie2-platform/modules (the .zip file doesn't contain .svn files for its subfolders so you don't have to deal with nasty svn issues later).
  • Right-click on the module in the new location, choose Refactor -> Rename and enter the name of the new module.
  • Edit the following part of the pom.xml file of the new module:
    	<artifactId>org.sophie2.proto.project</artifactId>
    	<version>2.0-SNAPSHOT</version>
    	<name>Sophie 2 Author Component</name>
    	<packaging>bundle</packaging>
    	<description>Copy from this one to create a sophie2 module</description>
            ... (some more lines)
            <Export-Package>org.sophie2.proto.project.*</Export-Package>
    

The <artifactId> should be the same as the module name. All other occurencies of org.sophie2.proto.project (for example in the <Export-Package> should be replaced with the new module name. You should also edit the <name> and <description> tags. You can look at the <instructions> tag if your module reqires a main class or a class extending SophieModule.

  • Edit the pom.xml of sophie2-platform and add the name of the new module in the <modules> section.
  • After you create the module, you have to import it. See the next section for details.

In our module structure we should add a get instance functionality when creating a new module class. Here is the template: trunk/sophie2-platform/dev-tools/eclipse_templates/module_templates/module_instance.xml

Importing newly created modules

To import a newly created module, follow these steps:

  • Choose the Import... option from the File menu or by right-clicking in Package Explorer.
  • Select General -> Maven Projects and click Next (or use the search box to search for Maven).
  • Browse to your local copy of the repository and choose sophie2-platform for Root Directory.
  • You will see the new modules selected. Make sure the current working set is selected and click Finish.
  • Right-click in the Package Explorer and choose Update Project Configuration and Update Dependencies from the Maven submenu.

Working with previous revisions/releases

If you want to get back to a previous revision of the project, you should right-click on the desired module (or the working set) and select Team -> Switch to another Branch/Tag/Revision. You can browse to the desired branch/tag where the releases are stored or choose a revision number. Note that if you have selected the whole project and not just a single class/package/module, this operation will take some time.

Troubleshooting information

  • If you see errors in your pom.xml files after an update, then probably someone has commited a new module and you have to import it.
  • If you don't see the working sets, use the View Menu in the upper right corner of Package Explorer.
    • for Top Level Elements choose Working Sets.
    • use the Configure Working Sets option.

Comments

  • When creating a new module do not refactor in order to rename it. Instead, just press F2 and change the module name. Make sure you add a new module and not mess the proto.project in the dev-tools --boyan@2009-01-10
  • Beware that importing and building for the first time (including updating of the dependencies) may take anything within 30 mins - 1 hour, and if there are problems - even more --boyan@2009-01-12