omcat7 deployment can be automated from Maven using tomcat7-maven-plugin,
http://tomcat.apache.org/maven-plugin-2.0-SNAPSHOT/tomcat7-maven-plugin/plugin-info.html. To enable Tomcat deployment, do the following,
Configure Tomcat7
Edit conf/tomcat-users.xml, and append the following,
<
role
rolename
=
"manager"
/>
<
role
rolename
=
"manager-gui"
/>
<
role
rolename
=
"admin"
/>
<
user
username
=
"admin"
password
=
"admin"
roles
=
"admin,manager,manager-gui"
/>
|
Add plugin to pom.xml
<
pluginRepositories
>
....
<
pluginRepository
>
<
id
>apache.snapshots</
id
>
<
name
>Apache Snapshots</
name
>
<
releases
>
<
enabled
>false</
enabled
>
</
releases
>
<
snapshots
>
<
enabled
>true</
enabled
>
</
snapshots
>
</
pluginRepository
>
....
</
pluginRepositories
>
<
build
>
<
plugins
>
....
<
plugin
>
<
groupId
>org.apache.tomcat.maven</
groupId
>
<
artifactId
>tomcat7-maven-plugin</
artifactId
>
<
version
>2.0-SNAPSHOT</
version
>
<
configuration
>
<
username
>admin</
username
>
<
password
>admin</
password
>
<
update
>true</
update
>
</
configuration
>
</
plugin
>
....
</
plugins
>
</
build
>
|
Invoke tomcat7:deploy
Add a Run As profile for your Maven build with the following,
clean
package
tomcat7:deploy
|