4

Currently my project setup is such that when I do a clean and install on my maven project, it downloads tomcat version mentioned in the pom.xml and deploys the war files onto it.

I need to change the configuration such that the war files are deployed on to tomcat which I have manually downloaded and not the one maven downloads. This is to make use of the settings I have configured for the manually downloaded tomcat.

Is it possible? If yes, how?

Chillax
  • 4,418
  • 21
  • 56
  • 91

2 Answers2

2

You can try the tomcat-maven-plugin which lets you deploy by context.xml, exploded war or simply war file into existing tomcat instances.

Nickmancol
  • 1,034
  • 7
  • 16
1

I know you'd probably want a Maven-only answer to this - I did too. However, I found that the easiest but most flexible thing to do was to build the war with Maven, and deploy it with ANT. The tomcat-maven-plugin wasn't powerful enough for me because I needed to deploy the .war to a local Tomcat install AND to a remote machine using scp.

Here's what my ANT build.xml file looks like:

<?xml version="1.0"?>

<target name="deploy_local">
    <echo>Deploying .war to local Tomcat</echo>
    <copy file="target/My.war" todir="/tomcat/webapps">
    </copy>
</target>

<target name="deploy_production">
    <echo>Deploying .war to production Tomcat</echo>
    <move file="target/My.war" tofile="target/ROOT.war"/>
    <scp file="target/ROOT.war"
        trust="true"
        todir="me:password@154.14.232.122:/tomcat/webapps"
        port="22">
    </scp>
</target>

You can see I even rename the .war file from My.war to ROOT.war for the production deploy.

The complete procedure is then: mvn clean package followed by running the local or production ANT target for deployment.

herrtim
  • 2,697
  • 1
  • 26
  • 36