Gradle will not help us generate the default directory layout, and every time we create a new directory for ourselves, repeating the work is the most unbearable.
Although Gradle has plug-ins to help with this task, but always feel that the plugin is too heavy.
You can also use task to accomplish tasks:
Apply plugin: ' java ' Apply plugin: ' War ' task Createjavaproject << {sourcesets*.java.srcdirs*.each {it.mkdirs () } sourcesets*.resources.srcdirs*.each {It.mkdirs ()}} task Createwebproject (dependsOn: ' Createjavaproject ') << { def webappdir = File ("$webAppDirName") Webappdir.mkdirs ()}
However, the task is only used once and will no longer be used, in the original concise build.gradle file with white more than two of the tasks are down grade.
Only today, the original mkdir can have a number of directory parameters, Windows a little bit of trouble, but also a command can be done:
E:\>mkdir APPTESTE:\>CD Appteste:\apptest>mkdir src\main\java,src\main\resource,src\test\java,src\test\ Resource,src\main\webappe:\apptest>tree Volume Document folder The PATH list volume sequence number is 000b-6223e:.└─src├─main│├─java│├─resource │└─webapp└─test├─java└─resource
Using the shell under Linux is simpler than "1":
Mkdir-p Src/main/{java,resources,webapp} Src/test/{java,resource}
Resources:
"1" initializes the Gradle project catalog http://unmi.cc/blog/2014/04/21/initialize-gradle-project-layout/
Gradle Initializing the Project catalog