Reputation: 273
I'm running mvn tomcat:deploy in order to try and deploy a war file that I want to run on a virtual host in Tomcat 7.0.8. I've verified that the virual host is working ok, and have also copied across the manager application to the virtual host.
Having updated my pom to point at my new virtual host, when I run mvn tomcat:reploy it doesn't put my war file in to the correct folder. It always seems to put it in the webapps folder. If I then copy the war across to the folder that I setup for my virtual host then it works, but it won't do this automatically.
Am I missing a confiuration option? Is there a warDestination setting or something similar?
For reference, here's a snippet from my pom.xml:
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>tomcat-maven-plugin</artifactId>
<configuration>
<url>http://myvhost.local:8080/manager/html</url>
<server>myvhost</server>
<path>/</path>
</configuration>
</plugin>
</plugins>
</build>
and the relevant snippet from my settings.xml:
<servers>
<server>
<id>myvhost</id>
<username>testing</username>
<password>testing</password>
</server>
</servers>
UPDATE: I resolved this issue by changing the plugin I was using to the following:
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.0-beta-1</version>
<configuration>
<url>http://myvhost.local:8080/manager/html</url>
<server>myvhost</server>
<path>/</path>
</configuration>
</plugin>
I then tried running mvn tomcat7:deploy but found I had to add the following to my settings.xml in order for the tomcat7 prefix to be recognised:
<pluginGroups>
<pluginGroup>org.apache.tomcat.maven</pluginGroup>
</pluginGroups>
I can now deploy to my vhost by running mvn tomcat7:deploy - unfortunately I can't see a way of redeploying a war that's already been deployed as I could with the previous plugin....I'll keep searching though.
UPDATE: It looks like the ability to redeploy is in the 2.0-SNAPSHOT version of the tomcat7-maven-plugin plugin but not the 2.0-beta-1 version that's in the repository. Hopefully that'll be released soon.
Thanks,
James.
Upvotes: 3
Views: 1267
Reputation: 71
You can define the war file path by using inside the configuration setting. Please find below the sample code snippt
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>tomcat-maven-plugin</artifactId>
<configuration>
<warFile>/path/file.war</warFile>
</configuration>
</plugin>
Upvotes: 2