(Quick Reference)

3.7.3 调试解析 - Reference Documentation

Authors: Graeme Rocher, Peter Ledbrook, Marc Palmer, Jeff Brown, Luke Daley, Burt Beckwith

Version: null

3.7.3 调试解析

If you are having trouble getting a dependency to resolve you can enable more verbose debugging from the underlying engine using the log method:

// log level of Ivy resolver, either 'error', 'warn',
// 'info', 'debug' or 'verbose'
log "warn"

A common issue is that the checksums for a dependency don't match the associated JAR file, and so Ivy rejects the dependency. This helps ensure that the dependencies are valid. But for a variety of reasons some dependencies simply don't have valid checksums in the repositories, even if they are valid JARs. To get round this, you can disable Ivy's dependency checks like so:

grails.project.dependency.resolution = {
    …
    log "warn"
    checksums false
    …
}

This is a global setting, so only use it if you have to.

如果你解析依赖遇到了问题的话,你可以使用基本的log方法来显示更多的调试信息:

// log level of Ivy resolver, either 'error', 'warn',
// 'info', 'debug' or 'verbose'
log "warn"

一个常见的问题是依赖的校验码跟其相应的JAR文件不匹配,这将导致Ivy不接收此依赖。此举用以保证依赖的有效性,但是由于不确定的原因,导致有些依赖在存储仓库中即使存在有效的JAR,也还是没有有效的校验码。要解决此问题,你可以禁用Ivy的依赖检测,比如:

grails.project.dependency.resolution = {
    …
    log "warn"
    checksums false
    …
}

这是个全局设置,因此请在不得已的时候才使用。