IDEA Reference - Essentials(基本要义)
原文
Intelli IDEA 2016.1 Reference
目錄
- Project
- SDK
- Module
- Facet
- Artifact
- Library
- Path Variables
- Supported Lanauage
- Scope
- Encoding
- Code Analysis
IntelliJ IDEA is an advanced IDE. To get the most out of its capabilities and features, you should be familiar with its concepts. Concepts describe the basic notions of the IDE.
IntelliJ IDEA是一款高性能IDE。為了能利用好其特性,您應(yīng)該熟悉相關(guān)基本概念。這些概念完整地描述了這款I(lǐng)DE的對(duì)開(kāi)發(fā)的理解。
Project
基礎(chǔ)
Whatever you do in IntelliJ IDEA, you do that in the context of a project. A project is an organizational unit that represents a complete software solution. It serves as a basis for coding assistance, bulk refactoring, coding style consistency, etc.
你在IDEA的任何操作都是在一個(gè)上下文下進(jìn)行的,這個(gè)上下文即為Project。一個(gè)Project是一個(gè)有組織的單元,代表了一套完整的軟件解決方案。
Your finished product may be decomposed into a series of discrete, isolated modules, but it's a project definition that brings them together and ties them into a greater whole.
您或許通常將一個(gè)完整的解決方案劃分成若干個(gè)具體而獨(dú)立的模塊,但是它們之間都屬于Project這個(gè)范疇內(nèi),齊心合力完成一項(xiàng)工作。
Projects don't themselves contain development artifacts such as source code, build scripts, or documentation. They are the highest level of organization in the IDE, and they define project-wide settings as well as collections of what IntelliJ IDEA refers to as modules and libraries.
通常來(lái)說(shuō),Project本身并不包含可用于部署工作的工件(例如源代碼、構(gòu)建腳本、文檔)。Project是最高級(jí)別的組織范疇,定義了一些全局的設(shè)置、包含哪些模塊和庫(kù)。
Project的格式和文件
IntelliJ IDEA stores the configuration data for projects and their components in plain text XML files making it easy to manage and share project configuration data with others.
IDEA通過(guò)把Project的配置數(shù)據(jù)保存到xml文件來(lái)簡(jiǎn)化數(shù)據(jù)的管理和分享。
Two formats are available for storing the project configuration data: directory-based and file-based.
兩種Project配置數(shù)據(jù)的儲(chǔ)存格式:基于路徑的和基于文件的。
基于路徑的Project配置
When the directory-based format is used, there is a .idea directory in the project directory.
如果您看到一個(gè)名為.idea的文件夾出現(xiàn)在工程目錄下,基于路徑的的配置正在被使用。
The .idea directory contains a set of configuration files (.xml). Each file contains only a portion of configuration data pertaining to a certain functional area which is reflected in the name of a file, for example, compiler.xml, encodings.xml, modules.xml.
在.idea路徑下有一系列配置文件,每個(gè)配置文件,其本身的文件名就能表明其作用,通常只包含一部分針對(duì)某些功能的配置項(xiàng)。例如:compiler.xml, encodings.xml, modules.xml。
Almost all of the files contain information core to the project itself, such as names and locations of its component modules, compiler settings, etc. Thus, these files may (and should) be kept under version control.
大部分文件包含了Project的核心信息,例如組件的名字和路徑、編譯器設(shè)定。所以這些文件應(yīng)該被版本管理系統(tǒng)所管理。
The exception is the file workspace.xml. It stores your personal settings such as placement and positions of your windows, your VCS and History settings, and other data pertaining to the development environment. So it's unlikely that you'd want to share this file with your colleagues.
例外是workspace.xml,它保存了一些設(shè)置,例如窗口的位置、版本控制系統(tǒng)的設(shè)置。所以您不應(yīng)該共享該文件到版本控制系統(tǒng)。
基于文件的Project配置
If the file-based format is used, there are two configuration files in the project directory. One of the files has the .ipr extension and stores the core project information. The other file has the .iws extension and stores your personal workspace settings.
如果使用的是基于文件的配置方式,工程目錄下有兩個(gè)配置文件,一個(gè)保存了核心項(xiàng)目配置文件,其擴(kuò)展名為ipr;另一個(gè)保存了個(gè)人關(guān)于工作空間的設(shè)置,其擴(kuò)展名為iws。
The .iws file shouldn't be placed under version control while the .ipr file should.
The file-based format can be converted into the directory-based, see Converting Projects Into Directory-Based Format.
iws文件不應(yīng)該被版本管理系統(tǒng)所管理,而ipr需要。
基于文件的配置可以被轉(zhuǎn)換成基于路徑的。
SDK
To develop applications, you need a Software Development Kit (SDK). A typical SDK example is the Java Development Kit (also known as Java SDK, or JDK). This is an SDK for producing Java programs.
為了開(kāi)發(fā)程序,你需要SDK。一個(gè)典型的SDK就是JDK,JDK使得你能編譯運(yùn)行Java程序。
IntelliJ IDEA does not include an SDK. So, before you start writing your code, you have to download and install at least one SDK and define it in IntelliJ IDEA. (You can specify an SDK when creating your first project or at a later time.)
IDEA本身并不包含一個(gè)SDK。所以在編寫(xiě)代碼前,您應(yīng)該至少為您的Project設(shè)置一個(gè)SDK。
To define an SDK in IntelliJ IDEA, generally, all you have to do is to specify its name and location. (This location, normally, is referred to as the SDK home directory. This is the directory in which the SDK is installed). Additional SDK adjustments are possible, however, in most of the cases, they are not necessary.
定義一個(gè)SDK只需指定名稱(chēng)和位置就可以了,除此以外,您也可以做一些額外的可選性質(zhì)的設(shè)置。
受支持的SDK
Depending on the nature of your application, you can use:
Java SDKs to develop Java desktop applications.
Mobile SDKs (Java Micro Edition (ME) SDKs) to develop applications for Java-enabled mobile devices.
Android SDKs to develop applications for Android devices.
Flex and AIR SDKs to develop applications for the Adobe Flash platform.
Flexmojos SDKs to launch the Flex compiler and debugger. (Such SDKs are created by IntelliJ IDEA automatically when importing Flexmojos projects.)
IntelliJ Platform Plugin SDKs to develop plugins for IntelliJ IDEA. (An IntelliJ IDEA installation acts as an IntelliJ Platform Plugin SDK.)
Note that the set of available SDK types depends on the IntelliJ IDEA edition being used (Community or Ultimate) and also on which plugins are currently enabled.
根據(jù)您的程序,你需要;
SDK等級(jí)
SDKs, generally, are defined at the global (i.e., the IDE) level and can be used in any of your projects.
One of the SDKs is assigned to the project level and is referred to as a project SDK. This SDK is used by default by all the modules of the corresponding project.
A module can use ("inherit") the project SDK, or, alternatively, a module-specific SDK can be specified.
一般而言,SDK是能被所有Project所共享的,它的等級(jí)是全局的。
Project也可以擁有自己的專(zhuān)屬SDK,被稱(chēng)為project sdk。Project SDK被所有的模塊所共享。
Module可以選擇直接繼承來(lái)自Project的SDK,或者自定義SDK。
SDK classpath, sourcepath, and documentation paths
When you add an SDK definition in IntelliJ IDEA, the IDE analyses the contents of the SDK installation folder (home directory) to find out where the corresponding binaries, sources and associated documentation are located. As a result, all the appropriate locations within the SDK are translated into corresponding paths and assigned to one of the following categories:
Classpath. This is a set of paths to directories and archives containing the SDK binaries. For a JDK, for example, this set includes the paths to class directories and JAR files that make up the Java API and its extensions.
You can add more SDK libraries to this set, however, this is never necessary for any standard SDK.
Sourcepath. This is a set of paths to directories and archives containing the source code for the SDK binaries included in the classpath set.
Including the source files isn’t required, but doing so improves IntelliJ IDEA’s ability to provide inline help while coding.
Documentation paths. This is a set of paths to documentation that describes the SDK source code.
Including documentation paths is also optional, but doing so gives you the ability to view documentation directly from the IDE.
If online documentation is available for the SDK, you can add the corresponding URL to the SDK documentation paths to be able to access this documentation when needed.
當(dāng)添加一個(gè)SDK到IDEA時(shí),IDEA將分析SDK家路徑,嘗試找出二進(jìn)制、源代碼、文檔。
Classpath是指包含了SDK主要二進(jìn)制的路徑或者jar。
Sourcepath和Documentation paths包含了源代碼和文檔的路徑。
Module
A module is a discrete unit of functionality which you can compile, run, test and debug independently.
一個(gè)Module是指一個(gè)具體的、可編譯、可運(yùn)行、可測(cè)試的單元。
Modules contain everything that is required for their specific tasks: source code, build scripts, unit tests, deployment descriptors, and documentation. However, modules exist and are functional only in the context of a project.
一個(gè)Module包含了所有為了目標(biāo)而需要的部分:源代碼、構(gòu)建腳本、單元測(cè)試、部署描述符、文檔。然而
Configuration information for a module is stored in a .iml module file. By default, such a file is located in the module's content root folder.
Development teams, normally, share the .iml module files through version control.
關(guān)于一個(gè)Module的配置文件都將被放到iml文件里。按照慣例這樣的配置文件將被放到模塊根路徑,而且iml文件應(yīng)該需要被版本控制系統(tǒng)所管理。
How TO
轉(zhuǎn)載于:https://www.cnblogs.com/hit-lacus/p/intellij-idea-reference-essentials.html
總結(jié)
以上是生活随笔為你收集整理的IDEA Reference - Essentials(基本要义)的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: svnserve.conf: Optio
- 下一篇: 10进制转16进制,16进制转10进制,