Gradle Initializing the Project catalog

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.