Maven Tomcat Plugin - specify what is needed for war?

I am running mvn tomcat: deploy to try and deploy a war file that I want to run on a virtual host in Tomcat 7.0.8. I have verified that the virtual host is working fine and also copied it through the manager application to the virtual host.

By updating my pom to point to my new virtual host, when I run mvn tomcat: reploy it doesn't put my war file in the correct folder. It seems to fit in the webapps folder . If I then copy the war to the folder I configured for my virtual host, then it works, but it won't do it automatically.

Am I missing the Configure option? Is there a warDestination parameter 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 corresponding snippet from my settings. xml:

<servers>
    <server>
        <id>myvhost</id>
        <username>testing</username>
        <password>testing</password>
    </server>
</servers>

      

UPDATE: I solved this problem 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>

      

Then I tried running mvn tomcat7: deploy , but found that I had to add the following to my settings.xml for tomcat7 recognition prefix:

<pluginGroups>
    <pluginGroup>org.apache.tomcat.maven</pluginGroup>
</pluginGroups>

      

Now I can install it on my vhost by running mvn tomcat7: deploy . Unfortunately I don't see a way to redistribute the war that has already been deployed as I could with the previous plugin ... I'll keep looking.

UPDATE: It looks like the relocation feature is in version 2.0-SNAPSHOT of the tomcat7-maven-plugin , but not version 2.0-beta-1 which is in the repository. Hopefully this will be released soon.

Thank,

James.

+3


source to share


1 answer


You can define the path to the war file using config settings inside. Below is a sample snippt code



<plugin>
        <groupId>org.codehaus.mojo</groupId>
    <artifactId>tomcat-maven-plugin</artifactId>
    <configuration>
          <warFile>/path/file.war</warFile>
        </configuration>
</plugin>

      

+2


source







All Articles