This page explains how you can setup snapshots for your Detekt build to test the latest unreleased features.
Edit me

This page explains how you can use our latest snapshots to test upcoming unreleased features.

Where to download snapshots

You can find the latest snapshot on sonatype. A new snapshot is published after every merge to main from the Deploy Snapshot Github Action workflow.

Gradle setup with Buildscript

If you’re using Gradle with the buildscript block, you should update your top level build.gradle file with:

buildscript {
  repositories {
    maven {
      url "https://oss.sonatype.org/content/repositories/snapshots/"
    }
  }
  dependencies {
    classpath "io.gitlab.arturbosch.detekt:detekt-gradle-plugin:main-SNAPSHOT"
  }
}

apply plugin: "io.gitlab.arturbosch.detekt"

allprojects {
  repositories {
    maven {
      url "https://oss.sonatype.org/content/repositories/snapshots/"
    }
  }
}

Make sure that you’re adding the sonatype maven repository to both the repositories{} block inside the buildscript{} block and outside it.

Gradle setup with Plugin block

If you’re using the plugins{} block to apply detekt, you should update your build.gradle file to:

plugins {
  id("io.gitlab.arturbosch.detekt") version "main-SNAPSHOT"
}

allprojects {
  repositories {
    maven {
      url "https://oss.sonatype.org/content/repositories/snapshots/"
    }
  }
}

Plus you need to update the settings.gradle file as follows:

pluginManagement {
    resolutionStrategy {
        eachPlugin {
            if (requested.id.id == "io.gitlab.arturbosch.detekt") {
                useModule("io.gitlab.arturbosch.detekt:detekt-gradle-plugin:${requested.version}")
            }
        }
    }
    repositories {
        // Your other repos here.
        maven {
            url = uri("https://oss.sonatype.org/content/repositories/snapshots/")
        }
    }
}

Please note that the extra resolutionStrategy{} block is needed as we don’t publish a Gradle Plugin marker for our snapshots.