apply plugin: ‘java’ //apply plugin: ‘groovy’ //apply plugin: ‘application’
sourceSets {
main {
java {
srcDir ‘src’
}
} } //mainClassName = “HelloWorld”
//applicationDefaultJvmArgs = ["-jar Hello.jar"]
task execute(type: JavaExec) {
main = ‘HelloWorld’
//classpath configurations.runtime
classpath = files(’./build/libs/*’) }
jar{
println ‘fdsafasdfasdfasdfasd’
manifest {
attributes (
‘Main-Class’: ‘HelloWorld’)
} }
[zhiming@localhost Hello]$ gradle buil fdsafasdfasdfasdfasd :compileJava UP-TO-DATE :processResources UP-TO-DATE :classes UP-TO-DATE :jar UP-TO-DATE :assemble UP-TO-DATE :compileTestJava UP-TO-DATE :processTestResources UP-TO-DATE :testClasses UP-TO-DATE :test UP-TO-DATE :check UP-TO-DATE :build UP-TO-DATE
BUILD SUCCESSFUL
Total time: 4.589 secs [zhiming@localhost Hello]$ gradle clean fdsafasdfasdfasdfasd :clean
BUILD SUCCESSFUL
Total time: 2.355 secs