编译期间获取错误致命错误org.apache.tools.ant.BuildException:编译失败。在grails app中

时间:2013-11-14 11:15:40

标签: grails

当我通过终端或使用Grails / Groovy工具套件运行grails run-app时,它会出现“编译错误”

`Error Fatal error during compilation org.apache.tools.ant.BuildException: Compilation Failed (Use --stacktrace to see the full tr`ac`e)

我正在使用grails 2.0。下面是我通过ubuntu终端运行grails run-app时发生的事情。

    Loading Grails 2.0.0
    | Configuring classpath.
    | Environment set to development.....
    | Packaging Grails application
    > You currently already have a version of the plugin installed [hibernate-2.0.0]. Do you want to update to [hibernate-3.6.10.2]? [y,n] n
    | Plugin hibernate-3.6.10.2 install aborted
    > You currently already have a version of the plugin installed [tomcat-2.0.0]. Do you want to update to [tomcat-7.0.42]? [y,n] n
    | Plugin tomcat-7.0.42 install aborted
    > You currently already have a version of the plugin installed [release-2.2.1]. Do you want to update to [release-3.0.1]? [y,n] n
    | Plugin release-3.0.1 install aborted
    | Plugin release-3.0.1 install aborted..
    Compiling 4 source files.
| Error Fatal error during compilation org.apache.tools.ant.BuildException: Compilation Failed (Use --stacktrace to see the full trace

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}-${appVersion}.war"

grails.project.dependency.resolution = {
    // inherit Grails' default dependencies
    inherits("global") {
        // uncomment 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

    repositories {
        inherits true // Whether to inherit repository definitions from plugins
        grailsPlugins()
        grailsHome()
        grailsCentral()
        mavenCentral()

        // uncomment these to enable remote dependency resolution from public Maven repositories
        //mavenCentral()
        //mavenLocal()
        //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.16'
    }


    plugins {
        build ':release:2.2.1', ':rest-client-builder:1.0.3', {
      export = false
   }
        runtime ":hibernate:$grailsVersion"
        runtime ":jquery:1.7.1"
        runtime ":spring-security-core:1.2.7.2"
        runtime ':resources:1.2'
        runtime ":cached-resources:1.0"
        runtime ":zipped-resources:1.0"
        compile ":cache-headers:1.1.5"
        build ":tomcat:2.0.0"
        //compile ":attachmentable:0.3.0"
        compile ":searchable:0.6.4"
        compile ":cloud-bees:0.6.2"

        compile ":jquery-validation:latest.release"
        compile ":jquery-validation-ui:latest.release"
        compile ":twitter-bootstrap:2.3.2"
        compile ":lesscss-resources:1.3.3"
        runtime ":fields:1.3"
        compile ":mail:1.0.1"
        compile ":jquery-ui:1.8.24"
        compile ":spring-security-ui:0.2"
        compile ":mail:1.0"
        compile ":famfamfam:1.0"
        compile ":spring-security-acl:1.1.1"



    }
}

当我运行grails run-app时,它总是要求将tomcat和hibernate插件更新到最新版本。我不知道为什么会这样。对此有任何建议。

它可以与tomcat和hibernate插件相关吗?

application.properties

    #Grails Metadata file
    #Thu Nov 14 15:09:35 IST 2013
    app.grails.version=2.0.0
    app.name=VProcureFinal
    app.servlet.version=2.5
    app.version=0.1
    plugins.avatar=0.6.3
    plugins.burning-image=0.5.1
    plugins.class-diagram=0.5.2
    plugins.jquery-validation-ui=1.4.4
    plugins.prototype=1.0
    plugins.richui=0.8
plugins.webxml=1.4.1

* grails run-app out * put:

 grails run-app
| Packaging Grails application
> You currently already have a version of the plugin installed [tomcat-2.0.0]. Do you want to update to [tomcat-7.0.42]? [y,n] n
| Installed plugin release-3.0.1
| Error Plugin release-3.0.1 requires version [2.3 > *] of Grails which your current Grails installation does not meet. Please try install a different version of the plugin or Grails.
| Installed plugin release-3.0.1

1 个答案:

答案 0 :(得分:0)

一些建议。最可能的答案是applications.properties,指定与BuildConfig.groovy不同的东西。

  1. 您正在运行2.0.0。至少尝试2.0.4,因为会有bug修复?

  2. BuildConfig.groovy看起来不像权威来源。例如tomcat具体指定为2.0.0,因此您没有典型的升级问题,在2.3.x中这些插件从$ grailsVersion移出。

    检查application.properties。那里的grails版本将是2.0.0 - 可以从启动时看到这一点。这里可以将tomcat和hibernate版本指定为您在启动时看到的版本。

  3. grails clean和/或删除主目录中的.grails目录。