| Author |
Make script to install war files in Tomcat
|
Joe Harry
Ranch Hand
Joined: Sep 26, 2006
Posts: 8795
|
|
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.
|
SCJP 1.4, SCWCD 1.4 - Hints for you, SCBCD Hints - Demnachst, SCDJWS - Auch Demnachst
Did a rm -R / to find out that I lost my entire Linux installation!
|
 |
Misha Ver
Ranch Hand
Joined: Mar 03, 2008
Posts: 470
|
|
|
http://mojo.codehaus.org/tomcat-maven-plugin/
|
 |
Joe Harry
Ranch Hand
Joined: Sep 26, 2006
Posts: 8795
|
|
|
I guess I asked about a Make script in Linux and not a maven plugin. Please read my post properly.
|
 |
Misha Ver
Ranch Hand
Joined: Mar 03, 2008
Posts: 470
|
|
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 Harry
Ranch Hand
Joined: Sep 26, 2006
Posts: 8795
|
|
|
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 Harry
Ranch Hand
Joined: Sep 26, 2006
Posts: 8795
|
|
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
Joined: Mar 03, 2008
Posts: 470
|
|
|
Can you get an access to http://localhost:1979/manager/html with the credentials you are using?
|
 |
Joe Harry
Ranch Hand
Joined: Sep 26, 2006
Posts: 8795
|
|
|
There was a small mistake form my side in issuing the user name and password. Got to get it working now.
|
 |
Joe Harry
Ranch Hand
Joined: Sep 26, 2006
Posts: 8795
|
|
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
|
 |
 |
|
|
subject: Make script to install war files in Tomcat
|
|
|