将Grails项目从旧版本转移到最新版本的Intellij Idea IDE

时间:2016-05-10 08:48:44

标签: grails intellij-idea

我已经在装有Idea 13的机器上开发了我的Grails项目。 现在我已经搬进了另一台机器,我已经安装了最新版本的IDE。

我已经安装了Grails(版本2.2.1)和Groovy(版本2.4.6),它们按照安装说明中的描述给出了路径变量。我已经从现有的源代码创建了一个新项目,但是当我尝试运行它时,它给了我关于插件的错误。

缺少插件,我无法在项目中安装,因为菜单中的选项卡工具 - > Grails - >插件(或右键单击项目的根目录 - > Grails - >插件)不存在。我尝试过创建一个全新的Grails项目并且标签存在,所以这可能取决于我导入项目的方式。

这是BuildConfig.groovy内容:

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.war.file = "target/${appName}.war"

grails.project.dependency.resolution = {

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

    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'

    }

    plugins {
        runtime ":hibernate:$grailsVersion"
        runtime ":jquery:1.8.0"
        runtime ":resources:1.1.6"

        // 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:$grailsVersion"

        runtime ":database-migration:1.1"

        compile ':cache:1.0.0'

        compile ":ckeditor:4.4.1.0"


    }
}

这是Grails控制台中的错误:

Error |
Failed to resolve dependencies (Set log level to 'warn' in BuildConfig.groovy for more information):

- org.grails.plugins:cache:1.0.0
- org.grails.plugins:ckeditor:4.4.1.0

如何导入它而不会在构建代码时收到错误?

编辑: 我创建了一个全新的项目。它安装默认插件但不允许通过Tools-> Grails->插件

添加新插件

错误是(即log4j插件安装):

|Resolving plugin log4j-xml. Please wait...
|Error resolving plugin [name:log4j-xml, group:org.grails.plugins, version:0.2]. Plugin not found.
Error |
Plugin not found for name [log4j-xml] and version [0.2]

1 个答案:

答案 0 :(得分:0)

我自己解决了这个问题。

解决方案与此处相同:Error Failed to resolve dependencies grails