IDEA how would a war JavaWeb item labeled package.

A, war package directory structure introduced.

The role of 1.Java are packaged jar, war, ear package, the difference between:
  • jar: usually referenced to common (the JAVA) developing class, labeled packet for storage management;
  • war: it is to do a (web) after application, usually the site, packed in bales deployed to the container;
  • ear: enterprise applications, in fact EAR WAR package contains several packages and enterprise-level project configuration files only, select WebSphere server generally, will be using the EAR package. EJB is usually labeled as ear package.

 

2.war package components: First, WebContent, the second is classess.
  • WebContent directory on its behalf is a web project, the main front-end code is stored, Web.xml, lib and other documents.
  • classes directory is a binary file after the java files compiled. (.class) the logic behind all of this control.

Note:
    WebContent directory there is a file named WEB-INF folder, we will classess file into this folder, and then the entire WebContent directory to package, package to form a war that we use when tomcat release.

Two, IDEA war carried out configuration.

1. First, open the [Project Structure] window for war configuration. (Two ways)

Here Insert Picture Description

2. Select the left of the [Artifacts] tab, add a [Empty] 's [Web Application: Archive].

Here Insert Picture Description

3. Click the + sign and choose [Directory Content], and then locate the root directory of your Web project. Click OK to.

Here Insert Picture Description

4. In / WEB-INF / classes directory, the class files compiled generated.

Here Insert Picture Description
Note: Click apply -> ok, this time on the war package configured.

Third, the project will be packaged.

Click [Build] -> [BuildArtifacts] -> [Build] menu, only to find themselves more deployment projects can be packaged.
Here Insert Picture Description
Note: The
   package is complete, you can find a specified time to configure war directory.

Published 107 original articles · won praise 173 · views 120 000 +

Guess you like

Origin blog.csdn.net/qq_42986107/article/details/92094960
Recommended