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.3.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
.spartamodels and catalogs.Plug-in:
sparta.spartamodel; classes described in Meta-model.sparta-core(library)The threat elicitation and risk analysis engine (
Engine) and the threat classes (Threat,PatternThreat).Plug-ins:
sparta.coreandsparta.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 and a LaTeX report.
Plug-in:
sparta.io; classes described in Exporting results.sparta-cli(library and runnableshadedjar)Command-line tool that analyzes a model and exports the results (see Command-line tools), and
StandaloneRuntime, which sets up and runs SPARTA in your own program (see Using sparta-cli as a library).Packages:
sparta.cli,sparta.cli.runtime,sparta.cli.cmd.exportsparta-ci(library and runnableshadedjar)Variant of
sparta-clifor continuous integration pipelines (see Command-line tools).Packages:
sparta.cli.cistandalone(POM)The parent POM of the artifacts above. It sets the versions of the third-party libraries (see Third-party dependency versions), and you import it as a BOM in your own project (see Standalone Prerequisites).
The exported packages of the plug-ins are listed in SPARTA in Eclipse.
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.
This does not hold for sparta-cli and sparta-ci 2026.3.0, whose published POMs declare none of these dependencies (see Using sparta-cli as a library).
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
The 2026.3.0 artifacts are available from the SPARTA Maven repository https://maven.sparta.distrinet-research.be.
Configure the repositories and import the standalone BOM 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.3.0</version>
</dependency>
Some points to keep in mind:
The libraries are compiled for Java 21, so a consumer project needs Java 21 or later.
Import the
standaloneBOM; without it, the first analysis fails with aSecurityException(see Standalone Prerequisites).The analysis fails when the path of the SPARTA jars contains a space, for example a local Maven repository in
C:\Users\Jane Doe\.m2(see Standalone Prerequisites).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.3.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.
Third-party dependency versions
The standalone POM sets the versions of the third-party libraries in its dependencyManagement.
When you import it as a BOM, your project uses the same versions as the SPARTA build, among others:
Library |
Version |
|---|---|
EMF ( |
2.40.0 |
|
3.20.300 |
Apache POI ( |
5.5.1 |
Jackson ( |
2.17.1 |
|
2.7 |
|
2.16.1 |
Log4j ( |
2.26.1 |
SLF4J ( |
2.0.20 |
|
4.7.7 |
|
6.10.0.202406032230-r |
VIATRA 2.9.1 is not managed by the BOM; sparta-core depends on it directly.
Changed in version 2026.3: Apache POI, SnakeYAML and Log4j were upgraded, and sparta-cli uses picocli instead of commons-cli and Guice.
The BOM also sets the SLF4J version, 2.0.20.
Using sparta-cli as a library
The class be.kuleuven.cs.distrinet.sparta.cli.runtime.StandaloneRuntime of sparta-cli makes the setup and analysis code of the command-line tools available to your own programs.
Its public static methods are:
setupEMFStandalone()Registers the SPARTA meta-model and the resource factory for the extensions
sparta,securitydfdandspartamodel, and, unless a resource factory for all extensions (*) is already registered, reads files with other extensions as XMI.setupVIATRAStandalone()Initializes VIATRA for use outside Eclipse.
loadModel(String)Loads a model, and the catalogs and other files that it references, into a new
ResourceSet, and returns it.runThreatAnalysis(String)andrunThreatAnalysis(ResourceSet)Load the model if needed, create an
Engine(see Threat elicitation and risk analysis), and return the threats ofrunAnalysis, with their risk calculated. The engine is not closed.
Call the two setup methods once per JVM, before you load models.
loadModel and runThreatAnalysis(String) take a path that is relative to the working directory or absolute.
Warning
The published POMs of sparta-cli and sparta-ci 2026.3.0 declare no dependencies other than test dependencies, so a project that only depends on sparta-cli does not compile.
Also declare sparta-io, which brings in the other libraries that StandaloneRuntime needs, as in the following dependencies section of your pom.xml:
<dependencies>
<dependency>
<groupId>be.kuleuven.cs.distrinet.sparta</groupId>
<artifactId>sparta-cli</artifactId>
<version>2026.3.0</version>
</dependency>
<!-- needed because the POM of sparta-cli 2026.3.0 declares no dependencies -->
<dependency>
<groupId>be.kuleuven.cs.distrinet.sparta</groupId>
<artifactId>sparta-io</artifactId>
<version>2026.3.0</version>
</dependency>
</dependencies>
StandaloneRuntime logs through SLF4J; without an SLF4J provider, such as org.slf4j:slf4j-simple, SLF4J prints a warning that it falls back to a no-operation logger, and the log messages are dropped.
The runnable shaded jars are not affected.
The exporters of the command line, in the package be.kuleuven.cs.distrinet.sparta.cli.cmd.export, implement Exporter, whose only method is boolean export(Collection<Threat>); it returns false when the export fails.
Each exporter gets its target in its constructor, for example new ExportCSV(Path).
Changed in version 2026.3: The static methods of SpartaCliProcessor moved unchanged to StandaloneRuntime, and SpartaCliProcessor was removed, together with the command-line classes CliProcessor and SimpleModule and the package be.kuleuven.cs.distrinet.sparta.cli.cmd.
Exporter has the single method export(Collection<Threat>) instead of getOptions() and process(CommandLine, Collection<Threat>), and the code-quality exporter ExportCQR was removed.