0

I am trying to start a Grails application that consists of multiple plug-ins each of which is stored as a separate Maven module. Dependencies are specified within BuildConfig.groovy files. While starting the app classes (both Java and Groovy) stored in other plugins are not loaded. I've checked the classpath and it seems it does not include classed generated by other plugins.

Dependencies within BuildConfig.groovy look like this:

    grails.project.class.dir = "target/classes"
    grails.project.test.class.dir = "target/test-classes"
    grails.project.test.reports.dir = "target/test-reports"

    grails.plugin.location.'plugin-one' = "${basedir}/../plugin-one"
    grails.plugin.location.'plugin-two' = "${basedir}/../plugin-two"

    grails.project.dependency.resolution = {
        inherits("global") {
            excludes 'commons-logging', 'commons-collections'
        }
        log "warn"
        repositories {
            inherit false
            mavenRepo "http://my.maven.repo"
        }
        plugins {
            runtime ':tomcat:1.3.7'
            runtime ':hibernate:1.3.7'
            ...
        }
        dependencies {
            compile "org.apache.httpcomponents:httpclient:4.2.1"
            compile "org.apache.httpcomponents:httpmime:4.2.1"
            compile "commons-collections:commons-collections:3.2.1"

            build "org.apache.httpcomponents:httpclient:4.2.1"
            build "org.apache.httpcomponents:httpmime:4.2.1"
            build "commons-collections:commons-collections:3.2.1"
            ...
        }
    }

    gwt.version = "2.3.0"

The structure of Maven modules is as follows:

    /pom.xml
    /my-app/pom.xml
    /plugin-one/pom.xml
    /plugin-two/pom.xml
    ...

4

1 回答 1

1

grails 应用程序不会将其类路径扩展到插件目录。相反,所有编译的类都被复制到target/plugin-classes应用程序基目录包含的目录中。

上一篇文章中描述的问题是由于缺少 Grails 插件的描述符而导致Grails 不想将插件资源复制到应用程序类路径中。特别是文件。不幸的是,Grails 文档对此保持沉默。但是,您可以通过在插件的基本目录中调用命令来为所有插件生成文件。如果您不希望 Grails 静默失败,请记住在对插件配置进行重大更改后重新生成插件描述符。plugin.xmlplugin.xmlgrails package-plugin

于 2013-09-20T07:23:29.240 回答