2014-11-14 45 views
0

我有一個應用程序目前與Spring 3.2.3正確編譯。想要更現在(但還沒有準備好嘗試4.x)我試着升級到3.2.12。當我去,我得到一個奇怪的編譯錯誤從AspectJ的:春季3.2.12尋找Spring 4.0類?

[INFO] --- aspectj-maven-plugin:1.3:compile (default) @ ebs-schema-jaxb-bindings --- 
[ERROR] can't determine superclass of missing type org.springframework.cache.interceptor.CacheAspectSupport when batch building BuildConfig[null] #Files=3825 AopXmls=#0 
[Xlint:cantFindType] 
[ERROR] can't determine superclass of missing type org.springframework.aop.interceptor.AsyncExecutionAspectSupport when batch building BuildConfig[null] #Files=3825 AopXmls=#0 
[Xlint:cantFindType] 

我想我明白了邏輯here,但爲什麼春天3.2.12指春天4.x的接口?我怎麼才能找到導致麻煩的子類?即使在目前根本沒有任何切入點的項目中,也是如此。

+1

請張貼'依賴的輸出:tree'。最有可能的是,你得到了一個傳遞依賴。 – chrylis 2014-11-14 16:48:24

+0

看着我的依賴關係樹,我沒有看到任何Spring 4.x被拉入。唯一的變化是用3.2.12-RELEASE替換3.2.3-RELEASE爲春天庫存。 – Steve 2014-11-14 17:05:16

+1

我非常懷疑spring 3.2.12引用了Spring 4.0的接口。我懷疑這是由於錯誤的aspectj依賴和使用古老的'aspects-maven-plugin'(1.3是來自2010 1.7是最新版本)。還要確保所有的3.2罐子都來自3.2.12,而不是混合不同版本的3.2.x.最後確保你的類路徑中有'spring-context'和'spring-aop'這個特定的項目。 – 2014-11-14 20:49:13

回答

3

如果您使用maven嘗試使用dependency:tree來查找哪個lib導入Spring 4庫。

然後嘗試使用exlusions標記來排除Maven編譯時導入的這個工件。您可能會在圖書館發生衝突。

+0

的依賴性:樹是一個很好的建議找到問題,但這不是一個好的答案,因爲不給用戶解決問題的方法em ...請發表評論 – fmodos 2014-11-14 16:48:50

+1

我不能評論,但我會幫助... – rlm 2014-11-14 16:49:45

+0

如上所述,沒有Spring4庫被拉入。一切都是3.2.12-RELEASE。 – Steve 2014-11-14 17:59:10

0

我發現了一個簡單的解決方法:

<dependency> 
    <groupId>org.springframework</groupId> 
    <artifactId>spring-context-support</artifactId> 
    <version>${spring.version</version> 
</dependency> 
<dependency> 
    <groupId>javax.cache</groupId> 
    <artifactId>cache-api</artifactId> 
    <version>1.0.0</version> 
</dependency> 

欲瞭解更多信息閱讀本JCache dependency in spring-aspects