Build Maven in Idea development environment and use Maven to package and deploy the program.
1. configure the Maven environment variable. first, download the maven program from the Maven official website and decompress it to the installation directory: B. configure the M2_HOME environment variable and add it to the Path. Note: You must have the JAVA_HOME M2_HOME environment variable. Otherwise, Maven will prompt an error. Configure the environment variable: c. if you want to modify the local repository location of Maven, you can find the setting configuration file in the conf file under the Maven installation directory and set localRepository to the local repository location <localRepository> E: \ java \ repo </localRepository> d. re-open the command prompt cmd (Administrator) and enter mvc -- version. The installation is successful. build Maven in Idea development environment
A. after configuring Maven, We need to configure Maven for Idea. First, we must install Idea first. It is not cumbersome to install Idea here. Please do it on your own, which is very simple, next, go to the Idea settings Maven page ,:
B. click Setting and set the Maven home directory, user settings file, and local repository under the Maven node. Here we have finished configuring Maven for Idea, the following describes how to use Maven to develop a Java Web project and package it with Maven. 3. Use Maven to develop the JavaWeb Project (Idea14)
A. We have configured the Maven environment for Idea through the above steps. At this time, we prefer to create a Java Web project managed by Maven. How can we create it?
B. click File-> New Project-> select Maven, select Createfrom archetype, and select maven-archetype-webapp c. click Next and enter GroupId, ArtifactId, and Version d. click Next. The maven installation information is displayed on this page. click Next. Enter the project name and path strength of the project. click Finish. The Maven project is successfully created. if an error is reported when you click Finish in the following prompt, the problem may be caused by the compatibility problem between Maven and Idea. We recommend that you replace Maven with a lower version. Error: Note: when changing the Maven version, you must change the environment variables and Idea settings. 4. Use Maven to package Java Web projects
A. After installing Maven and developing a Maven JavaWeb project through the above steps, we need to release the JavaWeb package (war file) to Tomcat. How can we package it?
B. in the rightmost navigation bar of Idea, you can see a Maven project and click open, (figure 1) (figure 2) c. next we can use this simple tool to package Maven (war ). As shown in d.2, an error occurs when you click Run Maven Build. e. after the preceding error occurs, follow the steps below to solve the problem. click File> Setting> enter Maven in the search box and press enter to directly locate the Maven node> Runner, open this section (-Dmaven. copy multiModuleProjectDirectory = $ M2_HOME) to the VM Options text box and click OK. F. As shown in figure 2, we run the package again and found that no error is reported, and entered some content to prove that the package program is ready. G. right-click install and choose Run. After running, the system will prompt you where to package the war package, h. find the war package, copy it to the WebApps folder of Tomcat, and then visit the website directly. Install tomcat in Linux (Centos) and deploy Java Web project: http://www.cnblogs.com/hanyinglong/p/5024643.html light affection heavy ~~~, In case of any errors, you are welcome to point it out. Next, we will deploy the redis project under Linux.