简体   繁体   English

狮riff依赖

[英]Griffon Dependency

i'm trying to use org.apache.commons.lang.RandomStringUtils in a Griffon application (Griffon 1.5) .. I included it in the BuildConfig shown below .. 我试图在Griffon应用程序(Griffon 1.5)中使用org.apache.commons.lang.RandomStringUtils ..我将其包含在BuildConfig中,如下所示。

dependencies {
    // specify dependencies here under either 'build', 'compile', 'runtime' or 'test' scopes eg.

    // runtime 'mysql:mysql-connector-java:5.1.5'
       build 'org.apache.commons:commons-lang3:3.0'

}

It gets downloaded correctly from maven central I get a class not found exception when I run my application .. What am I doing wrong ?? 它是从Maven Central正确下载的,运行应用程序时出现类未找到的异常。 (I tried changing it to runtime / compile .. that didn't work either .. and I inserted the jar manually in the library folder .. no joy ) (我尝试将其更改为运行时/编译..也不起作用..,然后将jar手动插入到库文件夹中..不高兴)

Thanks 谢谢

This is expected behavior. 这是预期的行为。 If you don't apply java plugin, your gradle project does not have a concept of runtime / compile configurations, eg those are just names. 如果您不使用Java插件,那么gradle项目就没有运行时/编译配置的概念,例如,这些仅仅是名称。 When you do apply the java plugin then 'compile' and 'runtime' (and others) dependencies mean stuff that needs to be on the classpath. 当您确实应用Java插件时,“编译”和“运行时”(及其他)依赖项意味着需要放在类路径中的东西。 ... groovy/scala plugin apply java plugin behind the hood so it should all good. ... groovy / scala插件在后台应用了Java插件,因此应该都不错。 Tooling Api is not bound to the java nature of the project. Tooling Api不受项目Java性质的约束。 However, the jar dependencies, classpath, source and test compilation units, etc, all that make only sense if the java-related plugin is applied. 但是,jar依赖项,类路径,源和测试编译单元等仅在应用与Java相关的插件时才有意义。 So if you ask tooling api to provide Idea model of the non-java project you'll get a project, modules but not dependencies, source trees, etc. 因此,如果您要求工具api提供非Java项目的Idea模型,您将获得一个项目,模块,但没有依赖项,源树等。

The compile scope is the one you need. compile范围是您需要的范围。 build is only used for the build scripts themselves. build仅用于构建脚本本身。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM