• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Make script to install war files in Tomcat

 
Ranch Hand
Posts: 10198
3
Mac PPC Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Guys,

I would like to automate the following process:

(1) call mvn clean install on my project
(2) stop the Tomcat instance if already running
(3) after Tomcat is stopped, delete the war from its webapp directory
(4) copy the war file from the specific location of my project
(5) start Tomcat

I guess this is the task that is usually done by the scm guys. I would like to try this out by myself. Suggestions and ideas needed.
 
Ranch Hand
Posts: 470
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
http://mojo.codehaus.org/tomcat-maven-plugin/
 
Joe San
Ranch Hand
Posts: 10198
3
Mac PPC Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I guess I asked about a Make script in Linux and not a maven plugin. Please read my post properly.
 
Misha Ver
Ranch Hand
Posts: 470
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I assume your goal is deploying, redeploying, and undeploying Tomcat applications. The plugin is exactly what you needed. You could call all mvn command from Linux's shell script.
By the way you do not need start/stop Tomcat to deploy or undeploy an application.
 
Joe San
Ranch Hand
Posts: 10198
3
Mac PPC Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes, you are right. My goal is just that but I also would like to combine this with starting, stopping and restarting Tomcat. From my previous experiences, I've seen the configuration management guys doing a make script or a shell script to automate this... be it Maven or Ant.
 
Joe San
Ranch Hand
Posts: 10198
3
Mac PPC Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ok. So I have my configuration for Maven build to deploy to Tomcat as follows.



I also have the following user and password defined in tomcat-users.xml file.



But when I run mvn:tomcat deploy I get an exception as below:


Help appreciated.


 
Misha Ver
Ranch Hand
Posts: 470
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Can you get an access to http://localhost:1979/manager/html with the credentials you are using?
 
Joe San
Ranch Hand
Posts: 10198
3
Mac PPC Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
There was a small mistake form my side in issuing the user name and password. Got to get it working now.
 
Joe San
Ranch Hand
Posts: 10198
3
Mac PPC Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Just writing down the steps so that it could serve as a reference for anyone:

Step 1: Add the following to the build element of your master pom.xml of your project:



Step 2: Create the user in tomcat-users-xml for the user that we used in our pom.xml as in step 1 above



Step 3: Start Tomcat manually

Step 4: Call mvn package tomcat:deploy or mvn package tomcat:redeploy from your top most project pom.xml file
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic