Maven 无法在grails更新后解析类grails.plugin.cache.Cacheable

Maven 无法在grails更新后解析类grails.plugin.cache.Cacheable,maven,grails,grails-cache,Maven,Grails,Grails Cache,我正在将Grails从2.1.0升级到2.3.7。我有一个基于Maven的项目。对于2.1.0命令mvn clean install运行时不会出错。对于2.3.7,它给出了: Compilation error: startup failed: /home/freyja/fbc/fbc/search-web-app/grails-app/services/pl/psnc/dlteam/fbc2/services/CacheService.groovy: 4: unable to resolve

我正在将Grails从
2.1.0
升级到
2.3.7
。我有一个基于Maven的项目。对于
2.1.0
命令
mvn clean install
运行时不会出错。对于
2.3.7
,它给出了:

Compilation error: startup failed:
/home/freyja/fbc/fbc/search-web-app/grails-app/services/pl/psnc/dlteam/fbc2/services/CacheService.groovy: 4: unable to resolve class grails.plugin.cache.Cacheable
@ line 4, column 1.
import grails.plugin.cache.Cacheable
^

/home/freyja/fbc/fbc/search-web-app/grails-app/services/pl/psnc/dlteam/fbc2/services/CacheService.groovy: 3: unable to resolve class grails.plugin.cache.CachePut
@ line 3, column 1.
import grails.plugin.cache.CachePut
^
我尝试了最新版本的Grails
cache
plugin-
1.1.1
和一个可以与Grails
2.1.0
配合使用的版本,即
cache 1.0.0
。错误是一样的

我检查了这个文件
CacheService.groovy
的外观,它确实有这两个导入,并且似乎需要它们。我检查了
cache
pluginzip是否已下载到
.m2
文件夹

我在
pom.xml
中包含
cache
插件,如下所示:

<dependency>
    <groupId>org.grails.plugins</groupId>
    <artifactId>cache</artifactId>
    <version>1.1.1</version>
    <scope>compile</scope>
    <type>zip</type>
</dependency>
grails.servlet.version = "2.5" // Change depending on target container compliance (2.5 or 3.0)
grails.project.class.dir = "target/classes"
grails.project.test.class.dir = "target/test-classes"
grails.project.test.reports.dir = "target/test-reports"
grails.project.target.level = 1.6
grails.project.source.level = 1.6
grails.project.dependency.resolver = "maven" 
//grails.project.war.file = "target/${appName}-${appVersion}.war"

grails.project.dependency.resolution = {
    pom true
    // inherit Grails' default dependencies
    inherits("global") {
        // specify dependency exclusions here; for example, uncomment this to disable ehcache:
        // excludes 'ehcache'
    }
    log "error" // log level of Ivy resolver, either 'error', 'warn', 'info', 'debug' or 'verbose'
    checksums true // Whether to verify checksums on resolve

    def gebVersion = "0.7.2"

    repositories {
        inherits true // Whether to inherit repository definitions from plugins

        grailsPlugins()
        grailsHome()
        grailsCentral()

        mavenLocal()
        mavenCentral()

        // uncomment these (or add new ones) to enable remote dependency resolution from public Maven repositories
        //mavenRepo "http://snapshots.repository.codehaus.org"
        //mavenRepo "http://repository.codehaus.org"
        //mavenRepo "http://download.java.net/maven/2/"
        //mavenRepo "http://repository.jboss.com/maven2/"
    }
    dependencies {
        // specify dependencies here under either 'build', 'compile', 'runtime', 'test' or 'provided' scopes eg.

        // runtime 'mysql:mysql-connector-java:5.1.20'
        compile 'org.tuckey:urlrewritefilter:4.0.3'
        compile 'commons-httpclient:commons-httpclient:3.1'
        compile 'org.apache.httpcomponents:httpclient:4.2.5'
        compile 'org.apache.solr:solr-solrj:4.3.0'
        test 'co.freeside:betamax:1.1.2'
        test "org.codehaus.geb:geb-spock:$gebVersion"

    }

    plugins {
        runtime ":hibernate:3.6.10.12"
        runtime ":jquery:1.11.0.1"
        runtime ":resources:1.1.6"
        test ":spock:0.7"
        test ":geb:$gebVersion"

        // Uncomment these (or add new ones) to enable additional resources capabilities
        //runtime ":zipped-resources:1.0"
        //runtime ":cached-resources:1.0"
        //runtime ":yui-minify-resources:0.1.4"

        build ":tomcat:7.0.52.1"

        runtime ":database-migration:1.3.8"

        compile ':cache:1.1.1'
    }
}

grails.war.resources = {stagingDir ->
    delete(dir: "${stagingDir}/WEB-INF/classes/pl/psnc/dlteam/fbc2/utils/iso693_2")
}
但是它是否用于maven构建?如果是,为什么我必须在
pom.xml
中包含插件?。这种冗余让我很烦恼。

BuildConfig.groovy

放这条线

dependencies {
        compile "net.sf.ehcache:ehcache-core:2.4.6"

    }

BuildConfig
看起来怎么样?我更新了这个问题,谢谢。您可以从
BuildConfig
中删除所有插件和依赖项,因为它们将从
pom.xml
中引用。不要删除BuildConfig。特定的任务在war创建期间完成(grails.war.resources),这将是必需的。清空
插件{}
依赖项{}
后执行
mvn清理安装
。我假设所有这些依赖项都已经在pom文件中提到了。还要检查这里是否仍然需要
grails.project.dependency.resolver=“ivy”
,而不是以太。@dmahapatro我在
BuildConfig.groovy
中注释掉所有依赖项和插件时,检查了结果,错误是一样的。所有包都被放到
.m2
,并且
.grails
目录未被重新创建。这是我所期望的。我看到
.m2/repository/org/grails/plugin/cache/1.1.1/
中有
cache-1.1.zip
,我检查了它是否包含正确的接口文件。不幸的是,这没有帮助。我还尝试将此依赖项放在
pom.xml
中,因为我希望所有依赖项都放在那里,但错误是相同的。你还有别的想法吗?这件事我已经坚持了两个星期了。