我在Ubuntu中的Scalatra项目有问题

时间:2019-06-22 02:26:50

标签: scala scalatra

在ubuntu中构建Scala项目时遇到问题。我收到<unresolved dependencies path>错误。

项目目录结构

 ------ build.sbt
 ------ build.sbt.rest
 ------ build.sbt.model
 ------ build.sbt.stream
 ------ version.sbt
 ------ <project>--|
                   | ---Dependencies.scala
                   | ---build.properties 
                   | ---plugins.sbt
                   | ---<project>--|
                                   |
                   | --- <target> --|
                                    |
---------<model>---|
                   |

----------<rest>---|
                   |

---------<stream>--|
                   |
---------<target>--|
                   |  

我给命令行<jetty:start><sbt>

build.sbt中的代码:

    import Dependencies._
    import org.scalatra.sbt.PluginKeys._
    import org.scalatra.sbt.ScalatraPlugin

    lazy val indeSettings = Seq(
       organization := "com.tft",
       scalaVersion := "2.12.1",
       resolvers ++= Seq(
        Classpaths.typesafeRelease,
        Resolver.bintrayRepo("cakesolutions", "maven")
       ),
      scalacOptions ++= Seq("-deprecation", "-feature")
    )

    lazy val indeProject = Project(
       id = "inde-project",
       base = file("."),
       settings = indeSettings ++ doNotPublish ++ Seq(
          ....
        ),
       aggregate  = Seq(model, rest, stream)
    )

    lazy val  model = Project(
       ......
       ......
    )

    lazy  val rest = Project(
       id = "inde-rest-agg",
        base = file("rest"),
        settings = indeSettings ++ ScalatraPlugin.scalatraSettings ++ 
       Seq(        
            libraryDependencies ++= scalatraAll, //this line cause error

            libraryDependencies ++ = Seq(
               .....
            )
     )dependsOn(model % "compile; test-> test;provided->provided")
      enablePlugins JettyPlugin

    lazy val stream = Project(
        .......
    )dependsOn(model % "compile;test->test;provided->provided") 
    enablePlugins(JavaAppPackaging, DockerPlugin

    lazy val doNotPublish = Seq(publish := {}, publishLocal := {})

project / Dependencies.scala中的代码

    import sbt._
    object Dependencies{

      /*model*/
       .........

      /* stream */
        ........

      /*rest*/
  lazy val scalatraAll = Seq(
   "org.scalatra" %% "scalatra"  % ScalatraVersion,
   "org.scalatra" %% "scalatra-json"  % ScalatraVersion,
   "org.scalatra" %% "scalatra-atmosphere"  % ScalatraVersion,
   "org.scalatra" %% "scalatra-auth"  % ScalatraVersion,
   "org.scalatra" %% "scalatra-specs2"  % ScalatraVersion % "test")        
         ......

       private val ScalatraVersion = "2.5.1-SNAPSHOT"

         .......

    }

build.sbt.rest中的代码

    import org.scalatra.sbt._
    import Scalatra.sbt.PluginKeys._
    import ScalateKeys._

    val ScalatraVersion = "2.5.1-SNAPSHOT"
    ScalatraPlugin.scalatraSettings
    scalateSettings
    organization := "com.tft"
    name := "Inde REST"
    version := "0.1.0-SNAPSHOT"
    scalaVersion := "2.12.1"
    resolvers += Classpaths.typesafeReleases
    resolvers += Resolver.bintrayRepo("cakesolutions", "maven")

    libraryDependencies ++= Seq(
      ......
        "org.scalatra" %% "scalatra" % ScalatraVersion,
        "org.scalatra" %% "scalatra-scalate" % ScalatraVersion,
        "org.scalatra" %% "scalatra-json" % ScalatraVersion,
        "org.scalatra" %% "scalatra-atmosphere" % ScalatraVersion,
        "org.scalatra" %% "scalatra-auth" % ScalatraVersion,
        "org.scalatra" %% "scalatra-specs2" % ScalatraVersion,
      ......
    )

    scalateTemplateConfig in Compile := {
    val base = (sourceDirectory in Compile).value
    Seq(
      TemplateConfig(
        base / "webapp" /"WEB-INF" / "templates",
        Seq.empty,
        Seq(
          Binding("context", 
                  "_root_.org.scalatra.scalate.ScalatraRenderContext", 
                  importMembers = true,
                  isImplicit = true)
         ),
        Some("templates")
       )
      ) 
    }

    enablePlugins(JettyPlugin)

当我开始跳船时,错误是

note: Unresolved dependencies path:
    org.scalatra:scalatra-auth_2.12:2.5.1-SNAPSHOT 
    (/home/ubuntu/inde/build.sbt#L46)
    org.scalatra:scalatra-json_2.12:2.5.1-SNAPSHOT 
    (/home/ubuntu/inde/build.sbt#L46)
    org.scalatra:scalatra-specs2_2.12:2.5.1-SNAPSHOT 
    (/home/ubuntu/inde/build.sbt#L46)
    org.scalatra:scalatra_2.12:2.5.1-SNAPSHOT 
     (/home/ubuntu/inde/build.sbt#L46)
    org.scalatra:scalatra-atmosphe

re_2.12:2.5.1-SNAPSHOT 

(/home/ubuntu/inde/build.sbt#L46)

Stack trace suppressed: run last inde-rest-agg/*: update for the gull 
output.
(inde-rest-agg/*:update) sbt.ResolveException: 
unresolved dependency: org.scalatra#scalatra_2.12;2.5.1-SNAPSHOT: 
not found
unresolved dependency: org.scalatra#scalatra-json_2.12;2.5.1-SNAPSHOT:
not found
unresolved dependency: org.scalatra#scalatra-atmosphere_2.12;2.5.1-
SNAPSHOT: not found
unresolved dependency: org.scalatra#scalatra-auth_2.12;2.5.1-SNAPSHOT:
not found
unresolved dependency: org.scalatra#scalatra-specs2_2.12;2.5.1-SNAPSHOT:
not found

0 个答案:

没有答案