2012-12-23 75 views
2

我在IntelliJ Grails項目中使用外部JAR,GPars時遇到了很多麻煩。我認爲這是指定依賴關係的問題。我正在使用GPars-1.0.0。我將它保存在lib目錄中,並使用IntelliJ GUI--「項目結構」 - >「模塊」 - >「添加」作爲依賴項包含它。 I synchronized。我也試過adding directly to BuildConfig.groovy試圖在IntelliJ和grails中使用GPars

dependencies { 
    compile 'org.codehaus.gpars:gpars:1.0.0' 
} 

我在輸入和編譯時得到Code Assist。但是,當我運行以下命令:

import static groovyx.gpars.* 

... 

GParsPool.withPool { 
    [1, 2, 3, 4, 5].eachParallel { println it } 
} 

我得到ClassNotFoundException的消息jsr166y.ForkJoinPool爲 「GParsePool.withPool」

Line | Method 
->> 156 | findClass     in org.codehaus.groovy.tools.RootLoader 
| 306 | loadClass     in java.lang.ClassLoader 
| 128 | loadClass . . . . . . . . in org.codehaus.groovy.tools.RootLoader 
| 247 | loadClass     in java.lang.ClassLoader 
| 2427 | privateGetDeclaredMethods in java.lang.Class 
| 1791 | getDeclaredMethods  in  '' 
|  46 | getLocked . . . . . . . . in org.codehaus.groovy.util.LazyReference 
|  33 | get      in  '' 
|  80 | load . . . . . . . . . . in allison.zipcode.ZipcodeService$$ENsSBrUW 
|  30 | load      in allison.zipcode.CountryController 
| 195 | doFilter . . . . . . . . in grails.plugin.cache.web.filter.PageFragmentCachingFilter 
|  63 | doFilter     in grails.plugin.cache.web.filter.AbstractFilter 
| 886 | runTask . . . . . . . . . in java.util.concurrent.ThreadPoolExecutor$Worker 
| 908 | run      in  '' 
^ 680 | run . . . . . . . . . . . in java.lang.Thread 

任何想法的聲明?我是否在BuildConfig中正確指定了依賴關係?我的代碼示例可能是錯誤的,但它似乎遵循this example

回答

4

想通了:我沒有包括jsr166y.jar

compile "org.codehaus.jsr166-mirror:jsr166y:1.7.0"