1. Introduction to Maven
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
-MVN Clean
-MVN Package
-MVN Install//installs the newly created jar package into the warehouse
-MVN archetype:generate//Create a new project
Central Factory Url:http://search.maven.org/http://repo.maven.apache.org/maven2
This article mainly demonstrates how to configure and use the IntelliJ IDEA IDE environment.
2. Configure Maven
Software is configured once and all MAVEN projects are shared.
1) Select your own warehouse, if 3
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 when we then to a dependent package for the Internet download. 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.
3. Maven Skeleton Create Java Web project
1) File--New Project ...
2) if
3) if
GroupID and artifactid< project name > also version, these three properties are intended to identify the uniqueness of your project.
4) if
5) if
6) After you click Finish, MAVEN will create a MAVEN-based Web App based on the configuration you just made.
-Create the end, whose log is as follows:
-Create the end 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
4. Start the Java Web project
1) Open "Project Structure"
2) Configure "Facets"
3) Configure "artifacts"
4) Start "Edit configurations"
5) Add New ' Tomcat Server ' configuration
6) Configuration Deplyment
7) Configure the server
The results are as follows:
8) Start Web Server
You can now access webserver's page through browser.
5. Deploying the war file in Tomcat
1) Copy the Mvndemo.war to the WebApps directory of Tomcat.
2) Access the url:http://localhost:8080/mvndemo/on the browser.
6. 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.
Create a Java Web project with IntelliJ Idea 15 and maven (GO)