Understanding of Idea web engineering

First understand the difference between several concepts
Compile, Make and

Build For Java development tools, there are generally three menu items Compile, Make and Build, the functions are similar, but there are differences.

Compilation is the process of converting source code into executable code. Compilation requires specifying the source file and the file path (output directory) of the compiled output. Java compilation will compile java into class files, copy non-java files (generally become resource files, such as pictures, xml, txt, poperties, etc.) to the compilation output directory, and keep the directory of the source folder hierarchical relationship.

In Java integrated development environments, such as Eclipse and IDEA, there are often three options related to compilation: Compile, Make, and Build. The most basic function of these three options is to complete the compilation process. But there is a big difference. The differences are as follows:
1. Compile: Only the selected target is compiled, regardless of whether it has been compiled before.

2. Make: Compile the selected target, but Make only compiles the files that have been changed in the last compilation, reducing repetitive work and saving time. (You don't need to think about how to check that there is no change, the IDE will handle it internally)

3. Build: It completely recompiles the entire project, regardless of whether it has been compiled or not. The Build process often generates a release package, which depends on the configuration of the IDE. Build is rarely used in practice, because it is basically not used during development, and tools such as ANT are generally used for release and production. Build takes a long time because it needs to compile all and perform additional work such as packaging.

The function of make module in idea is to compile the modified content of the current project, such as the modified java file
command+F9 is also the function of compilation.




Introduce project structure
ProjectSetting
Project is understood as the current workspace, and the workspace here is
the project module in the current workspace of dev Modules. For
example :
yt-account
yt-coms
yt-posweb
yt-sso
, etc. are all specific projects in the workspace, and each project here All are a complete web project
Libraries As the name suggests, the current package dependency
Facets refers to describing the important configuration of the project. For example, for web projects, the two most important concepts
a. Deployment Descriptors project startup configuration description file: web.xml File
b. Web Resource Directories Web resource files: files under the context root, including js, css, jsp, WEB-INFO/* (classes, lib)
Artifacts packaged products, which can be archives such as *.war, *.jar , It can also be a project result set in the form of a packaged file tree

. From here, we will introduce the name of the current workspace of the

Project , set the SDK and JDK, and set a common compilation input address. Of course, we will know each module. Configure your own corresponding compilation address, so here you can also not set the general compilation output address Modules 3 important concepts






source The location of the compiled source files, such as java, resource files *.xml, *.properties, there are generally 5 settings here, the class source path for production running, the resource source path for production running, and the class source path for test running After, the resource source path of the test run, the source source path of the Excluded file that needs to be excluded during packaging. The
Paths
Dependencies


path sets the output path after compiling the java file, and here specifies that our output path is set by the module itself. The global compilation output path set by Project does not apply.


dependencies Set up dependencies
Here , jdk is set to 1.8
. Add project jar package dependencies and server jar package dependencies through the '+' button. It should be noted that the jar package dependencies set the dependency scope, such as compile and include after compilation, provide dependencies when compiled but compiled After not being packaged into specific *.war


Libraries set the dependent jar package group, in order to refer to the dependent jar package more clearly and quickly in the dependencies step, here you can set some aliases to delineate some series of jar package


Facets, understood as aspects. What does he mean in the idea? Of course, what it describes here is the structure of the corresponding project.
Web is the type of the current project.
Web Module Deployment Descriptor refers to
the location of the web.xml project startup configuration file Web Resource Directories project resource files. There are many resource files, including js, css ,jsp and so on
Source Root project java file location



Artifacts crystallization, product. Here is the stuff that is packaged for production release
Output directory indicates the location where the product is saved after packaging.
Web Application: Archive indicates that the archive is used, that is, it is a sso.war file after packaging.
If you use Web Application: Exploded, it is still a file tree directory structure after packaging. The product
starts with different specifications and different packages. If you are interested in checking the information yourself,

output Layout Validation Pre-processing Post-processing
Through the meaning of these words, you can know that he is imitating ant, maven and other packaging tools, a package The order of the life cycle of the life cycle

For a web project, the most important j2ee specification concept is that there is a META-INF/MANIFEST.MF project description file,
WEB-INF/web.xml project startup configuration file, WEB-INF/ lib 3rd party jar package dependency, WEB-INF/classes The java code compilation output address of this project
context root means that the 'WebContent' directory contents 
are reflected in the artifacts configuration template, and the



SDK is the jdk Global Libraries
of this workspace. Now


, it refers to the alias management Problems of the global jar package dependency group

. This thing is very important. If there is a problem with the project configuration of the workspace, a prompt of the Problem will be given here. Sometimes, you can read the content of the problem here and click the prompt. fix automatically fixes errors. Of course, sometimes, you still need to fully understand the manual repair in the future.

What if you pack it?
In the Build option in idea,


I have configured many medium packaging methods, including those that are packaged as *.war packages, those that are packaged into a file tree structure, and the packaging of idea is very similar to that of ant and maven. You can execute the corresponding target or phase. We have produced the product we want. It should be noted
here that there are three default configurations of Action, Build, Rebuild, and Clean.
Build will realize intelligent, smart and efficient packaging according to whether the project file has changed;
Rebuild regardless of whether the file has changed, The original packaged files will be deleted. Repackaging
Clean is to directly delete the last packaged file



. Configure server. Here we use tomcat as the object of introduction.
Click Run -" Edit Configuration to add the tomcat server
. 'Update' action on frame deactivation is set to Update classes and resources here for debug debugging before launch: Make, Build Artifacts, Activate tool window In this configuration, Make is used to compile src/*.java files to WEB-INFO Under /classess, Build Artifacts is to package and generate the files configured in the packaging command to the specified location. What I understand about Activate tool Window is the above





The configured browser Chrome is used to automatically open the currently packaged project when the tomcat server is started, and display the content to the browser

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326314574&siteId=291194637