Tomcat Maven Plugin

2,531 views
2,442 views

Published on

updated version

Published in: Technology
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
2,531
On SlideShare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
19
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

Tomcat Maven Plugin

  1. 1. Apache Tomcat Maven Plugin
  2. 2. © Talend 2011 2 Agenda  Overview and history  What you can do:  Run your war project in an embeded Apache Tomcat within your Apache Maven build  Deploy your war in a running Apache Tomcat instance  Features recently implemented  Questions
  3. 3. © Talend 2011 3 /me Olivier Lamy Open Source Architecte @Talend in the Apache Team.  Apache Member : PMC Maven/Archiva, Commons, Tomcat, Incubator : Sqoop, Kalumet, DirectMemory  Jenkins committer  Mojo committer  Etc... (add bugs in various open source projects) Web Ids :  Twitter: twitter.com/olamy  Blog: olamy.blogspot.com
  4. 4. © Talend 2011 4 Overview and history Developpement started in Mojo at Codehaus early 2006. For trademark issue move to Apache Tomcat umbrella in 2011. Now developpement at Apache with groupId change to org.apache.tomcat.maven and Mojos renamed to tomcat6 :* with support added of Tomcat7 tomcat7 :*
  5. 5. © Talend 2011 5 Running an embeded Apache Tomcat Simply use mvn tomcat*:run to run your Apache Maven war project. No Apache Tomcat to install locally. Maven will download all necessary jars to run an embeded Tomcat. In Maven3 multi modules project, reactors projects automatically added to the webapp classloader : no need to install all jars dependencies. Easy developpement of webapp : no need of restart/install war when modifying jsp/css etc... Debug in your ide with mvnDebug.
  6. 6. © Talend 2011 6 Deployment in Apache Tomcat Deploy your Apache Maven project in a running Apache Tomcat instance. Attach the deploy goal to the deploy phase in a profile and your build war will be deploy in a running Tomcat instance. Simple : mvn deploy -Ptdeploy Run the Maven lifecycle (build your war, deploy it to your Repo Man and deploy it to your Tomcat instance)
  7. 7. © Talend 2011 7 Executable jar/war Mojo goal to build a standalone jar to run your war. Jar will include your webapps and all necessary Tomcat jars. Cli : mvn tomcat7:exec-war produces a jar my-project-exec-war.jar Simply your project : jar -jar my-project-exec-war.jar Come with some default setup: http port, default server.xml But optionnal cli options : -httpPort -ajpPort etc.. (RTFM :-) )
  8. 8. © Talend 2011 8 Maven archetype There is now an archetype : mvn archetype:generate -DarchetypeGroupId=org.apache.tomcat.maven -DarchetypeArtifactId=tomcat-maven-archetype -DarchetypeVersion=2.0-SNAPSHOT Generate a standard multi modules Maven project : * basic-api (service interface) * basic-api-impl (service default impl). * basic-webapp (our webapp module) * basic-webapp-exec (module to generated executable war) * basic-webapp-it (module to run selenium tests with generated war)
  9. 9. Merci ! Questions ?

×