Prerequisites

Additional tools

The patch program is needed.

For Debian GNU / Linux and derivatives (as Ubuntu), install with

sudo apt install patch

On RPM yum style GNU / Linux systems, install with:

sudo yum install patch

On RPM dnf style GNU / Linux systems, install with:

sudo dnf install patch

On Windows you can find it in several distributions including GNUWin32

Building Syncope

Before building Syncope, you need to setup an environment variable to give Maven more memory.

On Unix

export MAVEN_OPTS="-Xms512m -Xmx1024m"

On Windows

set MAVEN_OPTS=-Xms512m -Xmx1024m

To build Syncope simply execute (from within the top-level source directory):

$ mvn clean install

To build Syncope without running any test nor check do:

$ mvn -PskipTests,all

To build Syncope without running any test nor check, but generating Docker images, do:

$ mvn -PskipTests,all,docker

Code analysis

After build, it is possible to examine code quality by submitting the generated reports to a SonarQube instance. Various installation methods are available, but the quicker seems to be via Docker:
$ docker run -d --name sonarqube -p 9000:9000 -p 9092:9092 sonarqube
Once SonarQube is up and runninig, submit the reports as follows:
$ mvn sonar:sonar
At the end, browse http://localhost:9000/dashboard?id=org.apache.syncope%3Asyncope to see results.

Building documentation

To build Syncope documentation execute (from within the top-level source directory):

$ mvn -N -P site clean generate-resources
The documentation artifacts are now be available under target/generated-docs/.

More build profiles

Besides default, other Maven build profiles are provided, for developer convenience.
Such profiles are limited to a specific module, hence Maven needs to be invoked from the corresponding subdirectory, not from top-level.

fit/core-reference

Other Content-Type values

By default, integration tests are run using application/json for both Accept and Content-Type HTTP headers; it is possible, however, to use application/xml or application/yaml.
$ mvn clean verify -DjaxrsContentType=application/xml
$ mvn clean verify -DjaxrsContentType=application/yaml

Debug

Starts the full environment used by integration tests (with same components available when running new project in embedded mode but console) and enables remote JPDA debugging on port 8000 in the running Java EE container (Tomcat).
$ mvn -Pdebug,all
or, without extensions
$ mvn -Pdebug

Once started in debug mode, individual test methods can be executed as follows (the Maven Surefire Plugins rules apply here):

$ mvn test -Dtest=UserITCase#list

HotSwapAgent

Similar to Debug, but with HotSwapAgent features enabled.
$ mvn -Photswap,all

DBMSes

The build profiles enlisted below require Docker to work.

PostgreSQL

This build profile requires Docker to work.

Perform the full test suite against a real PostgreSQL database via
$ mvn -Ppostgres-it
or
$ mvn -Ppgjsonb-it
(for JSONB support)
MySQL

This build profile requires Docker to work.

Perform the full test suite against a real MySQL database via
$ mvn -Pmysql-it
or
$ mvn -Pmyjson-it
(for JSON support)
MariaDB

This build profile requires Docker to work.

Perform the full test suite against a real MariaDB database via
$ mvn -Pmariadb-it
or
$ mvn -Pmajson-it
(for JSON support)
Oracle database

This build profile requires Docker to work.

Perform the full test suite against a real Oracle database via
$ mvn -Poracle-it
or
$ mvn -Pojson-it
(for JSON support)
MS SQL Server
Prform the full test suite against a real MS SQL Server database via
$ mvn -Psqlserver-it

Java EE containers

Payara
Perform the full test suite by deploying Syncope core in Payara via
$ mvn -Ppayara-it
Wildfly
Perform the full test suite by deploying Syncope core in Wildfly via
$ mvn -Pwildfly-it

External search engines

Elasticsearch

This build profile requires Docker to work.

Perform the full test suite relying on a real Elasticsearch instance via
$ mvn -Pelasticsearch-it
OpenSearch

This build profile requires Docker to work.

Perform the full test suite relying on a real OpenSearch instance via
$ mvn -Popensearch-it

fit/console-reference

Debug

Starts the full environment used by core's integration tests (with same components available when running new project in embedded mode, including Console) and enables remote JPDA debugging on port 8000 in the running Java EE container (Tomcat).
$ mvn -Pdebug

HotSwapAgent

Similar to Debug, but with HotSwapAgent features enabled.
$ mvn -Photswap

fit/enduser-reference

Debug

Starts the full environment used by core's integration tests (with same components available when running new project in embedded mode, including Console and Enduser) and enables remote JPDA debugging on port 8000 in the running Java EE container (Tomcat).
$ mvn -Pdebug

HotSwapAgent

Similar to Debug, but with HotSwapAgent features enabled.
$ mvn -Photswap

fit/wa-reference

Debug

Starts the full environment used by core's integration tests (with same components available when running new project in embedded mode, including Console, Enduser and WA) and enables remote JPDA debugging on port 8000 in the running Java EE container (Tomcat).
$ mvn -Pdebug

HotSwapAgent

Similar to Debug, but with HotSwapAgent features enabled.
$ mvn -Photswap