Build with IntelliJ IDEA

Assumptions

  • You have fulfilled all the dev pre-requisites.
  • Source code is located in ~/Asqatasun (i.e. you made your git clone from your $HOME).

Import project

In IntelliJ, choose File > New > Project from existing sources....

Then you need to import project from external model, and choose Maven.

If you don’t do that, you won’t be able to build/run Asqatasun.

(Re)Load Maven project

Reloading “all Maven projects” is needed to automatically discover and configure SpringBoot projects. To do so: press SHIFT+SHIFT, type in reload all maven projects and validate.

After the Maven projects are reloaded and indexed, IntelliJ offers the ability to user Services to manage Spring Boot run configuration: accept this.

A good way to verify the projects are correctly reloaded is to go to File > Project Structure or CTRL+ALT+SHIFT+S. In the Problems section, you should have zero entry.

Configure Maven Wrapper

You must configure the project to leverage Maven Wrapper. To do so:

  • get to File > Settings... (CTRL-ALT-S),
  • navigate to Build, Execution, Deployment > Build Tools > Maven,
  • set parameter Maven home path to value Use Maven wrapper.

Here is a screenshot from IntelliJ 2021.3.2:

Edit Run/Debug configurations > Asqatasun Webapp

From projet root, do:

cd web-app/asqatasun-web-app/src/main/resources
ln -s ../webapp/public public

(More information on this in issue #639)

Get to Run > Edit configurations.... Under Spring Boot, click on AsqatasunWebappApplication. Add the following values:

  • VM Options: -Dwebdriver.gecko.driver=/opt/geckodriver -Djdbc.url="jdbc:mysql://localhost:3307/asqatasun"
  • Working directory: $MODULE_WORKING_DIR$

Here is a screenshot from IntelliJ 2021.3.2:

Note: in IntelliJ 2021.3.3, this dialog has slightly changed; to get Working directory, you should click on Modify options, then tick Working directory to make it appear in the main dialog.

Edit Run/Debug configurations > Asqatasun Server

Get to Run > Edit configurations.... Under Spring Boot, click on AsqatasunServer. Add the following values:

  • VM Options: -Dwebdriver.gecko.driver=/opt/geckodriver -Djdbc.url="jdbc:mysql://localhost:3307/asqatasun"

Configuration of Spring Boot projects

Source code holds many projects but two of them are real entrypoints:

  • Asqatasun Webapp: the historical Asqatasun with the engine and the web-application.
  • Asqatasun Server: added since v5.0.0, it holds the engine and the REST API.

In a Spring Boot project, all the configuration lies in application.yml. Here are the respective paths:

  • Webapp: web-app/asqatasun-web-app/src/main/resources/application.yml
  • Server: server/asqatasun-server/src/main/resources/application.yml

You can override configuration with arguments passed as VM options. Get inspired by what we do in Build CLI, or how we do in production installation using systemd units + a local configuration file.

Globally, configuration can be overridden thanks to Spring Boot Externalized configuration .

Execute

  • Run> Run.. and choose AsqatasunWebappApplication or AsqatasunServer
  • Then browse http://localhost:8080/ and connect with credentials:
    • login: admin@asqatasun.org
    • password: myAsqaPassword

For Asqatasun Server, in the Swagger UI, you must change the value of contractId from 0 to 1 or your request will end in a 500 error.