We quickly realized as soon as we started working on the Servlet container integrations (e.g., Tomcat, Jetty) that the auxiliary archives were going to present a problem. Auxiliary archives can be added to a WAR application archive as a library (JAR) containing a META-INF/web-fragment.xml in containers that support Servlet 3.0 (which is not yet supported in a Jetty or Tomcat mainstream release) or added as a web archive (WAR) to an EAR for earlier containers.
However, to support pre-3.0 Servlet containers, either the packager needs to merge multiple WAR files or the auxiliary archive appender needs to be able to modify the application archive. I prefer the second approach, as I think it will provide more flexibility for auxiliary archives that are introducing some sort of integration (such as the test execution protocol).
public interface AuxiliaryArchiveAppender { /** * Create an archive containing the needed resources for this extension * to run in-container. This method can optionally modify the application * archive to add integration points (e.g., add a servlet definition to web.xml). * * @return Archive of any type */ Archive<?> createAuxiliaryArchive(Archive<?> applicationArchive); }