Skip to content

Getting Started

Requirements:

Instancio can be used with Java 17 or higher.

Dependencies

The following dependencies are available from Maven central:

DependencyJPMS Module NameDescription
instancio-coreorg.instancio.coreCore library
instancio-junitorg.instancio.junitJUnit Jupiter integration
instancio-guavaorg.instancio.guavaSupport for Google Guava
instancio-bom-Bill Of Materials

The org.instancio:instancio artifact on Maven central is an older dependency that should no longer be used.

instancio-junit

Use the instancio-junit dependency that matches your JUnit version:

  • For JUnit 5, use instancio-junit:5.x
  • For JUnit 6, use instancio-junit:6.x

It includes a transitive dependency on instancio-core, therefore it is not necessary to import both.

Maven
1
2
3
4
5
6
<dependency>
    <groupId>org.instancio</groupId>
    <artifactId>instancio-junit</artifactId>
    <version>5.5.1</version>
    <scope>test</scope>
</dependency>
Gradle
1
2
3
dependencies {
    testImplementation 'org.instancio:instancio-junit:5.5.1'
}

instancio-core

If you use JUnit 4, TestNG, or would like to use Instancio standalone, then use instancio-core:

Maven
1
2
3
4
5
6
<dependency>
    <groupId>org.instancio</groupId>
    <artifactId>instancio-core</artifactId>
    <version>5.5.1</version>
    <scope>test</scope>
</dependency>
Gradle
1
2
3
dependencies {
    testImplementation 'org.instancio:instancio-core:5.5.1'
}

instancio-guava

Using instancio-guava requires the following dependencies on the classpath:

  • either instancio-core or instancio-junit
  • com.google.guava:guava version 23.1-jre or higher

instancio-bom

Use instancio-bom to easily manage Instancio dependencies:

Maven
<dependencyManagement>
    <dependencies>
        <dependency>
            <groupId>org.instancio</groupId>
            <artifactId>instancio-bom</artifactId>
            <version>5.5.1</version>
            <type>pom</type>
            <scope>import</scope>
        </dependency>
    </dependencies>
</dependencyManagement>
<dependencies>
    <dependency>
        <groupId>org.instancio</groupId>
        <artifactId>instancio-core</artifactId>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.instancio</groupId>
        <artifactId>instancio-junit</artifactId>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.instancio</groupId>
        <artifactId>instancio-guava</artifactId>
        <scope>test</scope>
    </dependency>
</dependencies>
Gradle
1
2
3
4
5
6
dependencies {
    implementation platform('org.instancio:instancio-bom:5.5.1')
    testImplementation 'org.instancio:instancio-core'
    testImplementation 'org.instancio:instancio-junit'
    testImplementation 'org.instancio:instancio-guava'
}

Versioning

Instancio version numbers adhere to the MAJOR.MINOR.PATCH format.

  • Major versions are generally reserved for significant features and breaking changes.
  • Minor and Patch versions include bug fixes, smaller new features, but may also include minor breaking changes.

In other words, the project does not follow Semantic Versioning, though the versioning scheme loosely resembles it.