sumant.raj
sumant.raj

Reputation: 57

Maven - tomcat7:deploy uses external tomcat installation whereas tomcat7:run uses mavens custome tomcat installation

I have a maven project which I want to debug using apache tomcat7. Following are the contents of my pom.xml.

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-war-plugin</artifactId>
    <version>2.3</version>
    <configuration>
      <overlays>
        <overlay>
          <groupId>org.apache.manifoldcf</groupId>
          <artifactId>mcf-crawler-ui</artifactId>
          <type>war</type>
          <includes>
            <include>*.jsp</include>
            <include>*.css</include>
            <include>*.png</include>
          </includes>
          <targetPath>/</targetPath>
        </overlay>
        <overlay>
          <groupId>org.apache.manifoldcf</groupId>
          <artifactId>mcf-crawler-ui</artifactId>
          <type>war</type>
          <includes>
            <include>WEB-INF/jsp/*</include>
          </includes>
          <targetPath>/</targetPath>
        </overlay>
      </overlays>
    </configuration>
  </plugin>

<plugin>
        <groupId>org.apache.tomcat.maven</groupId>
        <artifactId>tomcat7-maven-plugin</artifactId>
        <version>2.1</version>
        <configuration>
                 <server>mytomcatserver</server>
                 <path>/mcf-combined-service</path>
                 <tomcatConfigurationFilesDirectory>/Servers/mytomcatserver-config</tomcatConfigurationFilesDirectory>
                 <url>http://localhost:8080/manager/text</url> 
                 <username>admin</username>
                 <password>admin</password>
                 <!--   <goal>deploy</goal>
                 <goal>run</goal> -->
        </configuration>
  </plugin>

</plugins>

I have created a tomcat server in eclipse with the name as mytomcatserver and made it use the installation directory. I have also specified this tomcat server in .m2/settings.xml. When I run tomcat7:deploy in maven build, it deploys war to specified tomcat instance and I can then access the web application from browser. But I want to debug the web application and hence when I say tomcat7:run in maven build, it creates separate tomcat installation in the target directory and try to deploy tomcat to that installation where it fails to deploy the war file.

Thanks in advance.

Upvotes: 1

Views: 590

Answers (1)

Olivier Lamy
Olivier Lamy

Reputation: 2310

Perso I use:

mvnDebug tomcat7:run

Then you are able to connect to a debugger on port 8000

Upvotes: 1

Related Questions