Skip to main content

Setup

This page covers the setup for using PetarLib in your Fabric mod project.

warning

As of PetarLib v2.0.0-alpha.3 the Maven coordinates changed. Use the com.petarmc.petarlib:petarlib-fabric coordinates for v2+ keep using com.petarmc:lib for releases before v2.0.0-alpha.3.

Gradle

Add the PetarMc Maven repository and the dependency in your build.gradle.

build.gradle
repositories {
maven {
url "https://repo.petarmc.com/repository/maven-public/"
}
}

// for versions before v2.0.0-alpha.3
dependencies {
modImplementation "com.petarmc:lib:x.x.x"
}

// for versions after v2.0.0-alpha.3
dependencies {
modImplementation "com.petarmc.petarlib:petarlib-fabric:x.x.x"
}

Maven

Add the PetarMc Maven repository and the dependency in your pom.xml:

pom.xml
<repositories>
<repository>
<id>petarmc</id>
<url>https://repo.petarmc.com/repository/maven-public/</url>
</repository>
</repositories>

<!-- for older versions (pre v2.0.0-alpha.3) -->
<dependencies>
<dependency>
<groupId>com.petarmc</groupId>
<artifactId>lib</artifactId>
<version>x.x.x</version>
<scope>provided</scope>
</dependency>
</dependencies>

<!-- for versions after v2.0.0-alpha.3 -->
<dependencies>
<dependency>
<groupId>com.petarmc.petarlib</groupId>
<artifactId>petarlib-fabric</artifactId>
<version>x.x.x</version>
<scope>provided</scope>
</dependency>
</dependencies>

Fabric Mod JSON

Ensure your fabric.mod.json includes PetarLib as a dependency:

fabric.mod.json
{
"depends": {
"petarlib": "*"
}
}

Running tests

Unit tests are configured with Jupiter

  • Run the tests:
.\gradlew test
  • Run a single test class or method:
.\gradlew --tests com.petarmc.petarlib.chat.ChatPatternMatcherTest test

Test reports will be generated after a test run at:

  • HTML report: build/reports/tests/test/index.html
  • Raw results: build/test-results/test/