我在我的pom.xml中有以下依賴項,以便我的IDE(IntelliJ)在編譯期間具有可用的servlet-api類,但未在構建中提供。從測試範圍中排除servlet-api Maven
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>3.0-alpha-1</version>
<scope>provided</scope>
</dependency>
但在測試範圍內運行時所提供的範圍增加了班,這種依賴到classpath,這對碼頭,我開始編程的問題。因爲它已經在其圖書館中,我得到一個
java.lang.SecurityException: class "javax.servlet.FilterRegistration"'s signer information does not match signer information of other classes in the same package
如果我刪除此依賴Jetty服務器在測試範圍內可以正常啓動,但我需要這種依賴的IntelliJ編譯我的代碼。什麼是解決這個問題的最好方法,是否有一種方法可以排除測試範圍的這種依賴關係?
謝謝,解決了它! –
我迷路了 - 你能再詳細一點嗎?什麼「編譯範圍」是指? – xhudik
編譯範圍是指在java文件的編譯過程中只包含jar庫文件。 – Raman