How to build SNAP from sources
Requirements
In order to build SNAP and the toolboxes you need the following software
- For SNAP 10 and master branch: Java JDK = v11 (Any of the available OpenJDK distributions should work).
An overview and page comparison of some of the available JDKs is provided here: https://devexperts.com/blog/oracle-jdk-vs-openjdk-builds-comparison/
We recommend the Liberica JDK from bellsoft. This can be download from the following page: Download OpenJDK Builds for Linux, Windows & macOS (bell-sw.com) - For SNAP 9 and older branches: Java JDK = v8 (recommended is an openJDK distribution)
- Maven >= v3.2.5, recommended 3.9.2
- Git
Checkout the source code
All the code related to SNAP and the Sentinel Toolboxes is hosted on GitHub. Checkout, respectively clone in git terms, the source code repositories into a folder named snap.
cd <myprojects> mkdir snap cd snap git clone https://github.com/senbox-org/snap-engine.git cd snap-engine mvn clean install cd .. git clone https://github.com/senbox-org/snap-desktop.git cd snap-desktop mvn clean install
Some people reported they had to use sudo
in front of mvn clean install
. Usually it should not be necessary but in case you experience problems try sudo.
Build SNAP source code
In order to build the source code the maven install command should be invoked.
cd snap cd snap-engine mvn clean install cd .. cd snap-desktop mvn clean install
Building additional Toolboxes
The following command are for the Microwave Toolbox.
cd snap git clone https://github.com/senbox-org/microwave-toolbox.git cd microwave-toolbox mvn clean install
If you encounter unit-level test failures, build with tests turned off. Please report this in the forum. Actually we should notice this ourselves but sometimes things can slip through our fingers.
mvn clean install -DskipTests=true
Procedure for other toolboxes like the optical or smos toolbox is the same as described above for the microwave toolbox.
You should also consider to checkout the snap-examples project. It might contain valuable example code for you.
Further read How to run and debug SNAP from an IDE.