开发者

I have servlet-api 2.5 provided, but want to use it during integration tests. Is this possible?

开发者 https://www.devze.com 2023-01-25 13:13 出处:网络
I am using the Jersey Test Framework, that includes servlet-api 2.5 in the test s开发者_开发百科cope.Unfortunately, I have also written my own custom filter that requires me to have access to servlet-

I am using the Jersey Test Framework, that includes servlet-api 2.5 in the test s开发者_开发百科cope. Unfortunately, I have also written my own custom filter that requires me to have access to servlet-api at compile time. I don't want to elevate the scope to "compile" though, because I still don't want it in the war file. Is there any hope?


It is supposed to just work. To quote the reference:

This is much like compile, but indicates you expect the JDK or a container to provide the dependency at runtime. For example, when building a web application for the Java Enterprise Edition, you would set the dependency on the Servlet API and related Java EE APIs to scope provided because the web container provides those classes. This scope is only available on the compilation and test classpath, and is not transitive.

Maven downloads the thing, adds it to test and compile classpaths, but does not include it in packaging.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号