Snippets

MICO FP7 Project WAR remote deployment + debugging

You are viewing an old version of this snippet. View the current version.
Revised by Thomas Köllmer f0a6139

Enable Remote Deployment and Debugging

Prepare Platform

Don't do this on a public environment without modifying the credentials! (better: don't do it at all)

Install manager-tools:

apt-get install tomcat7-admin

Create User for remote deployment

Edit /etc/tomcat7/tomcat-users.xml

Insert:

 <role rolename="admin-gui" />
 <role rolename="admin-script" />
 <role rolename="manager-gui" />
 <role rolename="manager-script" />
 <user username="tom" password="cat" roles="manager-gui,admin-gui,manager-script,admin-script" />

Enable JPDA remote Debugging

Edit /etc/default/tomcat7

Uncomment:

JAVA_OPTS="${JAVA_OPTS} -Xdebug -Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=n"

Remote debugging will be available at port 8000. Don't to forget to set the port forwarding inside VirtualBox accordingly!

Prepare Maven Tomcat 7 deployment

Add deployment credential to Maven settings

To avoid storing the credentials inside the version-controlled pom.xml, define a server in the ´.m2/settings.xml`:

<server>
  <id>mico-deployment</id>
  <username>tom</username>
  <password>cat</password>
</server>

Modify pom.xml

Add something like

<plugin>
    <groupId>org.apache.tomcat.maven</groupId>
    <artifactId>tomcat7-maven-plugin</artifactId>
    <configuration>
        <url>http://mico-platform:8080/manager/text</url>
        <server>mico-deployment</server>
        <update>true</update>
    </configuration>
</plugin>

See https://tomcat.apache.org/maven-plugin-trunk/tomcat7-maven-plugin/deploy-mojo.html for the available fields.

Debug

IntelliJ

  • add a new Remote configuration.
  • Host: mico-platform
  • Port: 8000
HTTPS SSH

You can clone a snippet to your computer for local editing. Learn more.