简体   繁体   中英

Codenarc strange dependencies

We are using codenarc plugin and gradle, and i see the strange things in dependencies:

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? How i can tell for codenark to use version of Groovy 2.1.8?

Thanks for help.

As you can see in your output the culprit is 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.
Default version conflict resolution strategy is to use the newest version on conflict, which then is the 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.
CodeNarc 1.0 in turn depends on GMetrics 1.0.

So the easiest you could do if feasible, is to depend on CodeNarc 1.0 and your problem will be gone.

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.

Alternatively you can configure the dependency resolution to influence the version selected.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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