gpt4 book ai didi

grails - Grails&Gradle:插件管理

转载 作者:行者123 更新时间:2023-12-02 14:20:04 27 4
gpt4 key购买 nike

首先,对不起我的英语不好,我是法语,希望我的问题会清楚。

我正在用gradle构建一个grails项目,并想使用rest插件。

这是我的build.gradle conf文件:

import org.grails.gradle.plugin.GrailsTask
version = '1.0'
grailsVersion = '2.2.1'
apply plugin: 'java'
apply plugin: 'maven'
apply plugin: 'grails'



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'
mavenRepo name: 'nexus', url: 'http://nexusurl.fr'
mavenRepo url: 'http://repo.grails.org/grails/plugins'

}

uploadArchives {
repositories {
mavenDeployer {
repository(url: 'http://url') {
authentication(userName: 'log', password: 'pass')
}
pom.version = '0.0.0'
pom.artifactId = 'yo'
pom.groupId = 'com.something'
pom.packaging = 'war'
}
}
}



dependencies {
['dependencies', 'resources', 'core', 'plugin-domain-class', 'plugin-tomcat', 'plugin-services'].each { plugin ->
compile "org.grails:grails-$plugin:2.2.1"
}
compile 'repo.grails.org:grails-plugins-rest:0.7'
compile 'org.codehaus.jackson:jackson-mapper-asl:1.9.9'
compile 'org.codehaus.jackson:jackson-core-asl:1.9.9'
compile 'com.googlecode.json-simple:json-simple:1.1'
bootstrap 'org.codehaus.groovy:groovy-all:1.8.6'
}

GRAILS_TASK_PREFIX = 'grails-'
if (name.startsWith(GRAILS_TASK_PREFIX)) {
project.task(name, type: GrailsTask) {
command "${name - GRAILS_TASK_PREFIX}"
}
}

这是其余的插件: http://grails.org/plugin/rest

以前,获取此插件非常简单:
grails install-plugin rest

将以下行添加到application.properties文件中:
plugins.rest=0.7

我只是不知道如何将该插件添加到我的buildFile中。

我的grails应用程序可以运行,但是在运行时出现错误:
Error |
2013-06-11 14:20:41,916 [http-bio-8080-exec-8] ERROR errors.GrailsExceptionResolver - MissingMethodException occurred when processing request: [POST] /dwgui/signIn/login - parameters:
username: demo-user
password: ***
No signature of method: com.ftprod.dwgui.security.AuthenticationService.withHttp() is applicable for argument types: (java.util.LinkedHashMap, com.ftprod.dwgui.security.AuthenticationService$_testSign
In_closure1) values: [[uri:http://data.iraiser.eu], com.ftprod.dwgui.security.AuthenticationService$_testSignIn_closure1@2786aa0f]. Stacktrace follows:
Message: No signature of method: com.ftprod.dwgui.security.AuthenticationService.withHttp() is applicable for argument types: (java.util.LinkedHashMap, com.ftprod.dwgui.security.AuthenticationService$
_testSignIn_closure1) values: [[uri:http://data.iraiser.eu], com.ftprod.dwgui.security.AuthenticationService$_testSignIn_closure1@2786aa0f]
Line | Method
->> 28 | testSignIn in com.ftprod.dwgui.security.AuthenticationService
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 14 | login in com.ftprod.dwgui.security.SignInController
| 1145 | runWorker in java.util.concurrent.ThreadPoolExecutor
| 615 | run in java.util.concurrent.ThreadPoolExecutor$Worker
^ 722 | run . . . in java.lang.Thread

将此行添加到我的build.gradle的依赖项范围中,在gradle build期间给我一个错误:
compile 'repo.grails.org:grails-plugins-rest:0.7'

错误:
* What went wrong:
Execution failed for task ':grails-run-app'.
> Could not find repo.grails.org:grails-plugins-rest:0.7.
Required by:
:dwgui:1.0

我很清楚最后一个错误。

所以这是我的问题:如何在gradle中添加grails us的rest插件?

最佳答案

最新Grails使用BuildConfig.groovy进行依赖,而不是application.propertiesbuild.gradle仅适用于Gradle,我认为它不能帮助您使用Grails依赖项。

因此,您必须编辑conf/BuildConfig.groovy,并放入plugins部分中:

plugins {
...
compile ":rest:0.7"
}

有关插件的依赖性,请参阅文档: http://grails.org/doc/latest/guide/conf.html#pluginDependencies

关于grails - Grails&Gradle:插件管理,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17044035/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com