简体   繁体   English

如何在Intellij IDEA上导入现有的Maven + Spring MVC + Tomcat项目?

[英]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:- 请按照下面的图片更清晰:-

从intellij创建战争文件

存在战争的目标文件夹

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 ClassNotFoundException:IntelliJ IDEA在tomcat7上部署Maven Spring MVC Web项目时出现org.springframework.core.io.Resource - ClassNotFoundException: org.springframework.core.io.Resource when intellij idea deploy maven spring mvc web project on tomcat7 如何将GeoTools导入Intellij IDEA中的现有项目? - How do you import GeoTools into an existing project in Intellij IDEA? Intellij Idea Tomcat和Spring MVC模板 - Intellij Idea Tomcat and Spring MVC template 如何在 Intellij IDEA 13.1 中使用 Maven 结构创建 Spring MVC 应用程序? - How to create Spring MVC application with Maven structure in Intellij IDEA 13.1? 无法导入MAVEN项目IntelliJ Idea - No option to import MAVEN project IntelliJ Idea 从github导入Maven项目到Intellij IDEA - Import maven project from github to Intellij IDEA Spring MVC 使用 tomcat、maven 和 intelliJ 错误 - Spring MVC using tomcat, maven and intelliJ Error 在 Intellij 上运行但不在 Tomcat 上运行的 Spring Boot 2 Maven 项目 - Spring Boot 2 Maven project running on Intellij but not on Tomcat 无法在 IntelliJ IDEA 中导入 spring boot maven 项目 - IDE 导入后无响应 - Unable to import spring boot maven project in IntelliJ IDEA - IDE not responding after importing 使用IntelliJ Idea在tomcat上使用JSP调试运行maven web项目 - Run maven web project with JSP debugging on tomcat with IntelliJ Idea
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM