Grails的BuildConfig.groovy,编译,编译和运行时之间的区别? [英] Grails BuildConfig.groovy, difference between build, compile, and runtime?

查看:769
本文介绍了Grails的BuildConfig.groovy,编译,编译和运行时之间的区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有什么建立运行编译 BuildConfig.groovy (1.3.7)

  grails.project.dependency.resolution = {    插件{
        打造极致:极致缓存:latest.integration
    }    依赖{
        打造com.foo.bar:foobar:1.0.5
        运行org.apache.httpcomponents:HttpClient的:4.0.3
        编译(com.thoughtworks.xstream:XStream的:1.3.1)
    }
}


解决方案

  • 建立 - 相依性,仅由构建过程需要

  • 运行 - 依赖,需要运行该应用程序,而不是如编译JDBC实现特定的数据库供应商。这通常不会在编译时需要,因为$ C $,c取决于只有JDBC API,而不是具体的实施及其

  • 编译 - 这是需要在编译时和运行时的依赖。这是最常见的情况

有一些其他的依赖范围的:


  • 测试 - 相依性,仅由测试所需,例如嘲弄/测试库

  • 提供 - 这是需要在编译时间,但不应与应用程序(通常是因为它是由容器提供)打包依赖。一个例子是Servlet API

What's the difference between build, runtime, and compile, in BuildConfig.groovy (1.3.7)

grails.project.dependency.resolution = {

    plugins {
        build "acme:acme-cache:latest.integration"
    }

    dependencies {
        build "com.foo.bar:foobar:1.0.5"       
        runtime "org.apache.httpcomponents:httpclient:4.0.3"
        compile("com.thoughtworks.xstream:xstream:1.3.1")
    }
}

解决方案

  • build - dependency that is only needed by the build process
  • runtime - dependency that is needed to run the application, but not compile it e.g. JDBC implementation for specific database vendor. This would not typically be needed at compile-time because code depends only the JDBC API, rather than a specific implementation thereof
  • compile - dependency that is needed at both compile-time and runtime. This is the most common case

There are a couple of other dependency scopes:

  • test - dependency that is only needed by the tests, e.g. a mocking/testing library
  • provided - dependency that is needed at compile-time but should not be packaged with the app (usually because it is provided by the container). An example is the Servlet API

这篇关于Grails的BuildConfig.groovy,编译,编译和运行时之间的区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆