There is a java webapp with an embedded tomcat 7 that is built with this instructions (Using tomcat7-maven-plugin).
this webapp is launching with a jar file like this: java -jar webapp.jar
Question: How to run a main class after launching this embedded tomcat?
What you need is to setup your application's entry point. For this you need to configure your main class inside the jar's Manifest file.
Something like
Manifest-Version: 1.0.1
Created-By: <jdk_version>
Main-Class: fully.qalified.class.name.with.main.method
For more details on Manifest, take a look into this link here
For making this step part of your maven build cycle, you need to make some changes in the mave.jar.plugin. Something like
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.4</version>
<configuration>
<archive>
<manifest>
<mainClass>fully.qalified.class.name.with.main.method</mainClass>
</manifest>
</archive>
</configuration>
</plugin>
The final jar that is created will have your main method as the applications entry point