我正在尝试使用Gradle构建基本的Java/Groovy项目。我有一个Groovy类,一个jar文件,并与下面的文件结构的XML文件:Java/Groovy Gradle构建错误
项目结构:
QB/
/src/
/main/
/groovy/somefile.groovy
/lib/
/jcifs-1.3.17.jar
/config/
/config.xml
/build.gradle
中的build.gradle文件内容:
apply plugin: 'java'
apply plugin: 'groovy'
targetCompatibility = "1.6"
sourceCompatibility = "1.6"
version = "1-SNAPSHOT"
repositories {
mavenCentral()
}
dependencies {
groovy group: 'org.codehaus.groovy', name: 'groovy', version: '1.8.5'
runtime fileTree(dir: 'lib', includes: ['*.jar'])
}
,但我一直得到这个错误:
:compileJava UP-TO-DATE
:compileGroovy
[ant:groovyc] org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
[ant:groovyc] ..../QB/src/main/groovy/QuickBookSync.groovy: 2: unable to resolve class jcifs.smb.SmbFile
[ant:groovyc] @ line 2, column 1.
[ant:groovyc] import jcifs.smb.SmbFile
[ant:groovyc] ^
[ant:groovyc]
[ant:groovyc] ..../QB/src/main/groovy/QuickBookSync.groovy: 3: unable to resolve class jcifs.smb.SmbFileInputStream
[ant:groovyc] @ line 3, column 1.
[ant:groovyc] import jcifs.smb.SmbFileInputStream
[ant:groovyc] ^
[ant:groovyc]
[ant:groovyc] ..../QB/src/main/groovy/QuickBookSync.groovy: 1: unable to resolve class jcifs.smb.NtlmPasswordAuthentication
[ant:groovyc] @ line 1, column 1.
[ant:groovyc] import jcifs.smb.NtlmPasswordAuthentication
[ant:groovyc] ^
[ant:groovyc]
[ant:groovyc] 3 errors
[ant:groovyc]
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':compileGroovy'.
Cause: Forked groovyc returned error code: 1
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
有什么想法?
感谢
如果您在您最喜欢的IDE中打开该项目,并手动将jcifs-1.3.17.jar添加到类路径中,请执行此导入工作,或者您是否遇到无法找到所需类的错误(与groovy一样建立)? – u6f6o 2013-08-14 10:00:48