gpt4 book ai didi

maven - Grails插件依赖项在应用程序中不可用

转载 作者:行者123 更新时间:2023-12-02 14:42:37 24 4
gpt4 key购买 nike

使用Grails 2.3.8在eclipse GGTS中创建了一个插件;标准插件,除了以下依赖项(rabbitmq)之外,没有任何更改:

//BuildConfig (plugin)
plugins {
compile(":rabbitmq:1.0.0")
build(":release:3.0.1",
":rest-client-builder:1.0.3")
}

刷新,编译和打包了插件依赖项,然后将它们作为 'myplugin:mq:0.1'存储在本地Maven存储库中并进行了验证。

创建Grails项目,将插件添加到项目:
//BuildConfig (project)
plugins {
build ":tomcat:7.0.52.1"
compile "myplugin:mq:0.5" //<-plugin here

compile ":scaffolding:2.0.3"
compile ':cache:1.1.2'

runtime ":database-migration:1.4.0"
runtime ":jquery:1.11.0.2"
}

依赖关系成功刷新。

问题

我无法从 myplugin:mq引用Rabbitmq插件中的Rabbitmq库或依赖项

不知道为什么应用程序不继承依赖项,我没有使用 exported = false或任何抑制插件依赖项的东西。

试过了

我没有使用eclipse,而是切换到命令行(JDK 1.7 + 2.3.8,也尝试过2.3.7),手动清理,刷新,编译,但仍然无法解析Rabbitmq类:
| Error Compilation error: startup failed:
C:\X-projects\ws-ggts_36\rest-api-doc-test\grails-app\controllers\org\raffian\restapi\controller\FundController.
@ line 8, column 1.
import org.springframework.amqp.rabbit.core.RabbitAdmin
^

Maven本地部署

我更改了组和 Artifact ID:
mvn install:install-file  
-Dfile=grails-test-plugin-0.5.zip
-DgroupId=myplugin
-DartifactId=mq
-Dversion=0.5
-Dpackaging=zip
-DgeneratePom=true

插件包怪异

在仔细检查打包的插件之后,ZIP仅包含这些文件。我怀疑这是问题所在,因为缺少rabbitmq库,并且plugin.xml或插件描述符不包含对rabbitmq依赖关系的引用,因此应用程序甚至都不知道这些依赖关系。但是,为什么插件不包括它自己的依赖关系?

插件描述符
class TestPluginGrailsPlugin {
// the plugin version
def version = "0.5"
// the version or versions of Grails the plugin is designed for
def grailsVersion = "2.3 > *"
// resources that are excluded from plugin packaging
def pluginExcludes = [
"grails-app/views/error.gsp"
]

def title = "Test Plugin Plugin" // Headline display name of the plugin
def author = "Your name"
def authorEmail = ""
def description = 'desc'
def documentation = "http://grails.org/plugin/test-plugin"
def doWithWebDescriptor = { xml ->}
def doWithSpring = {}
def doWithDynamicMethods = { ctx -> }
def doWithApplicationContext = { ctx -> }
def onChange = { event -> }
def onConfigChange = { event -> }
def onShutdown = { event -> }
}

最佳答案

要将Grails插件发布到本地Maven存储库,请使用以下命令:

grails maven-install

来自 release插件,默认情况下,该插件可用于所有新创建的Grails插件。

最后, here is how可以根据需要修改插件的 groupId

关于maven - Grails插件依赖项在应用程序中不可用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26666020/

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