Press "Enter" to skip to content

Apache Tomcat 7 Maven plugin

I was searching for Apache Tomcat 7 Maven plugin. I found only messages that no such thing exists and that I have to use some workaround. Finally I found link at StackOwerflow that pointed me to the testing version of  such a plugin.

You just need to configure repository and update mojo definition.

 <repositories>
    <repository>
      <id>people.apache.snapshots</id>
      <url>http://repository.apache.org/content/groups/snapshots-group/</url>
      <releases>
        <enabled>false</enabled>
      </releases>
      <snapshots>
        <enabled>true</enabled>
      </snapshots>
    </repository>
  </repositories>

  <pluginRepositories>
    <pluginRepository>
      <id>apache.snapshots</id>
      <name>Apache Snapshots</name>
      <url>http://repository.apache.org/content/groups/snapshots-group/</url>
      <releases>
        <enabled>false</enabled>
      </releases>
      <snapshots>
        <enabled>true</enabled>
      </snapshots>
    </pluginRepository>
  </pluginRepositories>
...
<plugin>
      <groupId>org.apache.tomcat.maven</groupId>
      <artifactId>tomcat7-maven-plugin</artifactId>
      <version>2.0-SNAPSHOT</version>
      <configuration>
        <path>/</path>
      </configuration>
    </plugin>

You can run Tomcat7 by: mvn tomcat7:run

You can read more about this new version of Tomcat Maven plugin at tomcat.apache.org.

This plugin is still under development.

BTW: List Maven plugins hosted at Apache.org is available at maven.apache.org/plugins.

4 Comments

  1. Yiannis 18. September 2012

    THANK YOU!

  2. piterT 24. December 2012

    Hi,
    when I try mvn clean install tomcat7:run i get an error on the clean phase: it cant delete target directory

    do you know why???

    here is my pom.xml

    4.0.0
    com.design.prueba
    PruebaDesign
    war
    0.0.1-SNAPSHOT
    PruebaDesign Maven Webapp
    http://maven.apache.org

    people.apache.snapshots
    http://repository.apache.org/content/groups/snapshots-group/

    false

    true

    apache.snapshots
    Apache Snapshots
    http://repository.apache.org/content/groups/snapshots-group/

    false

    true

    junit
    junit
    3.8.1
    test

    org.apache.struts
    struts2-core
    2.3.4.1

    PruebaDesign

    org.apache.tomcat.maven
    tomcat7-maven-plugin
    2.0-SNAPSHOT

    maven-compiler-plugin
    2.3.2

    1.6
    1.6

  3. piterT 24. December 2012

    pffff this has unformatted my message, well I let you message error:

    Failed to execute goal org.apache.maven.plugins:maven-clean-plugin:2.4.1:clean (default-clean) on project PruebaDesign: Failed to clean project: Failed to delete C:\Users\peter\workspaces\ChercherEcoleWS\PruebaDesign\target\tomcat\logs\access_log.2012-12-24

  4. georgik 24. December 2012

    @piterT: You have to shutdown Tomcat if you want to clean target. It seems that you have some process which is blocking log file. This is typical issue with Windows OS.

Comments are closed.