Skip to content

Add 2P-Kt as a dependency

How to pull one or more 2P-Kt modules into your own Gradle, Maven, or npm project.

2P-Kt is published under the Maven group ID it.unibo.tuprolog (JVM/Kotlin modules, via Maven Central and GitHub Packages) and under the @tuprolog npm organization (JS modules). Every module name below (core, solve-classic, parser-impl, ...) maps directly to an artifact ID / npm package name.

1. Pick the module(s) you need

2P-Kt is split into ~30 incrementally-dependent modules. The full, currently-published set is:

include(":utils")
include(":core")
include(":unify")
include(":theory")
include(":datalog")
include(":bdd")
include(":dsl-core")
include(":dsl-unify")
include(":dsl-theory")
include(":dsl-solve")
include(":solve")
include(":solve-classic")
include(":solve-streams")
include(":solve-concurrent")
include(":test-solve")
include(":test-dsl")
include(":parser-core")
include(":parser-impl")
include(":parser-theory")
include(":solve-plp")
include(":solve-problog")
include(":serialize-core")
include(":serialize-theory")
include(":repl")
include(":oop-lib")
include(":io-lib")
include(":ide-plp")
include(":ide")
include(":examples")
include(":full")

Dependencies between modules are resolved transitively: importing theory automatically pulls in unify and core; importing solve-classic pulls in solve, theory, unify, and core; and so on. Pick the highest-level module that covers your use case — e.g. solve-classic for a classic-resolution Prolog engine, parser-impl for parsing terms/theories from text.

2. Add the 2P-Kt repositories

Gradle (Kotlin DSL):


Maven:


mavenCentral() alone is enough for stable releases; add the GitHub Packages repository too if you need a dev/pre-release build (authentication may be required for GitHub Packages).

npm users don't need this step: the @tuprolog packages are public on the default npm registry.

3. Declare the dependency

Replace 2P_MODULE with the module name from step 1, and 2P_VERSION with the version you want (e.g. the latest release).

Gradle (Kotlin DSL):


Maven:


npm:


4. JVM-only projects: use the -jvm suffix

If your Gradle/Maven project only targets the JVM (i.e. it's not a Kotlin Multiplatform project), append -jvm to the artifact ID to avoid pulling in the multiplatform metadata artifact:

Gradle (Kotlin DSL):


Maven:

<dependency>
    <groupId>it.unibo.tuprolog</groupId>
    <artifactId>2P_MODULE-jvm</artifactId>
    <version>2P_VERSION</version>
</dependency>

npm packages are JS-only and don't have a -jvm variant.

Verify

Once the dependency resolves, a quick smoke test with the core module is enough to confirm the setup works:

import it.unibo.tuprolog.core.Atom
import it.unibo.tuprolog.core.Struct

fun main() {
    println(Struct.of("foo", Atom.of("bar")))
}

See the Reference section for the full API surface of each module.