Original address: http://blog.csdn.net/z69183787/article/details/41416189
- 1. Preface
- 2. Item configuration (Project Structure)
- 2.1 Project
- 2.2 Modules
- 2.3 Libraries
- 2.4 Facts
- 2.5 Artifacts
- 3. Create a deployment for non-MAVEN projects
- Deployment of 4.Maven Projects
- 5. Summary
- This paper summarizes the problem of the deployment of Web projects in IntelliJ, and how to configure, because there is no very specific description of the Internet, so these are self-groping, there is no place to welcome everyone to correct
1. Preface
Although IntelliJ idea has been used for four months, most of the functions are relatively familiar, but many of the details are still unclear, the company another group in the past few days replaced with IntelliJ, help them move the project, because the non-MAVEN project, encountered a lot of problems , I have studied again, the following finishing
2. Project configuration (Project Structure) 2.1 Project
Project Compliler Output: Configuration is the default compilation export total directory in the project
The English also shows that each module can set its own special output directory so this is basically useless
2.2 Modules
Project module, a project can have multiple sub-projects, each sub-project is equivalent to a module
Generally our project is just a separate one, so we just need to configure a module, we can add a framework to the module
Depending on what is used in our project, add the corresponding framework and determine the relevant configuration file within the framework (because the project's file structure may be different under different Ides so the imported project we should pay attention to configuration)
The module configuration root is divided into three tags: sources--paths--depedencies
Directory resources for the main project under the Sources tab those are the directories that are needed when the project is deployed. Color hints
(such as the green is the test directory Orange is the target directory of these deployments do not need the big red is my project does not have the blue is really need to deploy)
Under Paths label
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)
Depedencies is a dependency of the project
We can click on the right side of the + sign to add Lib such as Tomcat Lib default added is provided
(similar to MAVEN's jar dependencies)
Provided is when the project is deployed, it is ignored but used when compiling the project.
Compile is not deployed with test that is deployed with the project
2.3 Libraries
The project jar package can be added and multiple jars can be placed in a group similar to the jar pack arrangement
The jar added below will be displayed in the depedencies (conversely, it is not possible)
2.4 Facts
Project façade, to tell the truth, really do not know what this is, and modules almost, mainly to confirm it
2.5 Artifacts
Package deployment settings for the project, which is a critical part of the project configuration
Note Where the red box is
The first is that we need to add a deployment package for the project note Select the war package that is exploded
The second one is the output directory of the project non-MAVEN project This can be set to anywhere
(Maven project needs special attention to this later)
The third is a few files in the output structure reference graph
(MAVEN project If you do not use MAVEN's package compilation note that the Lib under Web-inf in the diagram will have a jar for project deployment)
3. Create a deployment for non-MAVEN projects
Create File--new project--java--web Application
(Note that new project is not the web of choice but Java)
Web project Default Web page root in IntelliJ is web
Project configuration can refer to 2 in several places according to their own needs to modify their own
Artifact in out directory can be assigned to any local project package compiled into the specified directory
Start Tomcat in IntelliJ as the workspace for the directory that corresponds to the set of the war package out directory
For Tomcat configuration, refer to 2-7 in http://my.oschina.net/u/140593/blog/177042#OSC_h1_2
Deployment of 4.Maven Projects
In IntelliJ, MAVEN projects can be manually executed in accordance with several life cycles in MAVEN's packaged compilation reference graph
Because the contract for the MAVEN project is that the project is packaged and compiled into the target directory
So our configuration in 2 should be modified to follow MAVEN's configuration conventions.
This allows our projects to be IntelliJ and MAVEN projects in the same way when files are modified or hot-deployed.
(If you are creating a Maven project in IntelliJ, that IntelliJ will configure all of your configurations.)
Basic without modification we can create a springmvc example for reference)
The areas to note are:
Directory name of Out directory in MAVEN project artifact
Be sure to match the finalname of the build in the Pom file
In addition to the Pom file to configure <packaging>war</packaging>
For example, the project configured in Pom bulid finalname is called root
Then our out directory accumulates \test1\target\root for the E:\ project.
After you compile and package your project through MAVEN
In the server configuration, you can remove two options from the red zone to avoid recompiling and packaging each time you start
5. This paper summarizes the problem of the deployment of Web projects in IntelliJ, and how to configure, because there is no very specific description of the Internet, so these are self-groping, there is no place to welcome everyone to correct
Intellij the deployment configuration of the idea Web project [go]