Search code examples
gradlesnyk

How to solve Matching configurations not found?


After updating to gradle 7.3.2 I get this issue:

  • What went wrong: Execution failed for task ':bps-ips-bridge-core:snykResolvedDepsJson'.

Matching configurations not found: ^(runtimeOnly|implementation)$, available configurations for project project ':myProject': [annotationProcessor, api, apiElements, archives, bootArchives, checkstyle, compileClasspath, compileOnly, compileOnlyApi, default, developmentOnly, implementation, jacocoAgent, jacocoAnt, productionRuntimeClasspath, provided, providedCompile, providedRuntime, runtimeClasspath, runtimeElements, runtimeOnly, signatures, testAnnotationProcessor, testCompileClasspath, testCompileOnly, testImplementation, testRuntimeClasspath, testRuntimeOnly]

This is how the snyk stage in the Jenkinsfile looks like:

 stage('Snyk Checking') {
            steps {
                sh 'echo test snyk'
                snykSecurity(snykInstallation: 'snyk', snykTokenId: 'snyk-api-token', failOnIssues: true, severity: 'high', targetFile: 'my-project/build.gradle', additionalArguments: '--configuration-matching=^(runtimeOnly|implementation)$')
            }
        }

It used to be like this before updating gradle: --configuration-matching=^(runtime|compile)

What is the problem and how to solve it?


Solution

  • Snyk does not need the additional arguments. This part can be deleted:

    additionalArguments: '--configuration-matching=^(runtimeOnly|implementation)$'