Skip to content

Astro03/jdeps-gradle-plugin

 
 

Repository files navigation

jdeps-gradle-plugin

Build Status Gradle Plugin Portal, link=


Runs the jdeps command on the project’s output and all of its dependencies.

Usage

Option #1

buildscript {
    repositories {
        jcenter()
        gradlePluginPortal()
    }
    dependencies {
        classpath 'org.kordamp.gradle:jdeps-gradle-plugin:0.15.0'
    }
}
apply plugin: 'org.kordamp.gradle.jdeps'

Option #2

plugins {
    id 'org.kordamp.gradle.jdeps' version '0.15.0'
}

This will add a jdepsReport task to your build, which will analyze the main sourceSets and all dependencies found in the runtime (Gradle 6) or runtimeClasspath (Gradle 7+) configuration.

Configuration

Plugin configuration

The following properties can be specified in the jdeps task configuration

Name Option Property Type Default Value

verbose

jdeps-verbose

jdeps.verbose

boolean

false

summary

jdeps-summary

jdeps.summary

boolean

false

profile

jdeps-profile

jdeps.profile

boolean

false

recursive

jdeps-recursive

jdeps.recursive

boolean

false

jdkinternals

jdeps-jdkinternals

jdeps.jdkinternals

boolean

true

apionly

jdeps-apionly

jdeps.apionly

boolean

false

consoleOutput

jdeps-console-output

jdeps.console.output

boolean

true

reportsDir

File

"${buildDir}/reports/jdeps"

configurations

jdeps-configurations

jdeps.configurations

List<String>

['runtime'] (Gradle 6)
['runtimeClasspath'] (Gradle 7+)

classpaths

jdeps-classpaths

jdeps.classpaths

List<String>

['compileClasspath', 'runtimeClasspath', 'testCompileClasspath', 'testRuntimeClasspath']

sourceSets

jdeps-sourcesets

jdeps.sourcesets

List<String>

['main']

multiRelease

jdeps-multi-release

jdeps.multi.release

Integer

multiReleaseJars

jdeps.multi.release.jars

Map<String, String>

[:]

Task properties may be defined on the command line using their option name, or their property name, such as

$ gradle jdeps --jdeps-verbose
$ gradle jdeps -Pjdeps.verbose=true
$ gradle jdeps -Djdeps.verbose=true
$ set JDEPS_VERBOSE=true
$ gradle jdeps

You may configure multiple sourceSets and configurations, which will be evaluated in a single report. The following snippet shows how this plugin can be configured to run jdeps on production and test sources

jdepsReport {
    sourceSets = ['main', 'test']
    configurations = ['testRuntimeClasspath']
}

MultiRelease JAR support

You may configure a version for the multiRelease property in which case this setting will be applied --multi-release <version> an all dependencies. If you need to check different releases per dependency then use the MultiReleaseJars property instead, for example

jdepsReport {
    multiReleaseJars = [
        'foo-1.0.0': '11',  // matches full name
        'bar.*':     '12'   // matches all files with 'bar' as prefix
    ]
}

MonkeyPatching the module

There are times when explicit modular settings may be needed to generate a jdeps report. You have the option to specify these settings using a moduleOptions extension on the `jdepsReport task, for example

jdepsReport {
    moduleOptions {
        addModules = ['com.acme.foo']
    }
}

About

Run JDeps on a Gradle build

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Groovy 100.0%