简体   繁体   English

我如何告诉Maven Tomcat在哪里?

[英]How do I tell maven where is Tomcat?

I am trying to launch tomcat using following maven command 我正在尝试使用以下maven命令启动tomcat

mvn tomcat7:run

But how do I tell maven that tomcat is located at D:\\Tomcat\\ 但是我如何告诉Maven Tomcat位于D:\\Tomcat\\

pom.xml pom.xml

 <build>
    <finalName>test</finalName>
        <!-- MAVEN COMPILER PLUGIN -->
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.1</version>
        <configuration>
          <source>1.6</source>
          <target>1.6</target>
        </configuration>
      </plugin>

    <!-- MAVEN TOMCAT PLUGIN -->
    <plugin>
        <groupId>org.apache.tomcat.maven</groupId>
        <artifactId>tomcat7-maven-plugin</artifactId>
        <version>2.1</version>
        <configuration>
            <url>http://localhost:8080/manager/text</url>
            <server>tomcat-server</server>
            <path>/${project.build.finalName}</path>
        </configuration>
      </plugin>
    </plugins>
  </build>

mvn tomcat7:run is the command of tomcat7 maven plugin. mvn tomcat7:runtomcat7 maven插件的命令。 To run it you don't need to tell external tomcat server. 要运行它,您无需告诉外部tomcat服务器。 It automatically download the server from repository and run the project. 它会自动从存储库下载服务器并运行项目。

tomcat7-maven-plugin should automatically download Tomcat instance. tomcat7-maven-plugin应该会自动下载Tomcat实例。 So there is no reason to specify path to your local tomcat. 因此,没有理由指定本地tomcat的路径。

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

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