Can't find JSTL tag library when running test under Maven Surefire

前端 未结 1 465
梦毁少年i
梦毁少年i 2021-01-14 11:16

I have a Servlet-based application (OAuth implementation) which delegates some of the response rendering to JSP, as in the following example:

private void do         


        
1条回答
  •  一生所求
    2021-01-14 11:47

    It turns out that by default Maven's Surefire plugin employs a trick wherein it creates a Manifest-Only JAR file, in order to avoid the need to pass the full classpath to the forked JRE (see this article). The Jetty JSP processor simply asks each classloader for its list of URLs, and so only sees the one manifest-only JAR file, rather than all the JAR files that are actually being used, and hence doesn't find the TLD files.

    The simple solution, which is also documented on that page, is to turn off the useManifestOnlyJar option, as follows:

    
      
        org.apache.maven.plugins
        maven-surefire-plugin
        2.18.1
        
          false
        
      
      ....
    
    

    This instructs Surefire to directly pass the full classpath to the forked JRE process, thereby allowing it to locate the TLDs.

    0 讨论(0)
提交回复
热议问题