3

我是 Grails/Gradle 的新手。我正在尝试编写一个简单的 build.gradle 来构建我的示例项目。我有一个任务“构建”,它在内部应该按照给定的顺序执行以下操作。

  1. 干净的
  2. 编译
  3. 运行测试
  4. 创建一个战争文件

我正在使用这里提到的 gradle/grails 插件和 build.gradle,Gradle/Grails 插件。该插件默认提供清理、测试和组装任务。使用这个插件是我的 build.gradle 的样子,

import org.grails.gradle.plugin.GrailsTask

buildscript {
        repositories {
            mavenCentral()
            mavenRepo name: "grails", url: 'http://repo.grails.org/grails/repo' 
        }
        dependencies {
            classpath "org.grails:grails-gradle-plugin:1.1.1-SNAPSHOT"
        }
}
repositories {
    mavenCentral()
    mavenRepo name: "grails", url: 'http://repo.grails.org/grails/repo' 
}
version = "1.0"
grailsVersion = "2.1.0"
apply plugin: "grails"
dependencies {
    ['dependencies', 'resources', 'core', 'hibernate', 'plugin-datasource', 'plugin-domain-class', 'plugin-tomcat', 'plugin-services'].each { plugin ->
        compile "org.grails:grails-$plugin:2.1.0"
    }
    bootstrap "org.codehaus.groovy:groovy-all:1.8.7"
}

task build (dependsOn: [clean,test,assemble]) {     
println "building the project..." }

从命令提示符执行“gradle build”时,我遇到了以下异常。

12:03:28.631 [ERROR] [org.gradle.BuildExceptionReporter] Caused by: java.lang.Un
satisfiedLinkError: Native Library C:\Users\smore\AppData\Local\Temp\jline_.dll
already loaded in another classloader
12:03:28.635 [ERROR] [org.gradle.BuildExceptionReporter]        at jline.Windows
Terminal.loadLibrary(WindowsTerminal.java:322)
12:03:28.638 [ERROR] [org.gradle.BuildExceptionReporter]        at jline.Windows
Terminal.initializeTerminal(WindowsTerminal.java:240)
12:03:28.642 [ERROR] [org.gradle.BuildExceptionReporter]        at jline.Termina
l.setupTerminal(Terminal.java:75)
12:03:28.646 [ERROR] [org.gradle.BuildExceptionReporter]        at jline.Termina
l.getTerminal(Terminal.java:26)
12:03:28.649 [ERROR] [org.gradle.BuildExceptionReporter]        at jline.Console
Reader.<init>(ConsoleReader.java:174)
12:03:28.653 [ERROR] [org.gradle.BuildExceptionReporter]        at jline.Console
Reader.<init>(ConsoleReader.java:169)
12:03:28.657 [ERROR] [org.gradle.BuildExceptionReporter]        at grails.build.
logging.GrailsConsole.createConsoleReader(GrailsConsole.java:167)
12:03:28.660 [ERROR] [org.gradle.BuildExceptionReporter]        at grails.build.
logging.GrailsConsole.<init>(GrailsConsole.java:133)
12:03:28.664 [ERROR] [org.gradle.BuildExceptionReporter]        at grails.build.
logging.GrailsConsole.createInstance(GrailsConsole.java:267)
12:03:28.668 [ERROR] [org.gradle.BuildExceptionReporter]        at grails.build.
logging.GrailsConsole.getInstance(GrailsConsole.java:244)
12:03:28.672 [ERROR] [org.gradle.BuildExceptionReporter]        ... 71 more
12:03:28.675 [ERROR] [org.gradle.BuildExceptionReporter]
12:03:28.679 [LIFECYCLE] [org.gradle.BuildResultLogger]
12:03:28.683 [LIFECYCLE] [org.gradle.BuildResultLogger] BUILD FAILED

这是正确的方法吗,任何帮助将不胜感激。

谢谢,交换。

4

0 回答 0