SPARTA Standalone libraries

The standalone libraries let you use the SPARTA meta-model, the threat elicitation and risk analysis engine, the aggregate analyses and the exporters in your own Java programs, outside Eclipse and without OSGi. They are regular Maven artifacts that you add to your project as dependencies. Two runnable command-line tools, sparta-cli and sparta-ci, are built on top of them (see Command-line tools).

Overview of the standalone artifacts

All artifacts share the groupId be.kuleuven.cs.distrinet.sparta and, for this release, the version 2026.1.0.

The four library artifacts (sparta-model, sparta-core, sparta-analysis and sparta-io) contain no code of their own. They only declare dependencies, so that Maven fetches everything a library needs:

  • the jar of the corresponding SPARTA Eclipse plug-in, published as a plain Maven artifact under the plug-in’s name (for example be.kuleuven.cs.distrinet.sparta.core);

  • the other SPARTA plug-in jars and library artifacts that this plug-in depends on;

  • the third-party libraries it needs, such as EMF, VIATRA and Apache POI.

For example, adding sparta-core to your project also brings in the plug-in jars sparta.core, sparta.queries and sparta.spartamodel, together with EMF and VIATRA. The classes you use are therefore exactly those of the Eclipse plug-ins, with the same packages; they are described in SPARTA Java API.

sparta-cli and sparta-ci do contain their own code. Besides a regular library jar, each of them produces a runnable jar with all dependencies included (classifier shaded).

The artifacts are listed below.

Note

All plug-in and package names below are abbreviated, as in SPARTA in Eclipse: they all start with be.kuleuven.cs.distrinet.. For example, sparta.core stands for be.kuleuven.cs.distrinet.sparta.core.

sparta-model (library)

The SPARTA meta-model (EMF): create, load and save .sparta models and catalogs.

Plug-in: sparta.spartamodel; classes described in Meta-model.

Changed in version 2026.1: RoleBinding.getBindsTo() returns an EList<Asset>, because a role binding can bind its role to several elements, and RoleBinding.setBindsTo(Asset) was removed (see Release notes and Development scenarios).

sparta-core (library)

The threat elicitation and risk analysis engine (Engine) and the threat classes (Threat, PatternThreat).

Plug-ins: sparta.core and sparta.queries; classes described in Threat elicitation and risk analysis.

sparta-analysis (library)

Aggregate analyses over collections of threats (ThreatAggregationAnalysis).

Plug-in: sparta.threatanalysis; classes described in Aggregated risk analyses.

sparta-io (library)

Exporters for collections of threats: CSV, text, XLSX, JSON, code-quality JSON and a LaTeX report.

Plug-in: sparta.io; classes described in Exporters.

sparta-cli (library and runnable shaded jar)

Command-line tool that analyzes a model and exports the results (see Command-line tools).

Packages: sparta.cli, sparta.cli.cmd, sparta.cli.cmd.export

sparta-ci (library and runnable shaded jar)

Variant of sparta-cli for continuous integration pipelines (see Command-line tools).

Packages: sparta.cli.ci

The exported packages of the plug-ins are listed in SPARTA in Eclipse.

Note

Earlier versions of this documentation referred to a standalone-dependencies artifact. It is not part of SPARTA 2026.1; depend on sparta-model (or on a library that includes it) instead.

Dependencies between the artifacts

The graph shows the direct Maven dependencies between the standalone artifacts. Depending on an artifact brings in everything it depends on, so a project that uses sparta-io also gets sparta-analysis, sparta-core and sparta-model.

        flowchart LR
   model["sparta-model"]
   core["sparta-core"]
   analysis["sparta-analysis"]
   io["sparta-io"]
   cli["sparta-cli"]
   ci["sparta-ci"]

   core --> model
   analysis --> core
   analysis --> model
   io --> analysis
   io --> core
   io --> model
   cli --> io
   cli --> analysis
   cli --> core
   cli --> model
   ci --> cli
    

Using the libraries in a Maven project

Configure the repositories as described in Standalone Prerequisites and add a dependency on the library that covers what you need: sparta-model to create, load and save models only, sparta-core to run threat elicitation and risk analysis, and sparta-io for everything including the exporters. For example, a dependency on sparta-io:

<dependency>
   <groupId>be.kuleuven.cs.distrinet.sparta</groupId>
   <artifactId>sparta-io</artifactId>
   <version>2026.1.0</version>
</dependency>

Note

The SPARTA Maven repository hosts the artifacts of published releases, but not 2026.1.0. To use the 2026.1.0 artifacts, build SPARTA from source and install the artifacts into your local Maven repository, as described in Installing the libraries in your local Maven repository. You can skip the RCP product, which you do not need for the libraries.

Some points to keep in mind:

  • The libraries are compiled for Java 11, so a consumer project can target Java 11 or later.

  • VIATRA is not available from Maven Central. It comes from the Eclipse repository https://repo.eclipse.org/content/groups/releases/, which the SPARTA parent POM declares. If you use a Maven mirror for all repositories (<mirrorOf>*</mirrorOf>), make sure it also proxies that repository.

  • Before loading or creating models, initialize EMF as shown in Setting up a standalone program.

  • The runnable jar sparta-cli-2026.1.0-shaded.jar (see Command-line tools) contains all libraries and their dependencies, so it also works as a single-jar classpath (java -cp) for your own programs.

Concrete code for the common tasks is in Development scenarios, and a complete example project is in Example project.

Known limitation: XLSX export

With the dependencies that sparta-io 2026.1.0 brings in, creating a ThreatXlsxOutputStream fails with java.lang.NoClassDefFoundError: org/apache/poi/util/POILogFactory. sparta-io declares poi-ooxml 4.1.2, while the io plug-in brings in poi 5.4.1, and the two versions do not work together. The same problem affects the -ox option of sparta-cli (see Command-line tools).

As a workaround in your own Maven project, add both of the following dependencies next to sparta-io. Adding only poi-ooxml is not enough, because commons-io 2.8.0 is then too old.

<dependency>
   <groupId>org.apache.poi</groupId>
   <artifactId>poi-ooxml</artifactId>
   <version>5.4.1</version>
</dependency>
<dependency>
   <groupId>commons-io</groupId>
   <artifactId>commons-io</artifactId>
   <version>2.18.0</version>
</dependency>

Using sparta-cli as a library

The classes of sparta-cli can also be used as a library. For example, SpartaCliProcessor.setupEMFStandalone(), setupVIATRAStandalone(), loadModel(String) and runThreatAnalysis(String) are public static helpers. loadModel and runThreatAnalysis take a path relative to the working directory.