New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to resolve some of the dependencies :( #231

Closed
dkowis opened this Issue Aug 18, 2015 · 8 comments

Comments

3 participants
@dkowis

dkowis commented Aug 18, 2015

Trying to create a new project using finatra-http and I'm getting dependency resolution problems:

[warn]  ::::::::::::::::::::::::::::::::::::::::::::::
[warn]  ::          UNRESOLVED DEPENDENCIES         ::
[warn]  ::::::::::::::::::::::::::::::::::::::::::::::
[warn]  :: com.twitter.common#metrics;0.0.29: not found
[warn]  :: org.apache.thrift#libthrift;0.5.0: not found
[warn]  ::::::::::::::::::::::::::::::::::::::::::::::
[warn]
[warn]  Note: Unresolved dependencies path:
[warn]      com.twitter.common:metrics:0.0.29
[warn]        +- com.twitter:finagle-stats_2.11:6.25.0
[warn]        +- com.twitter.inject:inject-server_2.11:2.0.0.M2
[warn]        +- com.twitter.finatra:finatra-utils_2.11:2.0.0.M2
[warn]        +- com.twitter.finatra:finatra-jackson_2.11:2.0.0.M2
[warn]        +- com.twitter.finatra:finatra-http_2.11:2.0.0.M2 (~/gitwork/job-automator/project/Automator.scala#L16)
[warn]        +- automator:automator_2.11:1.0
[warn]      org.apache.thrift:libthrift:0.5.0
[warn]        +- com.twitter:finagle-thrift_2.11:6.25.0
[warn]        +- com.twitter:finagle-zipkin_2.11:6.25.0
[warn]        +- com.twitter:twitter-server_2.11:1.10.0
[warn]        +- com.twitter.inject:inject-server_2.11:2.0.0.M2
[warn]        +- com.twitter.finatra:finatra-utils_2.11:2.0.0.M2
[warn]        +- com.twitter.finatra:finatra-jackson_2.11:2.0.0.M2
[warn]        +- com.twitter.finatra:finatra-http_2.11:2.0.0.M2 (~/gitwork/job-automator/project/Automator.scala#L16)
[warn]        +- automator:automator_2.11:1.0

It could be as simple as that I'm missing a resolver or something, but documentation doesn't seem to indicate such.

@dkowis

This comment has been minimized.

dkowis commented Aug 18, 2015

Welp, after digging into the finatra build.sbt file, I figured out that you need these:

So for those that have troubles, you need these resolvers, and yes it is "maven.twttr.com"

      resolvers ++= Seq(
        "Twitter maven" at "http://maven.twttr.com",
        "Finatra Repo" at "http://twitter.github.com/finatra"
      )
@dkowis

This comment has been minimized.

dkowis commented Aug 18, 2015

Okay, those resolvers only get me so far.
I'm still unable to resolve finatra-slf4j :(

@dkowis

This comment has been minimized.

dkowis commented Aug 18, 2015

Crap:

[info] Resolving com.twitter.finatra#finatra-slf4j_2.11;2.0.0.M2 ...
[warn]  module not found: com.twitter.finatra#finatra-slf4j_2.11;2.0.0.M2
[warn] ==== local: tried
[warn]   /Users/dxk0875/.ivy2/local/com.twitter.finatra/finatra-slf4j_2.11/2.0.0.M2/ivys/ivy.xml
[warn] ==== public: tried
[warn]   https://repo1.maven.org/maven2/com/twitter/finatra/finatra-slf4j_2.11/2.0.0.M2/finatra-slf4j_2.11-2.0.0.M2.pom
[warn] ==== sonatype-releases: tried
[warn]   https://oss.sonatype.org/content/repositories/releases/com/twitter/finatra/finatra-slf4j_2.11/2.0.0.M2/finatra-slf4j_2.11-2.0.0.M2.pom
[warn] ==== Twitter maven: tried
[warn]   http://maven.twttr.com/com/twitter/finatra/finatra-slf4j_2.11/2.0.0.M2/finatra-slf4j_2.11-2.0.0.M2.pom
[warn] ==== Finatra Repo: tried
[warn]   http://twitter.github.com/finatra/com/twitter/finatra/finatra-slf4j_2.11/2.0.0.M2/finatra-slf4j_2.11-2.0.0.M2.pom
[info] Resolving jline#jline;2.12.1 ...
[warn]  ::::::::::::::::::::::::::::::::::::::::::::::
[warn]  ::          UNRESOLVED DEPENDENCIES         ::
[warn]  ::::::::::::::::::::::::::::::::::::::::::::::
[warn]  :: com.twitter.finatra#finatra-slf4j_2.11;2.0.0.M2: not found
[warn]  ::::::::::::::::::::::::::::::::::::::::::::::
@dkowis

This comment has been minimized.

dkowis commented Aug 18, 2015

And further problems when trying to run the tests:

[error] missing or invalid dependency detected while loading class file 'Test.class'.
[error] Could not access type Logging in package com.twitter.inject,
[error] because it (or its dependencies) are missing. Check your build definition for
[error] missing or conflicting dependencies. (Re-run with `-Ylog-classpath` to see the problematic classpath.)
[error] A full rebuild may help if 'Test.class' was compiled against an incompatible version of com.twitter.inject.
[error] /Users/dxk0875/gitwork/job-automator/src/test/scala/com/homedepot/olt/jobber/JobFeatureTest.scala:7: illegal inheritance;
[error]  self-type com.homedepot.olt.jobber.JobFeatureTest does not conform to com.twitter.inject.Test's selftype com.twitter.inject.Test
[error] class JobFeatureTest extends Test {
[error]                              ^
[error] missing or invalid dependency detected while loading class file 'EmbeddedApp.class'.
[error] Could not access type Logging in package com.twitter.inject,
[error] because it (or its dependencies) are missing. Check your build definition for
[error] missing or conflicting dependencies. (Re-run with `-Ylog-classpath` to see the problematic classpath.)
[error] A full rebuild may help if 'EmbeddedApp.class' was compiled against an incompatible version of com.twitter.inject.
[error] missing or invalid dependency detected while loading class file 'EmbeddedHttpServer.class'.
[error] Could not access type Ports in package com.twitter.inject.server,
[error] because it (or its dependencies) are missing. Check your build definition for
[error] missing or conflicting dependencies. (Re-run with `-Ylog-classpath` to see the problematic classpath.)
[error] A full rebuild may help if 'EmbeddedHttpServer.class' was compiled against an incompatible version of com.twitter.inject.server.
[error] four errors found

For reference, my SBT Build:

import sbt._
import Keys._

object AutomatorBuild extends Build {

  val finatraVersion = "2.0.0.M2"

  lazy val root = Project(
    "Automator",
    file("."),
    settings = Seq(
      name := "Automator",
      version := "1.0",
      scalaVersion := "2.11.7",
      scalacOptions := Seq(
        "-language:_",
        "-g:vars",
        "-unchecked",
        "-deprecation",
        "-encoding", "utf8"
      ),
      ivyScala := ivyScala.value map {
        _.copy(overrideScalaVersion = true)
      },
      resolvers ++= Seq(
        Resolver.sonatypeRepo("releases"),
        "Twitter maven" at "http://maven.twttr.com",
        "Finatra Repo" at "http://twitter.github.com/finatra"
      ),
      libraryDependencies ++= Seq(
        "com.twitter.finatra" %% "finatra-http" % finatraVersion,
        "com.twitter.finatra" %% "finatra-logback" % finatraVersion,
        //"com.twitter.finatra" %% "finatra-slf4j" % finatraVersion, //Can't resolve this right now :(
        //Test dependencies for finatra
        "com.twitter.finatra" %% "finatra-http" % finatraVersion % "test" classifier "tests",
        "com.twitter.inject" %% "inject-core" % finatraVersion % "test" classifier "tests",
        "com.twitter.inject" %% "inject-modules" % finatraVersion % "test" classifier "tests",
        "com.twitter.inject" %% "inject-app" % finatraVersion % "test" classifier "tests",
        "com.twitter.inject" %% "inject-server" % finatraVersion % "test" classifier "tests",
        "org.scala-lang.modules" %% "scala-xml" % "1.0.3" % "test", //I want the xml support in test mode
        "org.apache.velocity" % "velocity" % "1.7", // Template engine instead of twirl
        "com.typesafe.play" %% "play-json" % "2.4.2", //For awesome JSON parsing!
        //"com.google.guava" % "guava" % "18.0", //For the caching, if I use it
        "org.apache.httpcomponents" % "fluent-hc" % "4.5", //Httpclient
        "com.typesafe.scala-logging" %% "scala-logging-slf4j" % "2.1.2", //Logging support
        "org.scalatest" %% "scalatest" % "2.2.4" % "test", // testing
        "junit" % "junit" % "4.12" % "test"
      )
    )
  )
}

// vim: set ts=4 sw=4 et:
@dkowis

This comment has been minimized.

dkowis commented Aug 18, 2015

I finally figured it out. Gotta have all these depenencies explicitly, then it all works again. Derp.

        //Test dependencies for finatra
        "com.twitter.finatra" %% "finatra-http" % finatraVersion % "test" classifier "tests",
        "com.twitter.inject" %% "inject-core" % finatraVersion % "test" classifier "tests",
        "com.twitter.inject" %% "inject-core" % finatraVersion % "test",
        "com.twitter.inject" %% "inject-modules" % finatraVersion % "test",
        "com.twitter.inject" %% "inject-modules" % finatraVersion % "test" classifier "tests",
        "com.twitter.inject" %% "inject-app" % finatraVersion % "test",
        "com.twitter.inject" %% "inject-app" % finatraVersion % "test" classifier "tests",
        "com.twitter.inject" %% "inject-server" % finatraVersion % "test",
        "com.twitter.inject" %% "inject-server" % finatraVersion % "test" classifier "tests",
@cacoco

This comment has been minimized.

Member

cacoco commented Aug 18, 2015

@dkowis in general, you should copy the example build.sbt completely as it lists the minimum needed to build and test a finatra service.

A couple of things to note:

  • finatra-slf4j is new (and only in master). In 2.0.0.M2 this module was finatra-logback (as it included the slf4j bridges and the logback implementation as dependencies). If you are using the 2.0.0.M2 release you'll need to reference finatra-logback.
  • "test" classifier dependencies do not currently resolve transitively with the finatra sbt build. Thus, as you've discovered you need to include these dependencies explicitly (as listed in the hello-world build.sbt).
  • you should only need the "Twitter maven" resolver, let me know if that does not work.

Thanks!
-c

@scosenza scosenza closed this Aug 18, 2015

@dkowis

This comment has been minimized.

dkowis commented Aug 18, 2015

Aha, all that makes so much more sense, and I should've checked out the tag instead of looking at master. Thanks for the help! I think I'm on the right path now.

BTW, this project is exactly what I've been looking for in a nice featureful (but the right features) REST framework for scala. Super great work!

@scosenza

This comment has been minimized.

Contributor

scosenza commented Aug 18, 2015

Thanks for the kind words! Please keep the feedback and questions coming :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment