idea14 uses maven to create web projects

Basic configuration:

1. Download the Maven file: apache-maven-3.2.1-bin.zip, unpacked to D:\server\apache-maven-3.2.1

 

2. Create a new one in the system variable: M2_HOME: D:\server\apache-maven-3.2.1

 

3. Add maven to the path system variable, and add it to the path: %M2_HOME%\bin;

View on the command line:

Ruby code 
  1. mvn -v  

At this point, the maven-related environment configuration information will be displayed. If the display is normal, the configuration is successful.

 

4. Modify the warehouse location:

Create D:\server\maven-repo directory, then modify settings.xml under D:\server\apache-maven-3.2.1\conf,

Xml code 
  1. <!-- localRepository  
  2.  | The path to the local repository maven will use to store artifacts.  
  3.  |  
  4.  | Default: ~/.m2/repository  
  5. <localRepository>/path/to/local/repo</localRepository>  
  6. -->  
  7.  <localRepository>D:\server\maven-repo</localRepository>  

 The default repository location is ~/.m2/repository, which is now changed to the D:\server\maven-repo directory.

 

5. Create a Maven Web project:

5-1. File --> new Module --> Maven (Note: The module in Idea is the project, which is equivalent to the eclipse project)

 

Check Create from archetype (select Maven archetype template) and choose one of the following archetypes, such as webapp.



 Idea uses Maven configuration information

 After creation, the project information is as follows:


 You need to manually create two file directories, src/main/java and src/test/java.

 Project information after creation is as follows:

 5-2. Configure tomcat

Open the panel Run -- "Edit Configurations, point +, select Tomcat server --> Local --> 


 After entering the tomcat name and configuration information, click the "Deployment" tab, click the + sign below, select "Artifact" in the pop-up list,
 a prompt box will pop up, and select the project to deploy


 Edit the name of the Application context and click OK to complete the Tomcat configuration.


 Click the green arrow below or the tomcat start arrow in the upper right corner to start the project deployed by tomcat.

 After the project starts, it will automatically jump to the browser.

So far, the process of project creation, Tomcat configuration, and project release has been completed.

 

Note: If you create a Java project, use maven-archetype-quickstart  when selecting the Maven template 

Guess you like

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