Thursday, June 04, 2009

Deploying to tomcat using maven

This is a note to capture the process I am currently using to build and deploy a basic web application to tomcat for development.

  1. Create simple web app using archetype.
    mvn archetype:create ... -DarchetypeArtifactId=maven-archetype-webapp
  2. Add server to ~/.m2/settings.xml
  3. Add server to toplevel pom.xml
  4. compile, test, deploy, and subsequently redeploy
      $ mvn compile
      $ mvn test
      $ mvn tomcat:deploy
      $ mvn tomcat:redeploy

Of course what I would dearly love to know is how you configure a server url in the settings.xml file. The documentation I can find ( describes how to use a custom url, and how to configure authentication information. What it doesn't do is explain how you can do both at the same time, and all my attempts have resulted in XML validation errors when trying to run maven --- if I figure it out I'll update this post.


Steve Gillam said...

Regarding manager url in server.xml - the xml supports (and verified) {server}{configuration}{url} http://localhost:8080/manager {/url}{/configuration}{/server}
as used by

Unfortunately, whilst not creating any errors, the tomcat plugin seems not to look for/use it (and defaults to http://localhost:8080/manager)

Will try and post somewhere at mojo and see if they pick up - but feel free to add 'pressure' to the request :)

friska agustina said...

I am very pleased and read on your website. I hope you can also visit my website kata kata cinta , kata kata mutiara , operatorku greetings from Indonesia.

Sneha said...

This can get me out of my tomcat issues. Thanks.

mark email tomcat