I want to migrate one of our projects from ant+ivy to gradle. When I compile sources using gradle I get this error:

```
...\guava-gwt-14.0.1.jar(com/google/common/collect/AbstractIterator.java):64: error: duplicate class: com.google.common.collect.AbstractIterator
public abstract class AbstractIterator<T> extends UnmodifiableIterator<T> {
                ^
...\guava-gwt-14.0.1.jar(com/google/common/base/Optional.java):223: error: cannot access AbstractIterator
        return new AbstractIterator<T>() {
                   ^
  bad source file: ...\guava-gwt-14.0.1.jar(com/google/common/base/AbstractIterator.java)
    file does not contain class com.google.common.base.AbstractIterator
    Please remove or make sure it appears in the correct subdirectory of the sourcepath.
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
2 errors

```

I checked that `AbstractIterator.java` is in `com.google.common.collect` and `com.google.common.base` (as wrote in error). How to solve this problem?

**[UPDATE]**

This is my gradle build (very simple - it's a beginning of migration from ant to gradle)

```
apply plugin: 'java'

compileJava.options.encoding = 'ISO-8859-1'

repositories {
    mavenCentral()
    maven {
        url 'http://gwtquery-plugins.googlecode.com/svn/mavenrepo'
    }
    ivy {
        url 'http://ivyrep/shared'
        url 'http://ivyrep/public'
        layout "pattern", { artifact "[organisation]/[module]/[revision]/[type]s/[artifact].[ext]" }
    }
}

// I know that conigurations should be repaired (testCompile, runtime) but this is just the beggining of migration from ant to gradle
dependencies {
    compile 'net.sourceforge.cobertura:cobertura:1.9.4.1'
    compile 'com.google.gwt:gwt-servlet:2.5.0'
    compile 'com.google.gwt:gwt-user:2.5.0'
    compile 'com.google.gwt:gwt-dev:2.5.0'
    compile 'com.google.gwt.inject:gin:2.0.0'
    compile 'com.googlecode.gwtquery:gwtquery:1.3.2'
    compile 'com.googlecode.gwtquery.bundles:gquery-dnd-bundle:1.0.6'
    compile 'org.hamcrest:hamcrest-library:1.3'
    compile 'org.mockito:mockito-all:1.9.5'
    compile 'junit:junit:4.10'
    compile 'org.easytesting:fest-assert-core:2.0M10'
    compile 'xmlunit:xmlunit:1.3'
    compile 'org.reflections:reflections:0.9.9-RC1'
}

```

I should also add that this is a **GWT project**.

**[UPDATE]**

Problem solved. I've excluded guava-gwt from compile scope and it started to work. This is probably not the best solution but it works.

```
apply plugin: 'java'

configurations { guavaGwt }

dependencies {
    guavaGwt 'com.google.guava:guava-gwt:14.0.1'
    // other dependencies
}

task compileGwt (dependsOn: classes) << {
    // [...]
        javaexec {
            main = 'com.google.gwt.dev.Compiler'
            maxHeapSize = '512M'
            classpath {
                [
                    sourceSets.main.java.srcDirs,
                    sourceSets.main.output.resourcesDir,
                    sourceSets.main.output.classesDir,
                    sourceSets.main.compileClasspath,
                    configurations.guavaGwt, // USE guava-gwt
                ]
            }
            args =
                    [
                        moduleName,
                        '-war',
                        buildDir,
                        '-logLevel',
                        'INFO',
                        // '-draftCompile' // Speeds up compile with 25%
                    ]
        }
    // [...]
}

compileJava {
    configurations.compile.exclude module:'guava-gwt' // exclude guava-gwt
    // do the job
}

```