2014-09-23 112 views
0

我想創建一個build.gradle文件來將一些類打包到jar中並將其部署到某個地方。舉個例子,我創建了一個類hello.class(經典的HelloWorld)和的build.gradle:Gradle部署Jar文件

task hello(type : Jar) { 
    archiveName = "hello.jar" 
    destinationDir = file("/home/GradleTest") 
    destFile = file("/home/GradleTest/hello.jar") 
    from("/home/GradleTest") } 

當我嘗試推出gradle這個(gradle build),我得到這個錯誤:

FAILURE: Build failed with an exception. 

* Where: 
Build file '/home/GradleTest/build.gradle' line: 4 

* What went wrong: 
A problem occurred evaluating root project 'GradleTest'. 
> No such property: destFile for class: org.gradle.api.tasks.bundling.Jar_Decorated 

* 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: 2.153 secs 

不任何人都知道什麼是問題?我給你我的gradle -v命令的結果:

------------------------------------------------------------ 
Gradle 2.0 
------------------------------------------------------------ 

Build time: 2014-07-01 07:45:34 UTC 
Build number: none 
Revision:  b6ead6fa452dfdadec484059191eb641d817226c 

Groovy:  2.3.3 
Ant:   Apache Ant(TM) version 1.9.3 compiled on December 23 2013 
JVM:   1.7.0_51 (Oracle Corporation 24.51-b03) 
OS:   Linux 3.13.0-24-generic amd64 

非常感謝您的幫助。

回答