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.
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