javagradlejungerrorprone

How do I fix this Xlint:path error when using Gradle, JUNG and Error Prone?


I am having difficulty getting JUNG and Error Prone to work nicely together in my Gradle based Java project, and I wonder if someone has come across a problem like this before and can help me find a solution.

I've posted this problem already on the GitHub issue trackers for JUNG and Error Prone, but no one seems to know what's the cause of it, which is why I'm posting it here.

When I try to run gradle run with the following build.gradle

plugins {
  id 'application'
  id 'java'
  id 'net.ltgt.errorprone' version '0.0.8'
}

group 'org.jbduncan'
version '1.0-SNAPSHOT'

sourceCompatibility = 1.8

mainClassName = 'org.jbduncan.helloworld.HelloWorld'

repositories {
  jcenter()
}

dependencies {
  compile 'net.sf.jung:jung-graph-impl:2.1.1'
  errorprone 'com.google.errorprone:error_prone_core:2.0.11'
}

tasks.withType(JavaCompile) {
  options.encoding = 'UTF-8'
  options.compilerArgs = [
    '-Xlint:all',
    '-Werror'
  ]
}

and this class

package org.jbduncan.helloworld;

public final class HelloWorld {
  public static void main(String[] args) {
    System.out.println("Hello, world!");
  }
}

it emits the following message.

:compileJava                                                                     
warning: [path] bad path element "C:\Users\Jonathan\.gradle\caches\modules-2\files-2.1\net.sf.jung\jung-graph-impl\2.1.1\8293acb2ab4c00a3939cb99a8751e5d38a4299dc\jung-api-2.1.1.jar": no such file or directory
warning: [path] bad path element "C:\Users\Jonathan\.gradle\caches\modules-2\files-2.1\net.sf.jung\jung-graph-impl\2.1.1\8293acb2ab4c00a3939cb99a8751e5d38a4299dc\guava-19.0.jar": no such file or directory
warning: [path] bad path element "C:\Users\Jonathan\.gradle\caches\modules-2\files-2.1\net.sf.jung\jung-api\2.1.1\e47ee4efdfacce12f0af620747d9d0e44bf2eaa4\guava-19.0.jar": no such file or directory
error: warnings found and -Werror specified
1 error                     
3 warnings
:compileJava FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':compileJava'.
> Compilation failed with exit code 1; see the compiler error output for details.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Total time: 5.488 secs

When I investigate the contents of my Gradle cache, I can see that, indeed, the jar files mentioned above simply don't exist.

When I look into C:\Users\Jonathan\.gradle\caches\modules-2\files-2.1\net.sf.jung\jung-graph-impl\2.1.1\8293acb2ab4c00a3939cb99a8751e5d38a4299dc\jung-graph-impl-2.1.1.jar, the META-INF/MANIFEST.MF contains this text.

Manifest-Version: 1.0
Archiver-Version: Plexus Archiver
Created-By: Apache Maven 3.0.5
Built-By: jrtom
Build-Jdk: 1.8.0-google-v7
Class-Path: jung-api-2.1.1.jar guava-19.0.jar

I get the same problem with JUNG versions 2.1 and 2.0, and no other library with dependencies I've tried seems to have this problem.

However the problem goes away when I exclude from build.gradle the lines id 'net.ltgt.errorprone' version '0.0.8' and errorprone 'com.google.errorprone:error_prone_core:2.0.11', so it's not clear to me if this is a problem with JUNG or if it's gradle-errorprone-plugin or Error Prone related.

I think it's worth noting that since I posted the question above on the JUNG issue tracker, I upgraded my project's version of Error Prone from 2.0.11 to 2.0.13, but unfortunately that didn't resolve my issue.


Solution

  • Problem resolved as of this bug fix to JUNG.