将私有grails插件插入另一个私有grails插件

时间:2014-04-14 21:24:24

标签: grails grails-plugin

我尝试使用以下行插入核心插件:

grails.plugin.location.pluginCore = "../plugin/";

但抛出异常。

但是当我在正常项目中使用它时,没有抛出异常!

Compile error during compilation with javac.
/home/asapcode/Documents/svn/erede/plugin/src/java/br/com/qreserva/portal/pagamento/payPal/PagamentoPayPal.java:20: error: package org.hibernate.validator.util.privilegedactions does not exist
import org.hibernate.validator.util.privilegedactions.GetDeclaredField;

有什么想法吗?

感谢您的回复!

1 个答案:

答案 0 :(得分:0)

我解决了这个问题!但我不明白为什么它是必要的。

这是插件A中的application.properties:

app.grails.version=2.2.3
app.name=PluginA
plugins.acegi=0.5.3.2
plugins.hibernate=2.2.3
plugins.i18n-templates=1.1.0.1
plugins.svn=1.0.1

PluginA的BuildConfig:

grails.project.class.dir = "target/classes"
grails.project.test.class.dir = "target/test-classes"
grails.project.test.reports.dir = "target/test-reports"
grails.project.target.level = 1.6
//grails.project.war.file = "target/${appName}-${appVersion}.war"

grails.project.dependency.resolution = {
    // inherit Grails' default dependencies
    inherits("global") {
        // uncomment to disable ehcache
        // excludes 'ehcache'
    }
    log "warn" // log level of Ivy resolver, either 'error', 'warn', 'info', 'debug' or 'verbose'
    repositories {
        grailsCentral()
        // uncomment the below to enable remote dependency resolution
        // from public Maven repositories
        //mavenCentral()
        //mavenLocal()
        mavenRepo "http://snapshots.repository.codehaus.org"
        mavenRepo "http://repository.codehaus.org"
        //mavenRepo "http://download.java.net/maven/2/"
        //mavenRepo "http://repository.jboss.com/maven2/"
    }
    dependencies {
        // specify dependencies here under either 'build', 'compile', 'runtime', 'test' or 'provided' scopes eg.

        // runtime 'mysql:mysql-connector-java:5.1.5'
        compile('org.codehaus.groovy.modules.http-builder:http-builder:0.5.2') {
            excludes "commons-logging", "xml-apis", "groovy"
        }
    }

    plugins {
        build(":tomcat:$grailsVersion",
              ":release:1.0.0") {
            export = false
        }
    }
}

这是插件B的(旧)application.properties:

app.grails.version=2.2.3
app.name=PluginB

插件B的BuildConfig(旧版):

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

grails.project.dependency.resolution = {
    // inherit Grails' default dependencies
    inherits("global") {
        // uncomment to disable ehcache
        // excludes 'ehcache'
    }
    log "warn" // log level of Ivy resolver, either 'error', 'warn', 'info', 'debug' or 'verbose'
    legacyResolve false // whether to do a secondary resolve on plugin installation, not advised and here for backwards compatibility
    repositories {
        grailsCentral()
        mavenCentral()
        // uncomment the below to enable remote dependency resolution
        // from public Maven repositories
        //mavenLocal()
        //mavenRepo "http://snapshots.repository.codehaus.org"
        //mavenRepo "http://repository.codehaus.org"
        //mavenRepo "http://download.java.net/maven/2/"
        //mavenRepo "http://repository.jboss.com/maven2/"
    }
    dependencies {
        // specify dependencies here under either 'build', 'compile', 'runtime', 'test' or 'provided' scopes eg.

        // runtime 'mysql:mysql-connector-java:5.1.21'
    }

    plugins {
        build(":tomcat:$grailsVersion",
              ":release:2.2.1",
              ":rest-client-builder:1.0.3") {
            export = false
        }
    }
}

当我在PluginB(BuildConfig)上插入PluginA的依赖项和application.properties中列出的插件时,它可以正常工作。

当我插入行

时,我不明白插件B的原因
grails.plugin.location.pluginCore = "../plugin/";

在插件B的BuildConfig中,插件不会自动解析此依赖项。

但是,谢谢你的答案!