Skip to content

Linkage Checker with Gradle

Tomo Suzuki edited this page Apr 13, 2020 · 13 revisions

(This page is still in draft.)

To detect linkage errors in Maven artifacts generated by a Gradle project, you can first install the artifact in Maven local repository using Gradle's Maven Publish Plugin and then run LinkageCheckerMain with your artifact coordinates.

  dependencies {
    // Separate configuration (class path) for Linkage Checker
    linkageChecker "com.google.cloud.tools:dependencies:1.1.5"
  }
  ...
  project.task('checkJavaLinkage', type: JavaExec) {
    dependsOn project.getTasksByName('publishXXXXXPublicationToMavenLocal', true)
    classpath = project.configurations.linkageChecker
    main = 'com.google.cloud.tools.opensource.classpath.LinkageCheckerMain'
    args '-a', 'com.example:foo:0.1.0-SNAPSHOT' // the coordinate of the Maven artifact
  }

Clone this wiki locally