Registry / devops / snyk-gradle-plugin

snyk-gradle-plugin

JSON →
library5.1.1jsnpmunverified

Snyk CLI plugin for Gradle projects providing dependency metadata for vulnerability scanning. Current version 5.1.1 (Nov 2025), with a fast release cadence around 2-3 months. Supports Gradle 4-9, Node 16-20, and Windows/Linux/macOS. Key differentiator: integrates with Snyk CLI to automatically detect and fix vulnerabilities in Gradle dependencies, including multi-project builds and custom configuration matching.

npm install snyk-gradle-plugin
INSTALL
IMPORT
SIG · SNYK-GRADLE-PLUGIN
S
snyk-gradle-plugin
devopsjavascriptv5.1.1
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

inspect
import { inspect } from 'snyk-gradle-plugin'
const inspect = require('snyk-gradle-plugin')
ESM-only since v5.0.0; default export not available
buildDepTree
import { buildDepTree } from 'snyk-gradle-plugin'
import buildDepTree from 'snyk-gradle-plugin'
Named export, not default export
PluginOptions
import type { PluginOptions } from 'snyk-gradle-plugin'
import { PluginOptions } from 'snyk-gradle-plugin'
TypeScript type import, not a runtime value

Scans a Gradle project for vulnerabilities using the inspect function, with configuration matching for specific dependency configurations.

import { inspect } from 'snyk-gradle-plugin'; const options = { path: process.cwd(), gradleSubProject: process.env.GRADLE_SUB_PROJECT || '', allSubProjects: false, configurationMatching: '^releaseRuntimeClasspath$', configurationAttributes: 'buildtype:release,usage:java-runtime', }; async function run() { try { const result = await inspect(options); console.log(JSON.stringify(result, null, 2)); } catch (error) { console.error('Inspection failed:', error.message); } } run();
Debug
Known issues
breakingNode IDs changed to uniquely identify all dependencies in v5.0.0
fix
Update any code relying on node ID format; previously node IDs assumed only one artifact per resolved dependency
affects: >=5.0.0
deprecatedCommonJS require() is deprecated; the package is ESM-only since v5.0.0
fix
Use import statements: `import { inspect } from 'snyk-gradle-plugin'`
affects: >=5.0.0
gotchaSpaces in project path on Windows cause errors (fixed in v4.9.1 but may appear in older versions)
fix
Upgrade to v4.9.1 or later, or ensure paths have no spaces
affects: <4.9.1
breakingv5.0.0 requires Node >=16 (drops Node 14 support)
fix
Upgrade Node to version 16 or later
affects: >=5.0.0
Errors
Common errors & fixes
Error: Cannot find module 'snyk-gradle-plugin'
Package not installed or ESM import used in CJS context
fix
Ensure package is installed: `npm install snyk-gradle-plugin`. Use `import` syntax, not `require`, as the package is ESM-only.
TypeError: snyk_gradle_plugin_1.inspect is not a function
Incorrect import: using default import instead of named import
fix
Use named import: `import { inspect } from 'snyk-gradle-plugin'`
Error: ENOENT: no such file or directory, stat './build.gradle'
Missing or misconfigured project path
fix
Set `options.path` to the correct Gradle project directory containing build.gradle
Upgrade
Version history
5.1.1latest on npm
Audit
Dependencies
@snyk/cli-interfacerequiredDefines plugin interface and types for Snyk CLI interoperability
debugrequiredInternal debugging support
Agent activity
40 hits · last 30 days
node
36
OpenAI (training)
1
Resources
snyk-gradle-plugin — npm install snyk-gradle-plugin · libregistry