Skip to content

Dev Setup

Fabrice Daugan edited this page Jul 1, 2020 · 9 revisions

Configuring a development environment

Tools

For Java code

For everything else

Database setup

For the below samples, a MySQL server for ligoj-api container is needed.

Note: At the first start, schema is updated/created and the initial data is inserted into the database.

With your own database

mysql --user=root
CREATE DATABASE `ligoj` DEFAULT CHARACTER SET utf8mb4 DEFAULT COLLATE utf8mb4_bin;
CREATE USER 'ligoj'@'localhost' IDENTIFIED BY 'ligoj';
GRANT ALL ON `ligoj`.* TO 'ligoj'@'localhost';
FLUSH PRIVILEGES;
quit

With a fresh new database

docker run --name ligoj-db -d -p 3306:3306 -e MYSQL_RANDOM_ROOT_PASSWORD=yes -e MYSQL_DATABASE=ligoj -e MYSQL_USER=ligoj -e MYSQL_PASSWORD=ligoj -d mysql:5.7

Building

Docker build (ARG) variables:

NEXUS_URL : Repository base host used to download the WAR files
VERSION   : Ligoj version, used to build the WAR_URL
WAR_URL   : Full WAR URL, built from NEXUS_URL and VERSION

Running

With Maven CLI

git clone https://github.com/ligoj/ligoj
mvn spring-boot:run -f app-api/pom.xml& 
mvn spring-boot:run -f app-ui/pom.xml&

With your IDE

From your IDE, without Maven runner (but Maven classpath contribution), create and execute 2 run configurations with the following main classes :

org.ligoj.boot.api.Application
org.ligoj.boot.web.Application

Notes these launchers (*.launch) are already configured for Eclipse. See Wiki page for more information.

Packaging

When the WAR is built you can enable minified CSS/JS with the maven profile 'minify'. This requires 'clean-css-cli' NPM module.

npm install clean-css-cli -g
mvn clean package -Pminifiy -DskipTests=true

Deploying

Nexus OSS

mvn clean deploy -Dgpg.skip=false -Psources,javadoc,minify -DskipTests=true

Bintray

mvn deploy -Dgpg.skip=false -Psources,javadoc,bintray,minify -DskipTests=true

Setup notices

For Eclipse compiler, enable 'Store information about method parameters (usable with reflection)' in general preferences/Java/Compiler