首页 > 解决方案 > 无法在 Visual Studio 代码中的 maven webapp 类型项目中添加嵌入式 Tomcat 服务器

问题描述

我是 java servlet 的新手,我正在尝试使用嵌入式 tomcat 服务器来运行我的 servlet。我在 POM.XML 中添加了这个插件。我正在使用 Visual Studio 代码


        <plugin>
          <groupId>org.apache.tomcat.maven</groupId>
          <artifactId>tomcat7-maven-plugin</artifactId>
          <version>2.2</version>
          <configuration>
            <port>9090</port>
          </configuration>
        </plugin>

我正在尝试运行命令mvn clean install以使用 tomcat 插件编译项目。然后这个错误不断出现。


PS F:\Project2020\ServletsInVSCode\servletdemo> mvn clean install
mvn : The term 'mvn' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path 
was included, verify that the path is correct and try again.
At line:1 char:1
+ mvn clean install
+ ~~~
    + CategoryInfo          : ObjectNotFound: (mvn:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

我不知道要解决这个问题。有人,请在这里帮助我。我知道很多关于 Maven 项目中的嵌入式 tomcat 的问题都被问过,但没有一个问题与我的问题相同。

标签: javamavenservletsweb-applications

解决方案


推荐阅读