Development Environment

Will Abson edited this page Jun 13, 2013 · 4 revisions

Previously, Share Extras utilised a single Subversion repository provided by the Google Code project for central SCM. Since early 2013 projects are now hosted in the share-extras organisation on GitHub, with each project now having its own Git repository.

Each repository home page provides basic information on how to access the code using standard client tools, while this page contains more detailed information specific to the Eclipse-based development environment used by the majority of Share Extras projects (and which it is recommended you use if you are starting off yourself).

Installing Eclipse and Plug-ins

The Eclipse IDE for Java EE Developers should be used as the base installation, since this includes the majority of IDE features required for both Java projects and for Web Development projects, as well as integration with the Ant build system. The latest version is recommended.

The Eclipse IDE does not yet provide out-of-the-box support for integrating with Git repositories, and therefore an additional module must also be installed to provide this.

Lastly, it is recommended that the Freemarker Eclipse plugin, now part of the JBoss Tools project, is installed to provide syntax highlighting, error checking and code completion for .ftl files used in projects.

The remainder of this section contains further information on installing these components.

Installing Eclipse Helios and Plug-ins

Firstly download the appropriate package of the Eclipse IDE for Java EE Developers for your operating system and install this on your system.

Upon first start-up you should select a new Workspace location when prompted. By default the Welcome splash screen will then be shown, you can go straight into the main IDE interface by clicking the Workbench icon in the top right-hand-side corner of the screen.

Installing Git Team Provider

Git repository support is provided by the Git Team Provider for Eclipse. based on JGit, this provides a pure Java implementation of the Git version control system

The first step is to install the provider. To do this, click Help > Install New Software. In the Install dialog which should appear, select Helios (or whatever your version of Eclipse is) from the Work with select list.

Once the application has downloaded the list of available components, you should be able to enter Git in the filter field. From the components shown, install the following item.

  • Git Team Provider from Eclipse EGit

The install dialogue should walk you through the process of installing the plug-in. After installation has completed you should restart the application.

Installing Freemarker Support

The Freemarker editor for Eclipse is now part of the JBoss Tools project but can still be installed without any other dependencies.

To install the latest version, click Help > Install New Software and then click the Add button next to the Work with select list. Add a new repository with the following information.

When the list of components has loaded, enter Freemarker into the filter field and select the Freemarker IDE component for installation (you may see this repeated, but you only need to select one instance of it). Use the dialog to walk through the remainder of the installation.

More information on installing JBoss Tools components is available on the JBoss site.

Configuring Eclipse

Share Extras re-uses the general Alfresco Coding Standards, and therefore if you are going to modify any existing code or create your own projects, you should configure these as the default formatting rules in Eclipse.

Specifically, the coding standards specify 4-space tabbing and spaces instead of tabs. Eclipse should be configured to use this standard for all text files, following the instructions on that page.

Eclipse provides the ability to save code style attributes as named presets, which you are encouraged to use. Please use the recommended Share Extras JavaScript formatter settings if you can.

Importing Existing Projects into Eclipse

It is straightforward to import existing Share Extras projects using Eclipse's Import dialog (File > Import).

When the dialog appears, select Git > Project from Git from the list of sources, select URI as the Repository Source and in the next step enter the Git URI provided on the repository home page. If you have not yet configured a Git Connector you should be prompted to do so here. See the instructions in Installing Git Team Provider, above for information on this.

Creating New Projects

To create new projects of your own it is recommended that you use the Sample Dashlet project to provide a basic project structure and Ant build script. Using Git you can easily clone the project into a new local directory, then start making your changes, e.g.

git clone my-new-project

When you commit your changes, ensure that you include all files in the commit, aside from your build directory, which should be added to .gitignore.

General information on contributing to Share Extras is available on the [Contribution Process](Contribution Process) page.

Building Projects using Ant

Since Eclipse has built-in support for building projects using Ant, you can use this to build your projects, rather than invoking Ant from the command line.

Ant will manage your build configurations for you on a per-project basis. To set up a build configuration you will need to highlight the build.xml file in your project structure, then click Run > External Tools > Run As > Ant Build.... You should then be presented with the Edit Configuration dialog where you can choose the build target you require and change parameters.

Once you have navigated through the menu structure once, you should see that the External Tools icon also appears in the Java EE perspective toolbar, which provides much quicker access!

You should also find that once created, recently-accessed profiles can be executed with a single click from this menu.

Information on the different build targets provided in the stock build.xml is provided in the ample Dashlet project. If you need to set specific properties at build time, e.g. tomcat.home, you can do this on a per-configuration basis in the Edit Configuration dialog, or globally in the Properties tab under Window > Preferences > Ant > Runtime.

Clone this wiki locally
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.