C4 Using Maven (Cont.)

           <pluginRepositories>

               <pluginRepository>

                   <id>Codehaus</id>

                   <url>http://repository.codehaus.org/</url>

                   <snapshots>

                       <enabled>false</enabled>

                   </snapshots>

                   <releases>

                       <enabled>true</enabled>

                   </releases>

               </pluginRepository>

           </pluginRepositories>

       </profile>

   </profiles>

   <activeProfiles>

       <activeProfile>default</activeProfile>

   </activeProfiles>

</settings>

Deploy your project automatically to Tomcat

If you feel really annoying to copy
your war file that generated by Maven, you can use the tomcat plugin with
tomcat:deploy goal.

I have been struggling for quite a
long time to run it as, I didn’t realise that I couldn’t use the default tomcat
admin account, but I have to specify it myself (not so sure why the default one
couldn’t work and kept getting the “cannot invoke tomcat manager” error). As
you see in the code above, I have specified the username and password in the
server tag. In pair, I also need to specify the plugin configuration in the pom
file to apply that sever setting.

       <plugins>

           <plugin>

               <groupId>org.codehaus.mojo</groupId>

               <artifactId>tomcat-maven-plugin</artifactId>

               <configuration>

                   <!–warDirectory>target</warDirectory>–>

                   <!–warFile>target/jsfapp.war</warFile–>

                   <server>tom</server>       

               </configuration>

           </plugin>

       </plugins>     

As you can see from the commented
tags, the configuration also provides you the opportunity to specify the war
file or directory that you want to deploy from.

http://mojo.codehaus.org/tomcat-maven-plugin/context-goals.html

Advertisements
This entry was posted in Maven. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s