Grails BuildConfig.groovy,构建、编译和运行时的区别? [英] Grails BuildConfig.groovy, difference between build, compile, and runtime?
本文介绍了Grails BuildConfig.groovy,构建、编译和运行时的区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
BuildConfig.groovy
(1.3.7) 中 build
、runtime
和 compile
的区别是什么?)
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
- 只有构建过程需要的依赖项runtime
- 运行应用程序所需的依赖项,但不编译它,例如特定数据库供应商的 JDBC 实现.这在编译时通常不需要,因为代码仅依赖于 JDBC API,而不是其特定实现compile
- 编译时和运行时都需要的依赖项.这是最常见的情况build
- dependency that is only needed by the build processruntime
- 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 thereofcompile
- dependency that is needed at both compile-time and runtime. This is the most common casetest
- 仅测试需要的依赖项,例如一个模拟/测试库provided
- 编译时需要但不应与应用程序打包的依赖项(通常是因为它由容器提供).一个例子是 Servlet APItest
- dependency that is only needed by the tests, e.g. a mocking/testing libraryprovided
- 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
还有其他几个依赖范围:
There are a couple of other dependency scopes:
这篇关于Grails BuildConfig.groovy,构建、编译和运行时的区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文