Setup the production environment for Openflexo

In this article, you will learn how to get started in setting up a development environment for openflexo infrastructure, using eclipse IDE.

Gradle is now used as production tool for the whole Openflexo infrastructure.

1. Get eclipse, and configure your enviroment

As a preliminary phase, you should:

Because of the use of gradle as production tool, you should install BuildShip 2.0 or above.

To do that,

1-InstallBuildShip

2. Import Openflexo Production Component

Switch to Git repository perspective.

Click on “Clone a Git repository”, to import source code from github (where openflexo source code is available)

2-ImportOpenflexoProduction1

At this step you must to fill the URI of the openflexo-production repository which is https://github.com/openflexo-team/openflexo-production or ssh://git@github.com/openflexo-team/openflexo-production.git When you have filled the URI, the Host and Repository path are automatically setup, so just click on Next.

The next wizard presents the different branches associated with openflexo-production project. Select 0.5 branch, and click Next

2-ImportOpenflexoProduction2

Select a local GIT directory, and click Finish

2-ImportOpenflexoProduction3

Switch to Java perspective, right-click and select Import…

2-ImportOpenflexoProduction4

Select “Existing Gradle Project”, and click Next

2-ImportOpenflexoProduction5

Select Next on following wizard.

2-ImportOpenflexoProduction6

Select folder for project root directory: here /Users/sylvain/GIT/openflexo-production, and click Next

2-ImportOpenflexoProduction7

Select “Gradle wrapper” and click Next.

2-ImportOpenflexoProduction8

Click Finish.

Project “openflexo-production” should be successfully imported in your environment.

3-OpenflexoProductionProject

Contained projects should be visible in your workspace.

3. Import Connie component.

Do the same for Connie component, using https://github.com/openflexo-team/connie

4-ImportConnie

After having imported the project in your workspace, you may experience some compilation issues, caused by some problems with gradle/eclipse integration.

5-ConnieIssues1

You must first run “build” task for connie-parser (in the gradle task view), to generate and compile sablecc grammar.

Then, refresh connie-parser project (Gradle>Refresh Gradle Project), and select build/generated-sources/sablecc folder. In needed, Right-click and select Build Path > Use as source folder.

5-ConnieIssues2

Those sources will be added to build path, and compilation issues should disappear.

An other small issue might also appear: compilation issues in flexoutils project, in src/test/resources. In fact, those files are resources and should not be compiled. To exclude them from java build path, select those folders, right-click and select Build Path > Exclude.

5-ConnieIssues3

Your Connie projects should all compile now.

4. Import other components

In the same way you can import any other openflexo projects from the openflexo git repository. Project URIs are :

Note that the projects to import only depend on your needs. It is really rare that you need to modify all components of Openflexo infrastructure. You may develop on only one project. In this case, all other projects will be imported as jars from Openflexo artifactory.

Branches to use are those (for 1.8.1 infrastructure) :

Components Branch
OpenflexoProduction 0.5
Connie 1.4
Pamela 1.4
Gina 2.1
Diana 1.4
OpenflexoUtils 1.4
OpenflexoCore 1.8.1
TechnologyAdapters 1.8.1
OpenflexoModules 1.8.1
OpenflexoPackaging 1.8.1
Modelers (optional) 1.8.1

Warning: When importing OpenFlexoCore you will have to build a parser. Do as for Connie: * You must first run “build” task for fml-parser (in the gradle task view), to generate and compile sablecc grammar. * Then, refresh fml-parser project (Gradle>Refresh Gradle Project), and select build/generated-sources/sablecc folder. In needed, Right-click and select Build Path > Use as source folder.

Warning: Some errors may remain (We use some special Java features). You may have to change the eclipse preferences for the Java:Compiler:Errors/Warnings see below.

9-CompilerPrefsWarning

Finally your workspace should contains your set of imported projects.

5. Run Openflexo packaging

To run from Eclipse an Openflexo packaging from openflexo-packaging project, create a new Eclise Run Configuration. Set the project to one of the existing packagings(flexomaintainer, flexosemantics, flexosemanticsplus…) And the main class org.openflexo.Flexo (depending on eclipse version, searching feature does not find org.openflexo.Flexo class, so you have to enter it manually)

6-LaunchConfig1

6-LaunchConfig2

6. Configure Push to Upstream

Open the git perspective, and right click on the project for which you want to push your commits, and select properties.

  • Set the autocrlf property to true
  • Set the push properties
  • Check the github url(should be ssh).

7-PushPullConfig

7. Resolving dependancies using eclise

Depending on components you have downloaded on your environement, you may experience issues with eclipse production, where dependancies are resolved using jars, and not projects that are checkouted in your environment.

Building 2.0 supports now this as composite builds.

To enable this, you should edit file settings.gradle located in openflexo-packaging project, and uncomment following lines:

file('../').listFiles().each { File otherProject ->
    if (!otherProject.equals(file('.')) && new File(otherProject, "build.gradle").exists()) {
        includeBuild otherProject
    }
}

Then right click on openflexo-packaging project, and right click: Gradle > Refresh gradle project

All dependancies to projects located in your environment should now be correctely resolved.

8. Recommandations to develop on Openflexo infrastructure

Here are the standard configuration for save actions that are to be used in Openflexo developers team:

8-SaveActions