Building SNAP from sources : errors during the "mvn clean install"

Dear SNAP users and developers,

Sorry if the topic is not in the exact category. Feel free to change if needed.

For some reasons, I need to apply some modification / integrate new functionalities to SNAP. To do so, I try to follow this tutorial : this tutorial

Well, I’m not a Java expert. I did some projects in Java using Eclipse when I was still a student but that’s all. I’m stuck quite rapidly during the build of SNAP from sources

cd snap
git clone https://github.com/senbox-org/snap-engine.git
cd snap-engine
mvn clean install

At the mvn clean install, I have the following error :

WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by com.google.inject.internal.cglib.core.$ReflectUtils$1 (file:/usr/share/maven/lib/guice.jar) to method java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int,java.security.ProtectionDomain)
WARNING: Please consider reporting this to the maintainers of com.google.inject.internal.cglib.core.$ReflectUtils$1
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
[INFO] Scanning for projects...
[WARNING] 
[WARNING] Some problems were encountered while building the effective model for org.esa.snap:snap-gpf:nbm:7.0.0-SNAPSHOT
[WARNING] 'dependencies.dependency.systemPath' for com.oracle:tools:jar refers to a non-existing file /usr/local/java/jdk-10/../lib/tools.jar. Please verify that you run Maven using a JDK and not just a JRE. @ org.esa.snap:snap-gpf:[unknown-version], /home/qg/snap_dev/snap-engine/snap-gpf/pom.xml, line 96, column 33
[WARNING] 
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[WARNING] 
[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
[WARNING] 
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Build Order:
[INFO] 
[INFO] SNAP Engine Project
[INFO] Ceres Runtime Library
[INFO] Ceres Binding
[INFO] Ceres JAI Library
[INFO] Ceres GLayer Library
[INFO] Ceres User Interface Library
[INFO] Ceres Binary I/O Library
[INFO] Ceres Metadata handling Library
[INFO] SNAP Runtime
[INFO] SNAP Core Library
[INFO] SNAP Graph Processing Framework (GPF)
[INFO] SNAP Engine Utilities
[INFO] HDF Library
[INFO] SNAP ArcInfo Binary Grid Reader
[INFO] SNAP GeoTIFF/BigTIFF Product Reader
[INFO] SNAP NetCDF Product Reader/Writer
[INFO] SNAP Envisat Product Reader
[INFO] NASA Blue Marble Worldmap
[INFO] SNAP Level-3 Binning Processor (GPF)
[INFO] SNAP Classification
[INFO] SNAP Cluster Analysis
[INFO] SNAP Collocation Operator
[INFO] SNAP CSV Product Reader/Writer
[INFO] SNAP GeoTIFF Product Reader/Writer
[INFO] SNAP Digital Elevation Models
[INFO] SNAP ENVI Product Reader
[INFO] GETASSE30 DEM
[INFO] HDF5 Product Writer
[INFO] SNAP Jython Interface
[INFO] SNAP Land Cover
[INFO] SNAP NDVI Processor
[INFO] SNAP Product Conversion Tool
[INFO] SNAP PGX Product Reader
[INFO] SNAP Pixel Extraction Tool
[INFO] SNAP Python Interface
[INFO] SNAP Raster Operators
[INFO] SNAP Statistics Operator
[INFO] SNAP Temporal Percentile Operator
[INFO] SNAP Spectral Unmixing Tool
[INFO] SNAP Watermask Operator
[INFO] ESA GlobCover Worldmap
[INFO] SNAP Smart Configurator
[INFO] SNAP Standalone Tool Adapter
[INFO] SNAP Engine Kit Module
[INFO] SNAP Raw, tiled pyramid product I/O (experimental)
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building SNAP Engine Project 7.0.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ snap-engine ---
[INFO] 
[INFO] --- maven-enforcer-plugin:1.4.1:enforce (enforce-versions) @ snap-engine ---
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO] 
[INFO] SNAP Engine Project ................................ FAILURE [  0.196 s]
[INFO] Ceres Runtime Library .............................. SKIPPED
[INFO] Ceres Binding ...................................... SKIPPED
[INFO] Ceres JAI Library .................................. SKIPPED
[INFO] Ceres GLayer Library ............................... SKIPPED
[INFO] Ceres User Interface Library ....................... SKIPPED
[INFO] Ceres Binary I/O Library ........................... SKIPPED
[INFO] Ceres Metadata handling Library .................... SKIPPED
[INFO] SNAP Runtime ....................................... SKIPPED
[INFO] SNAP Core Library .................................. SKIPPED
[INFO] SNAP Graph Processing Framework (GPF) .............. SKIPPED
[INFO] SNAP Engine Utilities .............................. SKIPPED
[INFO] HDF Library ........................................ SKIPPED
[INFO] SNAP ArcInfo Binary Grid Reader .................... SKIPPED
[INFO] SNAP GeoTIFF/BigTIFF Product Reader ................ SKIPPED
[INFO] SNAP NetCDF Product Reader/Writer .................. SKIPPED
[INFO] SNAP Envisat Product Reader ........................ SKIPPED
[INFO] NASA Blue Marble Worldmap .......................... SKIPPED
[INFO] SNAP Level-3 Binning Processor (GPF) ............... SKIPPED
[INFO] SNAP Classification ................................ SKIPPED
[INFO] SNAP Cluster Analysis .............................. SKIPPED
[INFO] SNAP Collocation Operator .......................... SKIPPED
[INFO] SNAP CSV Product Reader/Writer ..................... SKIPPED
[INFO] SNAP GeoTIFF Product Reader/Writer ................. SKIPPED
[INFO] SNAP Digital Elevation Models ...................... SKIPPED
[INFO] SNAP ENVI Product Reader ........................... SKIPPED
[INFO] GETASSE30 DEM ...................................... SKIPPED
[INFO] HDF5 Product Writer ................................ SKIPPED
[INFO] SNAP Jython Interface .............................. SKIPPED
[INFO] SNAP Land Cover .................................... SKIPPED
[INFO] SNAP NDVI Processor ................................ SKIPPED
[INFO] SNAP Product Conversion Tool ....................... SKIPPED
[INFO] SNAP PGX Product Reader ............................ SKIPPED
[INFO] SNAP Pixel Extraction Tool ......................... SKIPPED
[INFO] SNAP Python Interface .............................. SKIPPED
[INFO] SNAP Raster Operators .............................. SKIPPED
[INFO] SNAP Statistics Operator ........................... SKIPPED
[INFO] SNAP Temporal Percentile Operator .................. SKIPPED
[INFO] SNAP Spectral Unmixing Tool ........................ SKIPPED
[INFO] SNAP Watermask Operator ............................ SKIPPED
[INFO] ESA GlobCover Worldmap ............................. SKIPPED
[INFO] SNAP Smart Configurator ............................ SKIPPED
[INFO] SNAP Standalone Tool Adapter ....................... SKIPPED
[INFO] SNAP Engine Kit Module ............................. SKIPPED
[INFO] SNAP Raw, tiled pyramid product I/O (experimental) . SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.840 s
[INFO] Finished at: 2018-06-27T10:00:10+02:00
[INFO] Final Memory: 23M/200M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-enforcer-plugin:1.4.1:enforce (enforce-versions) on project snap-engine: Execution enforce-versions of goal org.apache.maven.plugins:maven-enforcer-plugin:1.4.1:enforce failed: An API incompatibility was encountered while executing org.apache.maven.plugins:maven-enforcer-plugin:1.4.1:enforce: java.lang.ExceptionInInitializerError: null
[ERROR] -----------------------------------------------------
[ERROR] realm =    plugin>org.apache.maven.plugins:maven-enforcer-plugin:1.4.1
[ERROR] strategy = org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy
[ERROR] urls[0] = file:/home/qg/.m2/repository/org/apache/maven/plugins/maven-enforcer-plugin/1.4.1/maven-enforcer-plugin-1.4.1.jar
[ERROR] urls[1] = file:/home/qg/.m2/repository/backport-util-concurrent/backport-util-concurrent/3.1/backport-util-concurrent-3.1.jar
[ERROR] urls[2] = file:/home/qg/.m2/repository/org/codehaus/plexus/plexus-interpolation/1.11/plexus-interpolation-1.11.jar
[ERROR] urls[3] = file:/home/qg/.m2/repository/org/slf4j/slf4j-jdk14/1.5.6/slf4j-jdk14-1.5.6.jar
[ERROR] urls[4] = file:/home/qg/.m2/repository/org/slf4j/jcl-over-slf4j/1.5.6/jcl-over-slf4j-1.5.6.jar
[ERROR] urls[5] = file:/home/qg/.m2/repository/org/apache/maven/reporting/maven-reporting-api/2.2.1/maven-reporting-api-2.2.1.jar
[ERROR] urls[6] = file:/home/qg/.m2/repository/org/apache/maven/doxia/doxia-sink-api/1.1/doxia-sink-api-1.1.jar
[ERROR] urls[7] = file:/home/qg/.m2/repository/org/apache/maven/doxia/doxia-logging-api/1.1/doxia-logging-api-1.1.jar
[ERROR] urls[8] = file:/home/qg/.m2/repository/commons-cli/commons-cli/1.2/commons-cli-1.2.jar
[ERROR] urls[9] = file:/home/qg/.m2/repository/org/codehaus/plexus/plexus-interactivity-api/1.0-alpha-4/plexus-interactivity-api-1.0-alpha-4.jar
[ERROR] urls[10] = file:/home/qg/.m2/repository/org/sonatype/plexus/plexus-sec-dispatcher/1.3/plexus-sec-dispatcher-1.3.jar
[ERROR] urls[11] = file:/home/qg/.m2/repository/org/sonatype/plexus/plexus-cipher/1.4/plexus-cipher-1.4.jar
[ERROR] urls[12] = file:/home/qg/.m2/repository/org/codehaus/plexus/plexus-utils/3.0.22/plexus-utils-3.0.22.jar
[ERROR] urls[13] = file:/home/qg/.m2/repository/commons-lang/commons-lang/2.3/commons-lang-2.3.jar
[ERROR] urls[14] = file:/home/qg/.m2/repository/org/apache/maven/enforcer/enforcer-api/1.4.1/enforcer-api-1.4.1.jar
[ERROR] urls[15] = file:/home/qg/.m2/repository/org/apache/maven/enforcer/enforcer-rules/1.4.1/enforcer-rules-1.4.1.jar
[ERROR] urls[16] = file:/home/qg/.m2/repository/org/apache/maven/shared/maven-common-artifact-filters/1.4/maven-common-artifact-filters-1.4.jar
[ERROR] urls[17] = file:/home/qg/.m2/repository/org/beanshell/bsh/2.0b4/bsh-2.0b4.jar
[ERROR] urls[18] = file:/home/qg/.m2/repository/org/apache/maven/shared/maven-dependency-tree/2.2/maven-dependency-tree-2.2.jar
[ERROR] urls[19] = file:/home/qg/.m2/repository/org/codehaus/plexus/plexus-component-annotations/1.5.5/plexus-component-annotations-1.5.5.jar
[ERROR] urls[20] = file:/home/qg/.m2/repository/org/eclipse/aether/aether-util/0.9.0.M2/aether-util-0.9.0.M2.jar
[ERROR] urls[21] = file:/home/qg/.m2/repository/org/codehaus/plexus/plexus-i18n/1.0-beta-6/plexus-i18n-1.0-beta-6.jar
[ERROR] urls[22] = file:/home/qg/.m2/repository/org/apache/maven/plugin-testing/maven-plugin-testing-harness/1.3/maven-plugin-testing-harness-1.3.jar
[ERROR] urls[23] = file:/home/qg/.m2/repository/org/codehaus/plexus/plexus-archiver/2.2/plexus-archiver-2.2.jar
[ERROR] urls[24] = file:/home/qg/.m2/repository/org/codehaus/plexus/plexus-io/2.0.4/plexus-io-2.0.4.jar
[ERROR] urls[25] = file:/home/qg/.m2/repository/junit/junit/4.11/junit-4.11.jar
[ERROR] urls[26] = file:/home/qg/.m2/repository/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3.jar
[ERROR] Number of foreign imports: 1
[ERROR] import: Entry[import  from realm ClassRealm[project>org.esa.snap:snap-engine:7.0.0-SNAPSHOT, parent: ClassRealm[maven.api, parent: null]]]
[ERROR] 
[ERROR] -----------------------------------------------------: begin 0, end 3, length 2
[ERROR] -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginContainerException

I would really appreciate any help. Thanks in advance

Note that java / maven / git are installed. My OS is Linux Mint 18.3 (cinnamon)

This happens when you use Java 9 or 10. SNAP is not yet compatible with these Java versions.
You can either switch to Java 8, that’s what I would suggest, or you can change how Java is handling these incompatibility issues.
You can read more about it here: https://docs.oracle.com/javase/9/migrate/toc.htm#JSMIG-GUID-7BB28E4D-99B3-4078-BDC4-FC24180CE82B

Thank you. I will try then update to let you know if it can be considered as solution

We are progressing. however, I still have a issue …

Here are the last lines, including the relevant info. The problem arise at the SNAP CORE LIBRARY. Do you know what may cause this issue. I tried to find but failed.

Tests run: 1422, Failures: 2, Errors: 0, Skipped: 11

[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO] 
[INFO] SNAP Engine Project ................................ SUCCESS [  0.306 s]
[INFO] Ceres Runtime Library .............................. SUCCESS [  8.047 s]
[INFO] Ceres Binding ...................................... SUCCESS [  2.115 s]
[INFO] Ceres JAI Library .................................. SUCCESS [  3.241 s]
[INFO] Ceres GLayer Library ............................... SUCCESS [  2.676 s]
[INFO] Ceres User Interface Library ....................... SUCCESS [  6.381 s]
[INFO] Ceres Binary I/O Library ........................... SUCCESS [  1.961 s]
[INFO] Ceres Metadata handling Library .................... SUCCESS [  2.372 s]
[INFO] SNAP Runtime ....................................... SUCCESS [  0.327 s]
[INFO] SNAP Core Library .................................. FAILURE [ 14.901 s]
[INFO] SNAP Graph Processing Framework (GPF) .............. SKIPPED
[INFO] SNAP Engine Utilities .............................. SKIPPED
[INFO] HDF Library ........................................ SKIPPED
[INFO] SNAP ArcInfo Binary Grid Reader .................... SKIPPED
[INFO] SNAP GeoTIFF/BigTIFF Product Reader ................ SKIPPED
[INFO] SNAP NetCDF Product Reader/Writer .................. SKIPPED
[INFO] SNAP Envisat Product Reader ........................ SKIPPED
[INFO] NASA Blue Marble Worldmap .......................... SKIPPED
[INFO] SNAP Level-3 Binning Processor (GPF) ............... SKIPPED
[INFO] SNAP Classification ................................ SKIPPED
[INFO] SNAP Cluster Analysis .............................. SKIPPED
[INFO] SNAP Collocation Operator .......................... SKIPPED
[INFO] SNAP CSV Product Reader/Writer ..................... SKIPPED
[INFO] SNAP GeoTIFF Product Reader/Writer ................. SKIPPED
[INFO] SNAP Digital Elevation Models ...................... SKIPPED
[INFO] SNAP ENVI Product Reader ........................... SKIPPED
[INFO] GETASSE30 DEM ...................................... SKIPPED
[INFO] HDF5 Product Writer ................................ SKIPPED
[INFO] SNAP Jython Interface .............................. SKIPPED
[INFO] SNAP Land Cover .................................... SKIPPED
[INFO] SNAP NDVI Processor ................................ SKIPPED
[INFO] SNAP Product Conversion Tool ....................... SKIPPED
[INFO] SNAP PGX Product Reader ............................ SKIPPED
[INFO] SNAP Pixel Extraction Tool ......................... SKIPPED
[INFO] SNAP Python Interface .............................. SKIPPED
[INFO] SNAP Raster Operators .............................. SKIPPED
[INFO] SNAP Statistics Operator ........................... SKIPPED
[INFO] SNAP Temporal Percentile Operator .................. SKIPPED
[INFO] SNAP Spectral Unmixing Tool ........................ SKIPPED
[INFO] SNAP Watermask Operator ............................ SKIPPED
[INFO] ESA GlobCover Worldmap ............................. SKIPPED
[INFO] SNAP Smart Configurator ............................ SKIPPED
[INFO] SNAP Standalone Tool Adapter ....................... SKIPPED
[INFO] SNAP Engine Kit Module ............................. SKIPPED
[INFO] SNAP Raw, tiled pyramid product I/O (experimental) . SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 42.907 s
[INFO] Finished at: 2018-06-27T15:20:09+02:00
[INFO] Final Memory: 83M/1945M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.18.1:test (default-test) on project snap-core: There are test failures.
[ERROR] 
[ERROR] Please refer to /home/qg/snap_dev/snap-engine/snap-core/target/surefire-reports for the individual test results.
[ERROR] -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
[ERROR] 
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR]   mvn <goals> -rf :snap-core

From this log I can’t see which tests fail.
There must be some more information above or in the folder:
/home/qg/snap_dev/snap-engine/snap-core/target/surefire-reports

I only have .xml files in it (262 in total). Do you need one in particular?

Just to let you know : the installation of snap-desktop, however, went without any problem. Just had to put a sudo before the mvn clean install

Update :

sudo mvn clean install -DskipTests=true

fixed the issue. It’s now built. Thanks for your help

In one of the xml file should be more information. The one of the failed test. I guess the size is a bit bigger as the size of the others.

Okay, if you don’t execute the tests they will not fail. :slight_smile:
Maybe some of the tests fail because of the same reason you need to run maven with sudo rights.

Thanks for you help. I’ve now modified SNAP functionalities and it works like a charm

If I may say, I would just add to this page
How to run and debug SNAP from an IDE - IntelliJ IDEA
a few words related to some problems I encountered :

  1. Use the sudo command before the mvn clean install if needed
  2. Make sure to use Java 8 (not 10)
  3. Use the JDK and not the JRE
  4. Make sure to activate the oracle-tools -> Problems running tests in intellij
  5. Make sure IntelliJ IDEA has read/write permission on your installation folder
  6. In the VM options , only 4Go are dedicated, leading to unavoidable problems in many computations. I would increase a bit the value.
1 Like

Done.
Thank you very much for your input.

Hello
I am trying to build SNAP from source using guide found here: https://senbox.atlassian.net/wiki/spaces/SNAP/pages/24051775/IntelliJ+IDEA

I am able to build and launch SNAP but s1tbx plugin was not showing in SNAP desktop app launched from source using Intellij. I installed s1tbx by sudo mvn clean install -DskipTests=true
Is this issue relate to the setting of Program arguments?
Please, can someone help me fix the issue of s1tbx plugin?
Thank you.