Wiki

Clone wiki

GoraExplorer / Building

Preparing the development environment

1.Install Sencha Cmd to compile the client

Download and install Sencha Cmd 6.5.3.6.

2. Checkout the project to a local path

#!bash

cd ~/git
git clone https://alfonsonishikawa@bitbucket.org/alfonsonishikawa/goraexplorer.git

3. Install Sencha CMD

Download, unzip and execute Sencha CMD 7.3.1.27 . Install the custom packages repository needed:

#!bash

sencha repo add alfonsonishikawa https://alfonsonishikawa.bitbucket.io/extjspackages/pkgs
sencha package install nishilua-escaped-binds
sencha package install nishilua-server-url-placeholders

3. [Optional] Install Siesta framework

Download and uncompress the file siesta-4.4.1-lite.zip and copy the contents /siesta-4.4.1-lite/* to src/main/webapp/tests/siesta.

Uncomment at src/main/WEB-INF/goraexplorer-security.xml to allow Siesta tests:

#!xml
<headers>
    <frame-options policy="SAMEORIGIN"/>
</headers>
but comment in production since it is a security risk.

4. [Optional] Install JsDuck

$ gem install jsduck

(https://github.com/senchalabs/jsduck/wiki/Installation)

5. Import into Eclipse

File > Import... > Maven > Existing Maven Projects..., browse to ~/git/goraexplorer and select the project.

File > New... > Server, add a Server Runtime Environment if needed for Tomcat 7/8, and add to the new server the project GoraExplorer.

Configure the project's Deployment Assembly as following:

Configure the project's Java Build Path as following:

5.1 Using Tomcat 8+ in Eclipse

It is recommended to check the option "Serve modules without publishing" at the Tomcat server configuration:

But for Tomcat 8+ executing without publishing there are issues when compiling Persistent classes at runtime, so the Tomcat's classpath must be configured as following with the .jar found at project /target after executing mvn clean package.

6. Configure WebStorm

6.1 Minification

Install Uglify-es:

sudo npm install uglify-es -g

Add a scope to Settings > Appearance > Scopes with the pattern file:resources/js/*.js&&!file:*.min.* that will select all .js files in resources/js but not the minified ones, and check "share scope":

Settings_004.png

Enable UglifyJS at Settings > Tools > File Watchers by adding UglifyJS with:

  • Scope: the one created before.
  • Arguments: $FileName$ -o $FileNameWithoutExtension$.min.js -c reduce_vars=false -m --mangle-props regex=/^_/

Edit Watcher_005.png

Execute for development

Run the client continuous compilation:

#!bash

cd src/main/webapp
sencha app build development

Launch the Tomcat server in eclipse.

Browse http://localhost:8080/goraexplorer (the port could be other, take a look the one you configured).

If you want to use the fashion feature that ExtJS has, so any modification to .sass files will be shown without reloading the web page, first update src/main/webapp/app/Config.js:

#!javascript

APP_URL: 'http://localhost:8080/goraexplorer/'

Launch Eclipse Tomcat, and execute Sencha Cmd to run the embedded server:

#!bash

cd src/main/webapp
sencha app watch development

and browse http://localhost:1841/?platformTags=fashion:true

It is not recommended to do the development with sencha app watch because all classes are autoimported and error will be found when just compilin with build.

Building the .war

1. Type of build

Decide what type of build:

  • development
  • testing
  • production

Decide if you want to generate the javadoc and/or jsduck.

2. Generate the .war

Go to / and execute:

#!bash
mvn package -P [development|testing|production] [-DskipTests]

for example mvn package -P production -DskipTests.

You can add the javadoc and jsduck to the .war activating the profiles. For example:

#!bash
mvn package -P development,javadoc,jsduck [-DskipTests]

They will be mapped to the URLS /javadoc and /jsduck in the application.

It will compile the Ext JS client, the java server and you will have the resulting .war at /target.

3. Deploying the war

To deploy the application, copy the file /target/goraexplorer.war into the web applications path of your Tomcat installation, possibly at /usr/lib/tomcat8/webapps/. It will be uncompressed autmatically in the path http[s]://..../goraexplorer/.

The application creates a file with the sqLite database at the Tomcat working directory (not an application specific path). Much probably you will have to give permissions to the installation path:

$ chown tomcat8:tomcat8 /user/lib/tomcat8

Updated