我暫時的解決辦法是:
- 使用Grails/gradle這個插件來構建Grails的項目。
- 使用此插件來運行我的grails應用程序,即。 gradle grails-run-app。
- 掛鉤gradle中的grails-run-app任務(即時創建)來調用構建並將依賴項複製到lib目錄中的任務。
這不會幫助IntelliJ整個負載,但我會運行我的gradle任務作爲IntelliJ運行配置。
我的build.gradle如下(相關項目正在震動,放在LIB在這個例子中):
import org.grails.gradle.plugin.GrailsTask
evaluationDependsOn(':dependent-project')
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'
}
ext {
version = "1.0"
grailsVersion = "2.2.0.RC2"
grailsTaskPrefix = "grails-"
}
apply plugin: "grails"
dependencies {
['dependencies', 'resources', 'core', 'test', 'hibernate', 'plugin-datasource', 'plugin-domain-class', 'plugin-tomcat', 'plugin-services'].each { plugin ->
compile "org.grails:grails-$plugin:2.2.0.RC2"
}
bootstrap "org.codehaus.groovy:groovy-all:2.0.5"
}
// Get hold of the grails-run-app task (which is created on the fly) and add a dependency to the copyDependencies task
project.gradle.afterProject { p, ex ->
if (p == project) {
project.tasks.addRule("Grails dependencies") { String name ->
if (name.startsWith(grailsTaskPrefix)) {
tasks.getByName(name).dependsOn(copyDependencies)
}
}
}
}
// Build and copy any dependent jar files...
task copyDependencies(type: Sync) {
from project(':dependent-project').configurations.archives.allArtifacts.files
into "$projectDir/lib"
}
感謝您的建議......我已經貼現的本地本地安裝依賴的想法MAV因爲我認爲這是一個額外的步驟,如果罐子頻繁更換會很煩人。我是否認爲每次進行更改時,都必須增加存儲庫和grails項目中的版本以迫使其從存儲庫重新下載? –