Skip to content
This repository has been archived by the owner on Oct 7, 2020. It is now read-only.

Jar names do not include version numbers and liable to invalid duplication #4

Open
mickeyreiss opened this issue Jan 28, 2016 · 2 comments

Comments

@mickeyreiss
Copy link
Contributor

For example:

$ java -jar ./target/bazel-deps-1.0-SNAPSHOT.jar io.dropwizard:dropwizard-jackson:0.9.2 com.google.guava:guava:16.0
Fetching dependencies from maven...

SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.


--------- Add these lines to your WORKSPACE file ---------

maven_jar(name = "io.dropwizard_dropwizard-jackson", artifact = "io.dropwizard:dropwizard-jackson:jar:0.9.2")
maven_jar(name = "io.dropwizard_dropwizard-util", artifact = "io.dropwizard:dropwizard-util:jar:0.9.2")
maven_jar(name = "com.google.guava_guava", artifact = "com.google.guava:guava:jar:16.0")
maven_jar(name = "com.google.guava_guava", artifact = "com.google.guava:guava:jar:18.0")
maven_jar(name = "com.fasterxml.jackson.core_jackson-annotations", artifact = "com.fasterxml.jackson.core:jackson-annotations:jar:2.6.0")
maven_jar(name = "com.fasterxml.jackson.core_jackson-core", artifact = "com.fasterxml.jackson.core:jackson-core:jar:2.6.3")
maven_jar(name = "com.fasterxml.jackson.core_jackson-databind", artifact = "com.fasterxml.jackson.core:jackson-databind:jar:2.6.3")
maven_jar(name = "com.fasterxml.jackson.datatype_jackson-datatype-guava", artifact = "com.fasterxml.jackson.datatype:jackson-datatype-guava:jar:2.6.3")
maven_jar(name = "com.fasterxml.jackson.datatype_jackson-datatype-jdk7", artifact = "com.fasterxml.jackson.datatype:jackson-datatype-jdk7:jar:2.6.3")
maven_jar(name = "com.fasterxml.jackson.datatype_jackson-datatype-joda", artifact = "com.fasterxml.jackson.datatype:jackson-datatype-joda:jar:2.6.3")
maven_jar(name = "com.fasterxml.jackson.module_jackson-module-afterburner", artifact = "com.fasterxml.jackson.module:jackson-module-afterburner:jar:2.6.3")
maven_jar(name = "joda-time_joda-time", artifact = "joda-time:joda-time:jar:2.9")
maven_jar(name = "com.google.code.findbugs_jsr305", artifact = "com.google.code.findbugs:jsr305:jar:3.0.1")
maven_jar(name = "ch.qos.logback_logback-classic", artifact = "ch.qos.logback:logback-classic:jar:1.1.3")
maven_jar(name = "ch.qos.logback_logback-core", artifact = "ch.qos.logback:logback-core:jar:1.1.3")
maven_jar(name = "org.slf4j_slf4j-api", artifact = "org.slf4j:slf4j-api:jar:1.7.12")


--------- Add these lines to your BUILD file ---------

java_library(
  name="dropwizard-jackson",
  visibility = ["//visibility:public"],
  exports = [
    "@ch.qos.logback_logback-classic//jar",
    "@ch.qos.logback_logback-core//jar",
    "@com.fasterxml.jackson.core_jackson-annotations//jar",
    "@com.fasterxml.jackson.core_jackson-core//jar",
    "@com.fasterxml.jackson.core_jackson-databind//jar",
    "@com.fasterxml.jackson.datatype_jackson-datatype-guava//jar",
    "@com.fasterxml.jackson.datatype_jackson-datatype-jdk7//jar",
    "@com.fasterxml.jackson.datatype_jackson-datatype-joda//jar",
    "@com.fasterxml.jackson.module_jackson-module-afterburner//jar",
    "@com.google.code.findbugs_jsr305//jar",
    "@com.google.guava_guava//jar",
    "@io.dropwizard_dropwizard-jackson//jar",
    "@io.dropwizard_dropwizard-util//jar",
    "@joda-time_joda-time//jar",
    "@org.slf4j_slf4j-api//jar",
  ],
)

java_library(
  name="guava",
  visibility = ["//visibility:public"],
  exports = [
    "@com.google.guava_guava//jar",
  ],
)

Note that com.google.guava_guava//jar is used as the name for two maven_jars and is ambiguous.

To solve this, perhaps we could include the version number in the generated name?

@pgr0ss
Copy link
Owner

pgr0ss commented Jan 29, 2016

I don't think you want duplicate dependencies, even at different versions. These jars likely have the same classes, so only one will actually be used at runtime (whichever it finds first?).

In practice, I just manually delete the old jars. But maybe bazel-deps could do that for us.

@leggers
Copy link

leggers commented Nov 20, 2017

looks like this merge fixed this? caa0a69

though there are still duplicate maven_jar rules generated in the WORKSPACE bit of the output of the script.. i'll put together a PR to fix

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants