-
-
Notifications
You must be signed in to change notification settings - Fork 124
Adding to your project
Tony Robalik edited this page Aug 23, 2024
·
6 revisions
Please see the readme or the releases tab for the latest release.
The plugin is available from both the Gradle Plugin Portal and Maven Central.
Since version 2.0.
Add to settings script.
settings.gradle
plugins {
id("com.autonomousapps.build-health") version <<version>>
// Android and Kotlin must be loaded in the same (or parent) class loader as the
// Dependency Analysis Plugin. The lines below are one way to accomplish this
// Optional, if using Kotlin
id("org.jetbrains.kotlin.jvm") version <<version>> apply false
// Optional, if using Android
id("com.android.application") version <<version>> apply false
id("org.jetbrains.kotlin.android") version <<version>> apply false
}
Add to root project.
root build.gradle
plugins {
id("com.autonomousapps.dependency-analysis") version <<version>>
// Android and Kotlin must be loaded in the same (or parent) class loader as the
// Dependency Analysis Plugin. The lines below are one way to accomplish this
// Optional, if using Kotlin
id("org.jetbrains.kotlin.jvm") version <<version>> apply false
// Optional, if using Android
id("com.android.application") version <<version>> apply false
id("org.jetbrains.kotlin.android") version <<version>> apply false
}
And also add to subprojects, probably via convention plugins.
sub/project/build.gradle
plugins {
id("com.autonomousapps.dependency-analysis")
}
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()
}
}
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"