[英]How to import existing Maven + Spring MVC + Tomcat project on Intellij IDEA?
I'm new to IntelliJ IDEA. 我是IntelliJ IDEA的新手。 I've imported project from git repository.
我已经从git仓库导入了项目。 Now I try to run it on Tomcat 8.5 with no success.
现在,我尝试在Tomcat 8.5上运行它,但没有成功。 I understand that I need to configure maven command to package my project in war file, but I do not know where to do it.
我了解我需要配置maven命令以将我的项目打包在war文件中,但是我不知道在哪里做。
Import your project in Intellij. 在Intellij中导入您的项目。
Go to file->new->project from existing source-> then select the pom.xml
from your project location on your disk. 转到文件->新建->来自现有源的项目->,然后从磁盘上的项目位置选择
pom.xml
。 then follow the instruction given by IntelliJ.Check the box for maven to automatically download dependency for your project. 然后按照IntelliJ的说明进行操作。选中Maven复选框以自动下载项目的依赖项。
Create war from your code 用您的代码发动战争
Run mvn clean package
from the directory where pom.xml
is present. 从存在
pom.xml
的目录中运行mvn clean package
。 it will create war
file in the target folder
of same folder, where pom.xml
is present. 它将在存在
pom.xml
的同一文件夹的target folder
中创建war
文件。
Create war file from idea 从想法创建战争文件
Click on the right most icon of maven project
in idea and there you will see different maven lifecycle, click on package
to create war file of your project. 单击想法中最右边的
maven project
图标,您将在其中看到不同的Maven生命周期,然后单击package
创建项目的war文件。 again same war file will be available inside the target folder of your project. 同样,相同的war文件将在项目的目标文件夹中可用。
follow below images for more clarity:- 请按照下面的图片更清晰:-
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.