r_qpqa
Last Updated: February 25, 2016
·
210
· ddossot

Embedded Jetty TLD resolution in Maven integration tests

By default, the maven-failsafe-plugin executes in the system classloader, which prevents Jetty to locate the TLDs referred to in web.xml.

<plugin>
    <artifactId>maven-failsafe-plugin</artifactId>
    <configuration>
        <systemPropertyVariables>
            <jetty.port>${allocated.jetty.port}</jetty.port>
        </systemPropertyVariables>
        <!-- This is needed so that the embedded Jetty's JSP parser can find the .tld
        files for the JSTL namespaces -->
        <useSystemClassLoader>false</useSystemClassLoader>
    </configuration>
    <executions>
        <execution>
            <id>failsafe</id>
            <goals>
                <goal>integration-test</goal>
                <goal>verify</goal>
            </goals>
        </execution>
    </executions>
</plugin>

Note that this applies when running embedded Jetty (a la fat-jar), not when bootstraping Jetty from its Maven plug-in.