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。为了能利用好其特性,您应该熟悉相关基本概念。这些概念完整地描述了这款IDE的对开发的理解。




924469-20160706191244592-1606301195.png

Project

基础

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的任何操作都是在一个上下文下进行的,这个上下文即为Project。一个Project是一个有组织的单元,代表了一套完整的软件解决方案。

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.

您或许通常将一个完整的解决方案划分成若干个具体而独立的模块,但是它们之间都属于Project这个范畴内,齐心合力完成一项工作。

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.

通常来说,Project本身并不包含可用于部署工作的工件(例如源代码、构建脚本、文档)。Project是最高级别的组织范畴,定义了一些全局的设置、包含哪些模块和库。

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通过把Project的配置数据保存到xml文件来简化数据的管理和分享。

Two formats are available for storing the project configuration data: directory-based and file-based.

两种Project配置数据的储存格式:基于路径的和基于文件的。

基于路径的Project配置

When the directory-based format is used, there is a .idea directory in the project directory.

如果您看到一个名为.idea的文件夹出现在工程目录下,基于路径的的配置正在被使用。

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路径下有一系列配置文件,每个配置文件,其本身的文件名就能表明其作用,通常只包含一部分针对某些功能的配置项。例如: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的核心信息,例如组件的名字和路径、编译器设定。所以这些文件应该被版本管理系统所管理。

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,它保存了一些设置,例如窗口的位置、版本控制系统的设置。所以您不应该共享该文件到版本控制系统。

基于文件的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.

如果使用的是基于文件的配置方式,工程目录下有两个配置文件,一个保存了核心项目配置文件,其扩展名为ipr;另一个保存了个人关于工作空间的设置,其扩展名为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文件不应该被版本管理系统所管理,而ipr需要。

基于文件的配置可以被转换成基于路径的。

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.

为了开发程序,你需要SDK。一个典型的SDK就是JDK,JDK使得你能编译运行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本身并不包含一个SDK。所以在编写代码前,您应该至少为您的Project设置一个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.

定义一个SDK只需指定名称和位置就可以了,除此以外,您也可以做一些额外的可选性质的设置。

受支持的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.
根据您的程序,你需要;

  1. JDK
  2. JavaME
  3. Android SDK
  4. Flex
  5. 其它

SDK等级

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所共享的,它的等级是全局的。
Project也可以拥有自己的专属SDK,被称为project sdk。Project SDK被所有的模块所共享。
Module可以选择直接继承来自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.

当添加一个SDK到IDEA时,IDEA将分析SDK家路径,尝试找出二进制、源代码、文档。

Classpath是指包含了SDK主要二进制的路径或者jar。
Sourcepath和Documentation paths包含了源代码和文档的路径。

Module

A module is a discrete unit of functionality which you can compile, run, test and debug independently.

一个Module是指一个具体的、可编译、可运行、可测试的单元。

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.

一个Module包含了所有为了目标而需要的部分:源代码、构建脚本、单元测试、部署描述符、文档。然而

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.

关于一个Module的配置文件都将被放到iml文件里。按照惯例这样的配置文件将被放到模块根路径,而且iml文件应该需要被版本控制系统所管理。

924469-20160706191716436-1662561704.png



How TO

924469-20160713163130654-363923388.png

924469-20160713163502092-1911577313.png

924469-20160713163548092-687304964.png

924469-20160713172136998-1705239195.png

转载于:https://www.cnblogs.com/hit-lacus/p/intellij-idea-reference-essentials.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值