우리 프로젝트 중 하나를 ant + ivy에서 gradle로 마이그레이션하려고합니다. 내가 Gradle을을 사용하여 소스를 컴파일 할 때이 오류를 얻을 :구아바 AbstractIterator - 클래스 복제
...\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
나는 (오류 쓴) AbstractIterator.java
이 com.google.common.collect
및 com.google.common.base
에 있음을 확인. 이 문제를 해결하는 방법?
[업데이트]
이 내 Gradle을 빌드 (매우 간단합니다 - 그것은 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'
}
GWT 프로젝트입니다.
[UPDATE]
문제 해결. 구아바 - gwt를 컴파일 범위에서 제외 시켰고 작동하기 시작했습니다. 이것은 아마도 최선의 해결책은 아니지만 작동합니다.
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
}
빌드 도구를 변경하는 동시에 코드 또는 종속성을 수정하고 있습니까? 'AbstractIterator'를 사용하는 소스 파일에'import com.google.common.base. *'와'import com.google.common.collect. *'가있는 것 같습니다. –
'build.gradle' 파일을 보여줄 수 있습니까? 또한 classpath에 구아바와 구아바 권을 모두 가지고 있지 않은지 확인하십시오. – Xaerxess
내 질문을 편집했습니다. Xaerxes, 고마워, 내가 봤어. 네가 맞아.하지만 그 라이브러리들은 과도기로 다운로드된다. 일반 구아바 lib를 제거하고 ony gwt 버전을 사용해야합니까? 프랭크, 나는 그것을 검사했고 우리는 이런 종류의 수입이 없다. – pepuch