简体   繁体   English

Codenarc奇怪的依赖关系

[英]Codenarc strange dependencies

We are using codenarc plugin and gradle, and i see the strange things in dependencies: 我们正在使用codenarc插件和gradle,我看到了依赖项中的奇怪之处:

codenarc - The CodeNarc libraries to be used for this project.
\--- org.codenarc:CodeNarc:0.25.2
 +--- junit:junit:4.8.1 -> 4.12
 |    \--- org.hamcrest:hamcrest-core:1.3
 +--- org.codehaus.groovy:groovy-xml:2.1.8 -> 2.6.0-alpha-1
 |    \--- org.codehaus.groovy:groovy:2.6.0-alpha-1
 +--- org.codehaus.groovy:groovy:2.1.8 -> 2.6.0-alpha-1
 +--- org.codehaus.groovy:groovy-ant:2.1.8 -> 2.6.0-alpha-1
 |    +--- org.codehaus.groovy:groovy:2.6.0-alpha-1
 |    +--- org.codehaus.groovy:groovy-groovydoc:2.6.0-alpha-1 -> 2.4.9
 |    |    +--- org.codehaus.groovy:groovy-templates:2.4.9
 |    |    |    +--- org.codehaus.groovy:groovy:2.4.9 -> 2.6.0-alpha-1
 |    |    |    \--- org.codehaus.groovy:groovy-xml:2.4.9 -> 2.6.0-alpha-1 (*)
 |    |    \--- org.codehaus.groovy:groovy:2.4.9 -> 2.6.0-alpha-1
 |    +--- org.apache.ant:ant-junit:1.9.9
 |    \--- org.apache.ant:ant-antlr:1.9.9
 \--- org.gmetrics:GMetrics:0.7
      +--- org.codehaus.groovy:groovy:[2.1.0,) -> 2.6.0-alpha-1
      +--- org.codehaus.groovy:groovy-xml:[2.1.0,) -> 2.6.0-alpha-1 (*)
      \--- org.codehaus.groovy:groovy-ant:[2.1.0,) -> 2.6.0-alpha-1 (*)

Version of codenark is 0.25.2 and in pom it depends on groovy 2.1.8, but wtf - why it links to 2.6.0-alpha-1? codenark的版本是0.25.2,在pom中它取决于groovy 2.1.8,但是wtf-为什么它链接到2.6.0-alpha-1? How i can tell for codenark to use version of Groovy 2.1.8? 我如何告诉Codenark使用Groovy 2.1.8版本?

Thanks for help. 感谢帮助。

As you can see in your output the culprit is GMetrics. 正如您在输出中看到的,罪魁祸首是GMetrics。
CodeNarc 0.25.2 depends on GMetrics 0.7 which in turn depends on Groovy 2.1.0 or newer which resolves to the newest available version 2.6.0-alpha-1. CodeNarc 0.25.2取决于GMetrics 0.7,而后者又取决于Groovy 2.1.0或更高版本,后者解析为最新的可用版本2.6.0-alpha-1。
Default version conflict resolution strategy is to use the newest version on conflict, which then is the 2.6.0-alpha-1. 默认版本冲突解决策略是在发生冲突时使用最新版本,即2.6.0-alpha-1。

It is an error (in my opinion) for a lib to publish with a dynamic range. (以我的观点)库以动态范围发布是错误的。
GMetrics obviously also have seen this as error and fixed this dependency in 1.0 where they depend on a specific Groovy version instead. GMetrics显然也将其视为错误,并在1.0中修复了此依赖关系,该依赖关系改为依赖特定的Groovy版本。
CodeNarc 1.0 in turn depends on GMetrics 1.0. 反过来,CodeNarc 1.0取决于GMetrics 1.0。

So the easiest you could do if feasible, is to depend on CodeNarc 1.0 and your problem will be gone. 因此,如果可行,最简单的方法就是依赖CodeNarc 1.0,您的问题将消失。

Alternatively you can also declare the Groovy version to be used in your own dependencies with force true which will force the version you define. 另外,您也可以声明Groovy版本在您自己的依赖项中使用,使用force true强制将强制您定义的版本。

Alternatively you can configure the dependency resolution to influence the version selected. 或者,您可以配置依赖性解析以影响所选的版本。

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

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