简体   繁体   中英

How do I tell maven where is Tomcat?

I am trying to launch tomcat using following maven command

mvn tomcat7:run

But how do I tell maven that tomcat is located at D:\\Tomcat\\

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. To run it you don't need to tell external tomcat server. It automatically download the server from repository and run the project.

tomcat7-maven-plugin should automatically download Tomcat instance. So there is no reason to specify path to your local tomcat.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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