Prerequisite: The Gradle has been installed.I. Creating a directory Structure
Under the project home directory, create the following subdirectory, which you can use under the *nix system:
Mkdir-p Src/main/java/hello
Vim Src/main/java/hello/helloworld.java
Vim Src/main/java/hello/greeter.java
src/main/java/hello/HelloWorld.javaThe source code:
Public class HelloWorld { publicstaticvoid main (string[] args) { new Greeter (); System. out . println (Greeter.sayhello ());} }
src/main/java/hello/Greeter.javaThe source code:
Public class Greeter { public String SayHello () { return'Hello world! " ; }}
Write Build.gradle (use Gradle to build packages, rely on Maven central warehouse, Gradle Wrapper, and other building elements)
Apply plugin:'Java'repositories {mavenlocal () mavencentral ()}dependencies {compile"joda-time:joda-time:2.2"}jar {baseName='Gs-gradle'version='0.1.0'}task Wrapper (type:wrapper) {gradleversion='1.11'}apply Plugin:'Application'Mainclassname='Hello. HelloWorld'
Build:
Gradle
Reference:
Http://www.importnew.com/15881.html
Gradle Building a Java project