I’ve started to write a simple plugin to analyse gradle projects and send dependency information to a central server. This way I want to get insight into all projects in the company and check if there is some log4j2 dependency below 2.16.0. You can find the code under https://github.com/mbogner/gradle-status-plugin. The plugin was accepted and is available via https://plugins.gradle.org/plugin/dev.mbo.gradlestatusplugin. A web endpoint is still WIP. If you’re interested, an example json string that is posted to that endpoint looks like this:
{
"group": "dev.mbo",
"name": "gradle-status-test",
"version": "1.0.0",
"dependencies": {
"org.apache.commons:commons-lang3:3.12.0": {
"group": "org.apache.commons",
"name": "commons-lang3",
"version": "3.12.0",
"project": false,
"configurations": [
"compileClasspath",
"default",
"runtimeClasspath",
"testCompileClasspath",
"testRuntimeClasspath"
]
},
"commons-io:commons-io:2.11.0": {
"group": "commons-io",
"name": "commons-io",
"version": "2.11.0",
"project": false,
"configurations": [
"compileClasspath",
"default",
"runtimeClasspath",
"testCompileClasspath",
"testRuntimeClasspath"
]
},
"gradle-status-test:module2:1.0.0": {
"group": "gradle-status-test",
"name": "module2",
"version": "1.0.0",
"project": true,
"configurations": [
"compileClasspath",
"default",
"implementation",
"runtimeClasspath",
"runtimeElements",
"testCompileClasspath",
"testImplementation",
"testRuntimeClasspath"
]
},
"com.fasterxml.jackson.core:jackson-databind:2.13.0": {
"group": "com.fasterxml.jackson.core",
"name": "jackson-databind",
"version": "2.13.0",
"project": false,
"configurations": [
"default",
"runtimeClasspath",
"testRuntimeClasspath"
]
},
"com.fasterxml.jackson.core:jackson-annotations:2.13.0": {
"group": "com.fasterxml.jackson.core",
"name": "jackson-annotations",
"version": "2.13.0",
"project": false,
"configurations": [
"default",
"runtimeClasspath",
"testRuntimeClasspath"
]
},
"com.fasterxml.jackson:jackson-bom:2.13.0": {
"group": "com.fasterxml.jackson",
"name": "jackson-bom",
"version": "2.13.0",
"project": false,
"configurations": [
"default",
"runtimeClasspath",
"testRuntimeClasspath"
]
},
"com.fasterxml.jackson.core:jackson-core:2.13.0": {
"group": "com.fasterxml.jackson.core",
"name": "jackson-core",
"version": "2.13.0",
"project": false,
"configurations": [
"default",
"runtimeClasspath",
"testRuntimeClasspath"
]
},
"org.junit:junit-bom:5.8.2": {
"group": "org.junit",
"name": "junit-bom",
"version": "5.8.2",
"project": false,
"configurations": [
"testCompileClasspath",
"testRuntimeClasspath"
]
},
"org.junit.jupiter:junit-jupiter-api:5.8.2": {
"group": "org.junit.jupiter",
"name": "junit-jupiter-api",
"version": "5.8.2",
"project": false,
"configurations": [
"testCompileClasspath",
"testRuntimeClasspath"
]
},
"org.opentest4j:opentest4j:1.2.0": {
"group": "org.opentest4j",
"name": "opentest4j",
"version": "1.2.0",
"project": false,
"configurations": [
"testCompileClasspath",
"testRuntimeClasspath"
]
},
"org.junit.platform:junit-platform-commons:1.8.2": {
"group": "org.junit.platform",
"name": "junit-platform-commons",
"version": "1.8.2",
"project": false,
"configurations": [
"testCompileClasspath",
"testRuntimeClasspath"
]
},
"org.apiguardian:apiguardian-api:1.1.2": {
"group": "org.apiguardian",
"name": "apiguardian-api",
"version": "1.1.2",
"project": false,
"configurations": [
"testCompileClasspath"
]
},
"org.junit.jupiter:junit-jupiter-engine:5.8.2": {
"group": "org.junit.jupiter",
"name": "junit-jupiter-engine",
"version": "5.8.2",
"project": false,
"configurations": [
"testRuntimeClasspath"
]
},
"org.junit.platform:junit-platform-engine:1.8.2": {
"group": "org.junit.platform",
"name": "junit-platform-engine",
"version": "1.8.2",
"project": false,
"configurations": [
"testRuntimeClasspath"
]
}
},
"subprojects": [
{
"group": "gradle-status-test",
"name": "module1",
"version": "1.0.0",
"dependencies": {
"com.fasterxml.jackson.core:jackson-databind:2.13.0": {
"group": "com.fasterxml.jackson.core",
"name": "jackson-databind",
"version": "2.13.0",
"project": false,
"configurations": [
"compileClasspath",
"default",
"runtimeClasspath",
"testCompileClasspath",
"testRuntimeClasspath"
]
},
"com.fasterxml.jackson.core:jackson-annotations:2.13.0": {
"group": "com.fasterxml.jackson.core",
"name": "jackson-annotations",
"version": "2.13.0",
"project": false,
"configurations": [
"compileClasspath",
"default",
"runtimeClasspath",
"testCompileClasspath",
"testRuntimeClasspath"
]
},
"com.fasterxml.jackson:jackson-bom:2.13.0": {
"group": "com.fasterxml.jackson",
"name": "jackson-bom",
"version": "2.13.0",
"project": false,
"configurations": [
"compileClasspath",
"default",
"runtimeClasspath",
"testCompileClasspath",
"testRuntimeClasspath"
]
},
"com.fasterxml.jackson.core:jackson-core:2.13.0": {
"group": "com.fasterxml.jackson.core",
"name": "jackson-core",
"version": "2.13.0",
"project": false,
"configurations": [
"compileClasspath",
"default",
"runtimeClasspath",
"testCompileClasspath",
"testRuntimeClasspath"
]
}
},
"subprojects": []
},
{
"group": "gradle-status-test",
"name": "module2",
"version": "1.0.0",
"dependencies": {
"org.apache.commons:commons-lang3:3.12.0": {
"group": "org.apache.commons",
"name": "commons-lang3",
"version": "3.12.0",
"project": false,
"configurations": [
"compileClasspath",
"default",
"runtimeClasspath",
"testCompileClasspath",
"testRuntimeClasspath"
]
},
"gradle-status-test:module1:1.0.0": {
"group": "gradle-status-test",
"name": "module1",
"version": "1.0.0",
"project": true,
"configurations": [
"compileClasspath",
"default",
"implementation",
"runtimeClasspath",
"runtimeElements",
"testCompileClasspath",
"testImplementation",
"testRuntimeClasspath"
]
},
"com.fasterxml.jackson.core:jackson-databind:2.13.0": {
"group": "com.fasterxml.jackson.core",
"name": "jackson-databind",
"version": "2.13.0",
"project": false,
"configurations": [
"default",
"runtimeClasspath",
"testRuntimeClasspath"
]
},
"com.fasterxml.jackson.core:jackson-annotations:2.13.0": {
"group": "com.fasterxml.jackson.core",
"name": "jackson-annotations",
"version": "2.13.0",
"project": false,
"configurations": [
"default",
"runtimeClasspath",
"testRuntimeClasspath"
]
},
"com.fasterxml.jackson:jackson-bom:2.13.0": {
"group": "com.fasterxml.jackson",
"name": "jackson-bom",
"version": "2.13.0",
"project": false,
"configurations": [
"default",
"runtimeClasspath",
"testRuntimeClasspath"
]
},
"com.fasterxml.jackson.core:jackson-core:2.13.0": {
"group": "com.fasterxml.jackson.core",
"name": "jackson-core",
"version": "2.13.0",
"project": false,
"configurations": [
"default",
"runtimeClasspath",
"testRuntimeClasspath"
]
}
},
"subprojects": []
}
]
}
The structure under subprojects is simply the same but nested recursively. `project=true` means that the dependecy is a project(“:name”) dependency.