Objective
The computer again power off, see the writing good thing will not, this is the second time make this mistake. It's hard to be affected! Let's get back to the point, we'll use idea and maven to build a Javaweb project.
Software Environment:
idea:2017.2.1
jdk:1.8.0_91
maven:3.3.9
I. MAVEN configuration 1.1, Maven introduction
Projects managed and built under Maven are really good and simple compared to traditional projects, so it's also important to use such tools as much as possible to build projects that can manage the entire lifecycle of a project.
You can do all the relevant work with its commands, and its common commands are as follows:
- mvn compile - mvn test - mvnclean- mvn Package-mvn Install // Install the newly created jar package into the warehouse // Create a new project
1.2. Configure Maven in Idea
Software is configured once and all MAVEN projects are shared.
1) Select your own warehouse, if 4
1) as shown in callout 2, Import Maven projects automatically indicates that IntelliJ idea will monitor the project's Pom.xml file in real-time and make changes to the project settings.
2) whether the source code and documentation are downloaded automatically when Maven imports the dependent packages as shown in callout 3. The default is not checked, and is not recommended, because this can speed up the project from the external network to import the speed of the dependent package,
If we need source code and documentation, we can then download the Internet for a dependent package. IntelliJ idea supports the download of source code and documentation directly from the public network.
3) as shown in callout 3, you can set the imported VM parameters. Generally this does not need to actively change, unless the project is really imported too slow, we will increase this parameter.
Ii. maven Skeleton Creation Javaweb Project 2.1, Idea and maven create Javaweb process
1) File--New Project ...
2)
3)
GroupID and artifactid< project name > also version, these three properties are intended to identify the uniqueness of your project.
4)
5)
6) After you click Finish, MAVEN will create a MAVEN-based Web App based on the configuration you just made.
2.2. Status after successful creation
1) Create the end, its log is as follows:
2) End of creation with the following code structure:
Recources folder: Typically used to store some resource files
WebApp folder: Used to store Web configuration files and JSP pages, etc., which has formed an original web application
2.3. Start Javaweb Project
1) Open "Project Structure"
Way One:
Way two:
2) Configure "Facets"
3) Configure "artifacts"
4) Start "Edit configurations"
5) Add New ' Tomcat Server ' configuration
6) Configuration Deplyment
The first step:
Step Two:
7) Configure the server
8) configuration Results
9) Start Web Server
Iii. other configuration 3.1. Deploy the war file in Tomcat
1) Copy the Usermanagementsystem.war to the WebApps directory of Tomcat.
2) Access the url:http://localhost:6060/usermanagementsystem/on the browser.
3.2. Create a Java program directory
1) Create a Java directory
2) Set the Java directory to sources
Select the Java folder, click on the Make As:sources, the folder will be blue, to save Java code, press OK.
Like on the recommendation Oh!
IntelliJ idea 17 and Maven build Javaweb project