简体   繁体   English

创建后在Apache Tomcat上部署War文件

[英]Deploy war file on apache tomcat upon creation

I'm not well experienced in java. 我在Java方面经验不足。

I build a UI using JSP for my servlets to get input data from users. 我为自己的servlet使用JSP构建了一个UI,以从用户那里获取输入数据。 Everytime I want to see the UI and how the Servlets are performing I have to do all thses steps over and over again, 每当我想查看UI以及Servlet的执行情况时,我都必须一遍又一遍地完成所有这些步骤,

  1. create the war file by mvn clean install 通过mvn clean install创建war文件
  2. Copy war file to Webapps folder 将war文件复制到Webapps文件夹
  3. restart apache tomcat 重新启动apache tomcat
  4. View the result using the url 使用网址查看结果

I want to know if there is a command that i can use to rerun apache tomcat with the war file im building at once, So that i only have to refresh the webpage to see the result. 我想知道是否有一个命令可以立即使用构建的war文件重新运行apache tomcat,因此我只需要刷新网页即可查看结果。 Or any method that is easier than above. 或任何比上述方法更容易的方法。

I use Intellij Idea. 我使用Intellij Idea。

Thanks in advance. 提前致谢。

IntelliJ IDEA Community Edition does not support J2EE , but you can also achieve this in the following two ways. IntelliJ IDEA社区版不支持J2EE ,但是您也可以通过以下两种方式来实现。 For full support of tomcat, you can buy IntelliJ IDEA Enterpries Edition . 要完全支持tomcat,可以购买IntelliJ IDEA Enterpries Edition

Use maven-compiler-plugin 使用maven-compiler-plugin
1) Add this plugin to your pom.xml : 1)将此插件添加到您的pom.xml

<build>
    <finalName>mvn-webapp</finalName>
      <plugins>
          <plugin>
              <groupId>org.apache.maven.plugins</groupId>
              <artifactId>maven-compiler-plugin</artifactId>
              <version>3.5.1</version>
          </plugin>
      </plugins>
  </build>

2) Then run this command: 2)然后运行以下命令:

mvn tomcat:run

Or Install Tomcat Runner Plugin 或安装Tomcat Runner Plugin

Refer to this link for usage of this plugin. 请参阅此链接以了解此插件的用法。

May be this will help you to deploy the war file on server 可能这将帮助您在服务器上部署war文件 可能这将帮助您在服务器上部署war文件

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM