Apply plugin: ' idea '---gradle idea

Source: Internet
Author: User

If your project uses Gradle as the build tool, then you must use Gradle to generate the IDE's project files, without having to manually import the source code into your IDE.

If you are using Eclipse, you can add such a line in Build.gradle.

1
apply plugin: ‘eclipse‘

gradle eclipseyou can then build the project file for eclipse by typing it on the command line and using eclipse to open the generated project file directly.

Of course, as Java program developers, the most good IDE or INTELLIJ, yesterday heard that IntelliJ 13 has been released, adding a lot of new features, it seems to pay again. If you want to have Gradle automatically generate IntelliJ project files, you need to use the idea plugin.

1
apply plugin: ‘idea‘

command-line input gradle idea , will generate IntelliJ project files, it is time-saving. If you want to update the project file according to the configuration in Build.gradle, you can enter it if the project file already exists for IntelliJ gradle cleanIdea idea . cleanIdeayou can clear an existing IntelliJ project file.

There are three main types of IntelliJ project files.

    • . IPR IntelliJ Engineering Documents

    • . IML Intellij Module file

    • . IWS Intellij Workspace file

If you are simply using a project gradle idea file that generates IntelliJ, in fact, after you open the project with IntelliJ, we will do some manual configuration, such as specifying the JDK version, specifying the source control tool, and so on. Gradle's idea command essentially generates these three XML files, so Gradle provides a hook (hook) to generate the file, allowing us to easily customize it for maximum automation. This will require the task of customizing idea.

1234  
idea.project { jdkName = ‘1.6‘ languageLevel = ‘1.6‘}

The JDK and Languagelevel used to configure the project.

If you want to specify the source control tool type, you need to invoke the hook to modify the generated IPR file.

123456789       
Idea.Project{ ipr { {provider ->  Provider...{it. @name ==  ' vcsdirectorymappings ' }. Mapping.=  ' Git '  } }        /span>                

In this way, the IntelliJ project file can be customized to the fullest extent possible.

Apply plugin: ' idea '---gradle idea

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.