Skip to content

Adding to your project

Tony Robalik edited this page Dec 3, 2023 · 4 revisions

Please see the readme or the releases tab for the latest release.

With plugins block and the Gradle Plugin Portal

The plugin is available from both the Gradle Plugin Portal and Maven Central.

Add to your root project.

root build.gradle
plugins {
  // releases
  id("com.autonomousapps.dependency-analysis") version "${latest_version}"
  // latest snapshot
  id("com.autonomousapps.dependency-analysis") version "+"
}

With plugins block and Maven Central

If you prefer to resolve from Maven Central, you can add the following to your settings.gradle

settings.gradle
pluginManagement {
  repositories {
    // releases
    mavenCentral()
    // snapshots
    maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
    // Once you start using pluginManagement, you should explicitly add this, unless
    // you NEVER want to use this repository
    gradlePluginPortal()
  }
}

Legacy approach

Or, if you prefer not to use the plugins {} syntax, you can use the legacy approach:

root build.gradle
buildscript {
  repositories {
    // releases
    mavenCentral()
    // snapshots
    maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
  }
  dependencies {
    // releases
    classpath("com.autonomousapps:dependency-analysis-gradle-plugin:${latest_version}")
    // latest snapshot
    classpath("com.autonomousapps:dependency-analysis-gradle-plugin:+")
  }
}

apply plugin: "com.autonomousapps.dependency-analysis"