How to create new SNAP modules using SNAP maven archetypes

Requirements

  • build SNAP from sources.

check How to build SNAP from sources for guidelines.

  • build the SNAP Archetypes source code

Clone the SNAP Archetypes source code from GIT into a local directory referred to a ${snap-archetypes} from here on:

cd ${snap-archetypes} git clone https://github.com/senbox-org/snap-archetypes.git

Build SNAP Archetypes:

mvn clean install

Setting up the IntelliJ IDEA

  1. Create a new project with the option "Project from existing sources", by choosing the pom.xml from ${snap-archetypes}

    create project screenshot
  2. Set the used JDK for the project.

    select the JDK for new pro

Usage of SNAP Archetypes

After making sure that snap-archetypes are successfully build, these can be used when creating new SNAP modules.

Assuming that snap-engine, snap-desktop and the preferred toolboxes (s1tbx, s2tbx, s3tbx) are locally cloned and build under ${snap} directory, one can chose a project (among the above enumerated) where a new module using a SNAP archetypes will be added.

From IntelliJ, being positioned on the parent project where a new module will be added, the steps are the following:

  • File -> New Module

  • check the "Create from Archetype" checkbox

  • first register the needed SNAP archetype by Add Archetype button (make sure to write here the details that are in the specific pom.xml of the chosen achetype (found under ${snap-archetypes})

  • select the newly added archetype from the list, as the archetype to be used for the new module

  • enter the artifactId for the new module

  • confirm the properties for the new module (here extra properties can be added when needed)

  • finish the setup

  • check the log of Intelij IDEA to check if the new module was successfully created.

  • build the newly created module to check if correctly integrated with parent module

Note

If something goes wrong (e.g. wrong details provided when adding an archetype), these can be found under:

%userdir%\.IdeaIC[version]\system\Maven\Indices\UserArchetypes.xml

This is an XML file that can be easily modified. For deleting a wrong registered archetype, just delete the corresponding element, inside list.

Further read How to run and debug SNAP from an IDE.

 

Related pages