Skip to content

Development Note

Binod edited this page Apr 9, 2019 · 38 revisions

Setup development environment

Prerequisites

IDE

Intellij

More details

  • Java 8

    • From Project panel, click on root item and press F4
    • Normally, java 1.8 will be available in Project SDK under Project session.
      java8_1
    • If it is not available, click on New -> JDK
    • Browser to your JDK8 installation folder
    • Click OK to save your changes
      java8
  • Gradle

    • From Intellij menu, open File -> Settings
    • From left panel search box, input 'gradle'
    • Select Gradle session under Build, Execution, Deployment -> Build Tools
    • From right panel, check on the Use gradle 'wrapper' task configuration then press OK
      gradle
  • Importing code style

    • Download and unzip the templates from here
    • From Intellij menu, open File -> Settings, select Editor -> Code Style session
    • From right panel, click to settings icon, select Import Scheme -> Intellij IDEA code style XML
      codestyle1
    • Browser to your code style downloaded above, select java-intellij-zero-style.xml then Ok.
      codestyle2
    • The ZeroStyle scheme will be available and selected by default. codestyle3
    • Click OK to close Setting panel and apply your changes.
  • Install Intellij lombok plugin

    • From Intellij menu, open File -> Settings, select Plugins session
    • Open Marketplace tab, from the plugins search box (right panel), input 'lombok' then Enter
    • From the search result, Lombok plugin will be available, click on Install button
  • Enable Annotation processing

    • From Intellij menu, open File -> Settings, select Build, Execution, Deployment -> Compiler -> Annotation Processors
    • From the right panel, check on Enable annotation processing then press OK
      annotation
  • Enable auto generate src folder

    • File -> Settings -> Build, Execution, Deployment -> Gradle -> check the "Create directories for empty content roots automatically" autogenerate

Eclipse

More details

TBD

Docker

More details

Linux and Windows

Running docker remotely

It is useful when your development environment is Windows but docker is running in Linux

  • Install virtual machine running Linux (VMWare or Oracle virtual toolbox)
  • Install docker in your Linux virtual machine
  • Enable remote api in your docker host. Follow this guide
  • Verifying remote api is enabled by opening http://$docker_remote_host_ip:$docker_remote_port/containers/json in Web browser from Windows machine.
    Replace $docker_remote_host_ip by your docker host's ip and $docker_remote_port by your setting port in previous step.
    For example http://192.168.100.119:2376/containers/json
    Noted: the response could be empty if there is no running container in your docker
  • In your Windows machine, install chocolately
  • Running following command to install docker cli
    choco install docker
    

Get Started

Required

  • Prerequisites
  • Docker is desirable. Refers useful startup scripts
  • Create nexus.secret.properties with content:
    nexusSnapshotUrl=http://<your-nexus-server>/repository/maven-snapshots/
    nexusReleaseURL=http://<your-nexus-server>/repository/maven-releases/
    nexusUsername=<your-nexus-user>
    nexusPassword=<your-nexus-password>
  • Create docker.secret.properties with content:
    dockerHost=<your-docker-host>
    • linux|macos: unix:///var/run/docker.sock
    • windows: tcp://<your_docker_host>:<your_docker_port>

Build

  • Build local: compile and build to jar file, then push artifact to local maven repository.

    gradle clean jooq build uberJar
  • Publish artifacts to Nexus server:

    gradle publish

Run Sandbox

  • Build docker image: gradle clean jooq build docker
  • Refers Sandbox

Interact REST API

Will be part of Swagger UI soon. Try Postman version first.