Another workaround is to disable the maven manifest-only-jar.
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.18.1</version>
<configuration>
<useManifestOnlyJar>false</useManifestOnlyJar>
</configuration>
</plugin>
....
<plugin>
The default way to pass the classpath in maven tests seems to confuse the JSP compiler.
disablejsr199
that is used in the other answer will cause jetty to not use the compiler provided by Java but use a built-in version. This built-in compiler uses a different way to compute its classpath and seems to not have problems with the maven manifest-only-jar. The disadvantage is, that this built-in compiler needs to match your Java version. For instance using a Java 8 compiler in your project with an older version of jetty (that has only a Java 7 internal compiler) will lead to problems:
Jan 12, 2017 8:31:36 AM org.apache.jasper.compiler.JDTJavaCompiler$1 findType
SCHWERWIEGEND: Compilation error
org.eclipse.jdt.internal.compiler.classfmt.ClassFormatException
at org.eclipse.jdt.internal.compiler.classfmt.ClassFileReader.<init>(ClassFileReader.java:372)
at org.apache.jasper.compiler.JDTJavaCompiler$1.findType(JDTJavaCompiler.java:358)
at org.apache.jasper.compiler.JDTJavaCompiler$1.findType(JDTJavaCompiler.java:315)
at org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.askForType(LookupEnvironment.java:113)
at org.eclipse.jdt.internal.compiler.lookup.UnresolvedReferenceBinding.resolve(UnresolvedReferenceBinding.java:49)
at org.eclipse.jdt.internal.compiler.lookup.BinaryTypeBinding.resolveType(BinaryTypeBinding.java:122)
at org.eclipse.jdt.internal.compiler.lookup.PackageBinding.getTypeOrPackage(PackageBinding.java:168)
at org.eclipse.jdt.internal.compiler.lookup.Scope.getType(Scope.java:2469)
at org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.resolve(TypeDeclaration.java:1006)
at org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.resolve(TypeDeclaration.java:1258)
at org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration.resolve(CompilationUnitDeclaration.java:539)
at org.eclipse.jdt.internal.compiler.Compiler.process(Compiler.java:763)
at org.eclipse.jdt.internal.compiler.Compiler.compile(Compiler.java:468)
at org.apache.jasper.compiler.JDTJavaCompiler.compile(JDTJavaCompiler.java:494)
at org.apache.jasper.compiler.Compiler.generateClass(Compiler.java:384)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:453)
at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:625)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:374)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:492)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:378)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:848)
This can be avoided by this solution.