Skip to content
Arciphant
Esc
↑↓navigate↵open⌘Jpreview
On this page

Quickstart

Create a first Arciphant project from scratch in five minutes.

This walkthrough sets up a minimal Arciphant build from scratch: two modules that share the same clean-architecture-like component structure. All you need is an empty directory with a Gradle wrapper (see Setup for the compatibility requirements).

Apply the plugin

Create a settings.gradle.kts and apply Arciphant:

plugins {
    id("ch.ergon.arciphant") version "0.2.0"
}

Declare the module structure

In the same file, declare a template and instantiate the modules from it:

arciphant {
    val moduleTemplate = template()
        .createComponent(name = "domain")
        .createComponent(name = "application", apiDependencies = setOf("domain"))
        .createComponent(name = "web", dependencies = setOf("application"))

    module(name = "orders", template = moduleTemplate)
    module(name = "customers", template = moduleTemplate)
}

The template defines the technical structure that all modules share — three components and their dependencies — and each module(...) call instantiates it as a domain module.

Apply a JVM plugin

Arciphant requires the Kotlin JVM or Java Library plugin on all managed projects (see Setup). Create the following build.gradle.kts in the root directory:

plugins {
    kotlin("jvm") version "2.2.0" apply false
}

subprojects {
    apply(plugin = "org.jetbrains.kotlin.jvm")

    repositories {
        mavenCentral()
    }
}

Inspect the generated project structure

That’s it — Arciphant now generates the whole Gradle multi-project structure. Verify it with:

./gradlew projects
Root project 'arciphant-quickstart'
+--- Project ':customers'
|    +--- Project ':customers:application'
|    +--- Project ':customers:domain'
|    \--- Project ':customers:web'
\--- Project ':orders'
     +--- Project ':orders:application'
     +--- Project ':orders:domain'
     \--- Project ':orders:web'

Verify the wired dependencies

Arciphant has also wired the dependencies between the components, exactly as declared in the template. The projectDependencies task prints them:

./gradlew -q projectDependencies
Project ':'
Project ':customers'
Project ':customers:application'
 |- [api] :customers:domain
Project ':customers:domain'
Project ':customers:web'
 |- [implementation] :customers:application
Project ':orders'
Project ':orders:application'
 |- [api] :orders:domain
...

application exposes domain to its consumers as an api dependencyapi dependencyA transitive dependency: every component that depends on application also gets access to domain. Declared with apiDependencies; dependencies creates a non-transitive implementation dependency.Dependency types, so web has access to both.

Where to go next

Was this page helpful?