2013-08-01 49 views
2

異常java.lang.NoSuchFieldError的:reportUnusedDeclaredThrownExceptionIncludeDocCommentReference

java.lang.NoSuchFieldError: reportUnusedDeclaredThrownExceptionIncludeDocCommentReference outside eclipse in command line using maven.

GWT庫的依賴關係的列表,並GWT 2.5.1正在使用的頂部聲明。 如何解決這個問題?請幫忙

+0

它看起來像你使用的Maven - 你什麼時候收到這個錯誤(請提供更多的上下文)? – Zeleres

+0

我在使用maven gwt插件編譯gwt代碼時出現這個錯誤。 –

回答

7

嗯,我想清楚是什麼問題。 在我的pom.xml中,我有這種依賴性

<dependency> 
<groupId>net.sf.jasperreports</groupId> 
<artifactId>jasperreports</artifactId> 
<version>4.7.0</version> 

這裏的問題是,碧玉報告對jdtcore依賴

 <dependency> 
     <artifactId>jdtcore</artifactId> 
     <groupId>eclipse</groupId> 
     <version>3.1.0</version> 
    </dependency> 

jdtcore實際上創建與衝突gwt編譯器。爲了解決這個問題,我需要在碧玉依賴添加排除這樣

 <dependency> 
     <groupId>net.sf.jasperreports</groupId> 
     <artifactId>jasperreports</artifactId> 
     <version>4.7.0</version> 
     <exclusions> 
      <exclusion> 
       <artifactId>jdtcore</artifactId> 
       <groupId>eclipse</groupId> 
      </exclusion> 
     </exclusions> 
    </dependency> 

現在,如果還需要在Web應用程序(通常以動態編譯碧玉報告)的jdtcore庫,我們可以添加使用範圍的依賴這樣

<dependency> 
     <artifactId>jdtcore</artifactId> 
     <groupId>eclipse</groupId> 
     <version>3.1.0</version> 
     <scope>runtime</scope> 
    </dependency> 

最後一個音符運行時,如果任何人得到這個問題,那麼應該看看,如果在pom.xml中的任何依賴已經上了車jdtcore的依賴,排除它,並把它作爲運行

希望這有助於

+0

對於排除的gradle傳遞依賴如下: 依賴性{ 編譯( 'net.sf.jasperreports:JasperReports的:3.7.4'){// 排除,因爲它引起的問題與GWT: // HTTP://計算器.com/questions/17991063/java-lang-nosuchfielderror-reportunuseddeclaredthrownexceptionincludedoccomment exclude group:'eclipse',module:'jdtcore' } } –

0

對於gradle這個排除傳遞依賴中的build.gradle如下:除後,我做了這個改變我的碧玉編譯​​失敗

dependencies { 
    compile('net.sf.jasperreports:jasperreports:3.7.4') { 
     //Exclude as it caused problems with GWT: 
     //http://stackoverflow.com/questions/17991063/java-lang-nosuchfielderror-reportunuseddeclaredthrownexceptionincludedoccomment 
     exclude group: 'eclipse', module: 'jdtcore' 
    } 
} 

。我不知道如何讓Jasper編譯和GWT編譯在同一個項目中共存?

相關問題