Tomcat 7 - Maven Plugin?

45,174

Solution 1

There is t7mp - a Tomcat 7 Maven Plugin - on Google code.

Cargo (and its Cargo Maven2 Plugin) also has support for Tomcat 7 (this was CARGO-790).

Apache Tomcat Maven Plugin 2.0-beta-1 supports Tomcat 7.

Solution 2

It work for me as the following.

My setting.xml

 <server>  
   <id>local_tomcat</id>  
   <username>ray</username>  
   <password>password</password>  
 </server>  

My plugin configuration

 <plugin>
  <groupId>org.codehaus.mojo</groupId>
  <artifactId>tomcat-maven-plugin</artifactId>
  <configuration>
     <server>local_tomcat</server>  
     <url>http://localhost:8080/manager/text</url>  
  </configuration>
 </plugin>

My tomcat-users.xml

 <role rolename="manager-gui"/>
    <role rolename="manager-script"/>
  <user password="password" roles="manager-gui, manager-script" username="ray"/>

Solution 3

i use the official Tomcat7 Maven Plugin from Apache as follows:

            <plugin>
                <groupId>org.apache.tomcat.maven</groupId>
                <artifactId>tomcat7-maven-plugin</artifactId>
                <version>2.0</version>
                <configuration>
                    <path>/${project.artifactId}</path>
                    <port>8080</port>
                </configuration>
            </plugin>

and to run it: mvn tomcat7:run

Solution 4

Using maven cargo your can coufigure your project that way :

<plugin>
    <groupId>org.codehaus.cargo</groupId>
    <artifactId>cargo-maven2-plugin</artifactId>
    <version>1.0.6</version>
    <configuration>
        <container>
            <containerId>tomcat7x</containerId>
            <type>installed</type>
            <home>${catalina.home}</home>
        </container>
        <configuration>
            <type>existing</type>
            <home>${catalina.home}</home>
        </configuration>
        <deployer>
            <type>installed</type>
            <deployables>
                <deployable>
                    <groupId>${project.groupId}</groupId>
                    <artifactId>${project.artifactId}</artifactId>
                    <type>war</type>
                </deployable>
            </deployables>
        </deployer>
    </configuration>
</plugin>       

don't forget to configure your catalina.home property

The you can deploy it using:

mvn cargo:deploy

Solution 5

There is the Tomcat Maven Plugin 7 plugin developed by the Apache Tomcat team.

Currently you have to checkout the sources and install it to your local repository. After that you can use it in the plugin section of your pom:

      <plugin>
          <groupId>org.apache.tomcat.maven</groupId>
          <artifactId>tomcat7-maven-plugin</artifactId>
          <version>2.0-SNAPSHOT</version>
        <executions>
          <execution>
            <id>start-tomcat</id>
            <phase>compile</phase>
            <goals>
              <goal>run</goal>
            </goals>
            <configuration>
                  <path>/</path>
                  <serverXml>src/main/tomcatconf/server.xml</serverXml>
                </configuration>
          </execution>
        </executions>
      </plugin>
Share:
45,174
Admin
Author by

Admin

Updated on September 18, 2020

Comments

  • Admin
    Admin over 3 years

    I just wanted to double-check, has anyone found or is working on a Tomcat 7 plugin? If not, is anyone interested in helping me get it up and running?

    I want another quick alternative to Glassfish, JBoss AS 6.0 is a bit heavy still for quick mockups.

    Walter