【发布时间】:2012-06-18 14:22:37
【问题描述】:
我的 pom.xml 中有以下依赖项,因此我的 IDE (IntelliJ) 在编译期间具有可用的 servlet-api 类,但在构建中未提供。
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>3.0-alpha-1</version>
<scope>provided</scope>
</dependency>
但是在测试范围内运行时,提供的范围会将此依赖项中的类添加到类路径中,这对于我以编程方式启动的 Jetty 来说是个问题。因为它已经在它的库中,所以我得到了一个
java.lang.SecurityException: class "javax.servlet.FilterRegistration"'s signer information does not match signer information of other classes in the same package
如果我删除此依赖项,Jetty 服务器会在测试范围内正确启动,但我需要此依赖项才能让 IntelliJ 编译我的代码。解决这个问题的最佳方法是什么,有没有办法可以排除测试范围的这种依赖关系?
【问题讨论】:
标签: maven-3