1, the project configuration of understanding the most important of the various settings, it is this project structre, related to your project run, lack of arms and legs are not. Recently the company is also used to be familiar with the idea rather than eclipse, in order to better understand and use, to find a variety of data to study again, here to collate later output.
1.1 Project
- Project Name: Defines the names of the projects;
- Project SDK: Set up the JDK used by the project, or you can add a new version of the JDK here;
- Project Languagelevel: This is similar to the JDK, the difference is that if you set the JDK1.8, but only 1.6 of the features, then you can set the language class is 1.6, this is the minimum requirements for the project compilation check the JDK features;
- Project compileroutput: The default compilation export directory in the project, the yellow section, in fact each module can set its own special output directory (Modules-(Project)-Paths-use Module compile output path), so this setting is a bit of a chicken.
1.2 Modules1.2.1 Adding or deleting a subproject a project can have multiple sub-projects, each of which is equivalent to a single module.generally our project is just a separate one, IntelliJ idea is the form of the list item by default, so only one module needs to be configured. (two items are introduced here for example reference only)
1.2.2 Sub-project configuration each sub-project corresponds to the sources, Paths, Dependencies three configuration options:
- Sources: Displays the directory resources of the project, those that are needed when the project is deployed, and the different colors that represent the different types;
- Paths: You can specify the compiled output directory of the project, which is the compiled output address of the project class and the test class (the default output address of project is replaced)
- Dependencies: Project Dependencies
1.2.3/Delete Framework (Web Deployment-1) Each sub-project can define the framework under which it is used, highlighting the settings for the Web section.
1.3 Libraries Here you can display the jar package you added, you can also add jar packages, and you can put multiple jars inside a group, similar to jar wrapping.
By default, each jar package is made for a separate group (not tested, pending).
1.4 Facets Official explanation is: When you select a framework (a facet) in the element selector pane, the settings for the framework is SH Own in the right-hand part of the dialog. (When you click a technical frame on the left panel, the right side will show some of the settings for that frame)
To tell the truth, I didn't feel any effect.
1.5 Artifacts (Web Deployment-2) Project package deployment settings, this is a key point in the project configuration, focus on.
First understand what it means to see the official definition of Artifacts:an artifact is a assembly of your project assets that's put together to test,deploy or distribute your software solution or its part.Examples is a collection of compiled Java classes or a Java application packaged in a Java archive, a WEB application As a directory structure or a WEB application archive, etc.
That is, the compilation of Java classes, Web resources and other integration, for testing, deployment and so on. A little more vernacular, that is, how a module should be packaged, such as a war exploded, war, jar, ear, etc. AThe module can be deployed to the application server with artifacts.
(
jar: Java ARchive, typically used to aggregate a large number of Java class files, related metadata and resources (text, pictures, etc.) to a file to distribute Java platform applications or libraries;
War: Web application ARchive, a jar file that contains JSPs, Java Servlets, Java classes, XML files, tag libraries, static Web pages (HTML and related files) for distribution, and other resources that make up the Web application;
exploded: Here you can understand the meaning of unfolding, not compressing. That is, the war, jar and other outputs of the directory structure before compression. It is recommended to use this mode at the time of development, so that the effect of modifying the file immediately appears.
)By default, the output directory of idea's Modules and artifacts are already set up, no changes are required, and when you make a war package, the classes is automatically generated in the Web-inf directory, and then the compiled file is put in.
You may not understand the output directory here, not previously configured in the file compiled output directory? Why is there a directory where these resources are integrated? What has it done?
in fact, when you click Run Tomcat, the default is to start doing the following things:
- Compile, idea does not compile after saving/AutoSave, and does not compile like eclipse save, so it compiles once before running the server. The compiled class file is stored under the specified project compilation output directory (see 1.2.2);
- The directory structure is created according to the settings in artifact;
- Copy all files under the root directory of the Web resource into the artifact directory (see 1.2.3);
- Copy the classes directory under the compiled output directory to the Web-inf under artifact (see 1.2.2);
- Copy the jar package required under the Lib directory to the Web_inf under artifact;
- Run server, after successful run, automatically opens the browser to access the specified URL, if necessary.
It is also important to note that the configuration of the completed artifact needs to be added in Tomcat:
2. Reference links
- Introduction to several key concepts related to the IntelliJ idea project
- Dependencies Tab
- Facet Page
- Working with artifacts
- Intellij the difference between facets and artifacts in idea 14.x
- IntelliJ User Guide--deep understanding of IntelliJ's Web deployment logic
- IntelliJ deployment configuration for the idea Web project
Understanding the project configuration and Web deployment of IntelliJ idea