How to solve NoMethodError that arises due to using a same library with two different versions using gradle or anything else?
<p>I have two dependencies that use a same library but with different versions and I get NoMethodError. I am not sure how to solve it using gradle or anything else? Any help would be great</p>

<pre><code>group 'com.hello'
version '1.0-SNAPSHOT'

apply plugin: 'java'
apply plugin: 'idea'

repositories {
    mavenCentral()
    mavenLocal()
}


dependencies {
    compile 'org.slf4j:slf4j-log4j12:1.7.12'
    compile group: 'org.apache.spark', name: 'spark-core_2.11', version: '2.0.1'
    compile group: 'org.apache.spark', name: 'spark-streaming_2.11', version: '2.0.1'
    compile group: 'org.apache.spark', name: 'spark-streaming-kafka-0-10_2.11', version: '2.0.1'
    compile group:'org.apache.kafka', name: 'kafka-clients', version: '0.10.1.0'
    compile group: 'com.datastax.spark', name: 'spark-cassandra-connector_2.11', version: '2.0.0-M3'
    compile group: 'com.github.brainlag', name: 'nsq-client', version: '1.0.0.RC2'
    compile group: 'com.google.code.gson', name: 'gson', version: '2.7'
}


task buildStreamingJar(type: Jar) {
    if(project.hasProperty("jarname")) {
        def fullyQualifiedPackageName = ""
        def jarname = project.getProperty("jarname")
        if (jarname.equalsIgnoreCase("SparkDriver1")) {
            fullyQualifiedPackageName = "com.hello.streamprocessing.app.SparkDriver1"
        }
        if (jarname.equalsIgnoreCase("SparkDriver2")) {
            fullyQualifiedPackageName = "com.hello.streamprocessing.app.SparkDriver2"
        }

        baseName = project.name + "-$jarname" + "-stream"
        from { configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } }
        with jar
        zip64 true
        from sourceSets.test.output
        manifest {
            attributes 'Main-Class': fullyQualifiedPackageName
        }
        exclude 'META-INF/.RSA', 'META-INF/.SF', 'META-INF/*.DSA'
    }
}
</code></pre>

<p><strong>so what is happening here is that in my dependencies spark-core_2.11 uses 
com.google.guava:14.0.1 and nsq-client uses com.google.guava:19.0</strong> </p>

<p>which is leading to the following error.</p>

<pre><code>Exception in thread "main" java.lang.NoSuchMethodError: com.google.common.collect.Sets.newConcurrentHashSet()Ljava/util/Set;
    at com.github.brainlag.nsq.NSQProducer.(NSQProducer.java:22)
    at com.hello.streamprocessing.app.SparkDriver2.main(SparkDriver2.java:37)
</code></pre>

<p>I need to use this build.gradle file to build a FAT Uber jar so I can use it with spark-submit</p>