如何在Intellij IDEA上导入现有的Maven + Spring MVC + Tomcat项目? [英] How to import existing Maven + Spring MVC + Tomcat project on Intellij IDEA?

查看:1227
本文介绍了如何在Intellij IDEA上导入现有的Maven + Spring MVC + Tomcat项目?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是IntelliJ IDEA的新手。我从git仓库导入了项目。现在我尝试在Tomcat 8.5上运行它但没有成功。我知道我需要配置maven命令将我的项目打包到war文件中,但我不知道在哪里做。

I'm new to IntelliJ IDEA. I've imported project from git repository. Now I try to run it on Tomcat 8.5 with no success. 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.

推荐答案

在Intellij中导入你的项目。

从现有的源 - >转到file-> new-> project,然后选择<$ c来自磁盘上项目位置的$ c> pom.xml 。然后按照IntelliJ给出的说明检查maven的框,自动下载项目的依赖项。

Go to file->new->project from existing source-> then select the pom.xml from your project location on your disk. then follow the instruction given by IntelliJ.Check the box for maven to automatically download dependency for your project.

从您的代码创建战争

运行 mvn从 pom.xml 所在的目录中清理包。它将在同一文件夹的目标文件夹中创建 war 文件,其中 pom.xml 存在。

Run mvn clean package from the directory where pom.xml is present. it will create war file in the target folder of same folder, where pom.xml is present.

根据想法创建war文件

点击最右边的图标 maven项目在想法中你会看到不同的maven生命周期,点击 package 来创建项目的war文件。再次在项目的目标文件夹中可以使用相同的war文件。

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. again same war file will be available inside the target folder of your project.

按照下面的图像更清晰: -

follow below images for more clarity:-

这篇关于如何在Intellij IDEA上导入现有的Maven + Spring MVC + Tomcat项目?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆