はSBT

2017-02-07 13 views
1

とGitのライブラリを参照するとき、私はGitのでカスタムScalaCheckを参照しようとしているパッケージを解決できません、私のbuild.sbtファイルがはSBT

lazy val root = (project in file(".")) 
    .settings(
    name := "myproject", 
    version := "1.0", 
    scalaVersion := "2.11.8", 
    libraryDependencies ++= Seq(/*other dependencies*/) 
) 
    .dependsOn(sc) 

lazy val sc = RootProject(uri("https://github.com/<user>/scalacheck.git")) 
version in sc := "1.14.0-SNAPSHOT" 

をたどるような問題は、私は、ライブラリをインポートすることができないということです。私はscalacheckがorgの一部ではないというエラーしか出ません。これは私がScalaのバージョン2.12を使用しますが、私はそれをサポートする他のいくつかの依存関係として2.11を使用する必要がある場合にも、これははるかに私が唯一の取得私のコード

import org.scalacheck._ 
object Main extends App { 
    println("Hello world") 
} 

です。 2.11を使用すると、依存関係をまったく解決できません。

私はSBTバージョン0.13.13です。

これは

[info] Loading project definition from C:\Users\user\myproject\project 
[info] Loading project definition from C:\Users\user\.sbt\0.13\staging\ec35d052aa233b07b77a\scalacheck\project 
[info] Set current project to myproject (in build file:/C:/Users/user/myproject/) 
> [info] Defining root/*:shellPrompt 
[info] The new value will be used by no settings or tasks. 
[info] Reapplying settings... 
[info] Set current project to myproject (in build file:/C:/Users/user/myproject/) 
[info] Defining */*:sbtStructureOutputFile 
[info] The new value will be used by no settings or tasks. 
[info] Reapplying settings... 
[info] Set current project to myproject (in build file:/C:/Users/user/myproject/) 
[info] Defining */*:sbtStructureOptions 
[info] The new value will be used by no settings or tasks. 
[info] Reapplying settings... 
[info] Set current project to myproject (in build file:/C:/Users/user/myproject/) 
[info] Applying State transformations org.jetbrains.sbt.CreateTasks from C:/Users/user/.IntelliJIdea2016.3/config/plugins/Scala/launcher/sbt-structure-0.13.jar 
[info] Reapplying settings... 
[info] Set current project to myproject (in build file:/C:/Users/user/myproject/) 
[info] Updating {file:/C:/Users/user/myproject/}root... 
[info] Resolving org.scala-lang#scala-library;2.11.8 ... 
[info] Resolving default#scalacheck_2.11;1.14.0-SNAPSHOT ... 
[info] Resolving default#scalacheck_2.11;1.14.0-SNAPSHOT ... 
[warn] module not found: default#scalacheck_2.11;1.14.0-SNAPSHOT 
[warn] ==== local: tried 
[warn] C:\Users\user\.ivy2\local\default\scalacheck_2.11\1.14.0-SNAPSHOT\ivys\ivy.xml 
[warn] ==== public: tried 
[warn] https://repo1.maven.org/maven2/default/scalacheck_2.11/1.14.0-SNAPSHOT/scalacheck_2.11-1.14.0-SNAPSHOT.pom 
[info] Resolving org.scalaj#scalaj-http_2.11;2.3.0 ... 
[info] Resolving com.fasterxml.jackson.module#jackson-module-scala_2.11;2.7.2 ... 
[info] Resolving org.scala-lang#scala-reflect;2.11.8 ... 
[info] Resolving com.fasterxml.jackson.core#jackson-core;2.7.2 ... 
[info] Resolving com.fasterxml.jackson.core#jackson-annotations;2.7.2 ... 
[info] Resolving com.fasterxml.jackson.core#jackson-databind;2.7.2 ... 
[info] Resolving com.fasterxml.jackson.module#jackson-module-paranamer;2.7.2 ... 
[info] Resolving com.thoughtworks.paranamer#paranamer;2.8 ... 
[info] Resolving ch.qos.logback#logback-classic;1.1.7 ... 
[info] Resolving ch.qos.logback#logback-core;1.1.7 ... 
[info] Resolving org.slf4j#slf4j-api;1.7.20 ... 
[info] Resolving com.typesafe.scala-logging#scala-logging_2.11;3.5.0 ... 
[info] Resolving org.slf4j#slf4j-api;1.7.21 ... 
[info] Resolving com.softwaremill.quicklens#quicklens_2.11;1.4.8 ... 
[info] Resolving org.scalacheck#scalacheck_2.11;1.13.4 ... 
[info] Resolving org.scala-sbt#test-interface;1.0 ... 
[info] Resolving org.scala-lang#scala-compiler;2.11.8 ... 
[info] Resolving org.scala-lang.modules#scala-xml_2.11;1.0.4 ... 
[info] Resolving org.scala-lang.modules#scala-parser-combinators_2.11;1.0.4 ... 
[info] Resolving jline#jline;2.12.1 ... 
[warn] :::::::::::::::::::::::::::::::::::::::::::::: 
[warn] ::   UNRESOLVED DEPENDENCIES   :: 
[warn] :::::::::::::::::::::::::::::::::::::::::::::: 
[warn] :: default#scalacheck_2.11;1.14.0-SNAPSHOT: not found 
[warn] :::::::::::::::::::::::::::::::::::::::::::::: 
[warn] 
[warn] Note: Unresolved dependencies path: 
[warn]  default:scalacheck_2.11:1.14.0-SNAPSHOT 
[warn]  +- myproject:myproject_2.11:1.0 
[trace] Stack trace suppressed: run 'last root/*:update' for the full output. 
[trace] Stack trace suppressed: run 'last root/*:ssExtractDependencies' for the full output. 
[error] (root/*:update) sbt.ResolveException: unresolved dependency: default#scalacheck_2.11;1.14.0-SNAPSHOT: not found 
[error] (root/*:ssExtractDependencies) sbt.ResolveException: unresolved dependency: default#scalacheck_2.11;1.14.0-SNAPSHOT: not found 
[error] Total time: 3 s, completed 2017-feb-10 09:14:53 

、私のSBT出力である.sbt/0.13/staging/ec35d052aa233b07b77a/scalacheckは完全なレポが含まれていると私は考えることは、ターゲットディレクトリでビルドですが、ほとんどを指しScalaのバージョン2.12のために構築します。

フォローアップ編集:私はSBTのために、このバグレポートがあなたの<user>/scalacheck.gitは、元rickynils/scalacheck.gitのフォークであると仮定するとhttps://github.com/sbt/sbt/issues/2901

答えて

1

を関与していると思いますが、問題はscalacheck の現在のmasterブランチがtargetted to scala 2.12.0

以来であるということですscalaVersionは2.11.8です。scalacheckの現在のリビジョンはサポートされていません。

したがって、build.sbtscalaVersionを2.12.0に変更すると問題が解決します。 scalajsのために、あなたが必要なものjvm

は、したがって、あなたがProjectRef代わりのRootProjectを使用する必要がある

$ sbt projects 
    js 
    jvm 
* scalacheck 

jsがされています、あなたはそのscalacheckを確認することができます。また

sbt projectsを使用して内部の3つのプロジェクトが含まれていますプロジェクトを指定します。

lazy val root = (project in file(".")) 
    .settings(
    name := "myproject", 
    version := "1.0", 
    scalaVersion := "2.12.0", 
    libraryDependencies ++= Seq(/*other dependencies*/) 
) 
    .dependsOn(sc) 

lazy val sc = ProjectRef(uri("https://github.com/<user>/scalacheck.git"),"jvm") 
version in sc := "1.14.0-SNAPSHOT" 

またhttps://github.com/<user>/scalacheck.git2.11.8build.sbtscalaVersionを変更するとうまくいくかもしれないが、それは2.12.0の新機能を使用する場合には、コンパイルされません。

scala 2.11.8を使用する場合は、#GIT_TAG構文を使用して古いバージョンを指定することができます。

ProjectRef(uri("https://github.com/rickynils/scalacheck.git#1.13.4"),"jvm") 
+0

まず、ScalaCheck build.sbtの 'crossScalaVersions'設定がこれを修正しないでしょうか?第二に、sbtがscalacheckを見つけても、私はまだmainでimport error 'scalacheck is org'の一部ではありません。また、2.12を使用する代わりに(私の依存関係の1つでは2.11が必要です)、古いScalaCheckバージョンをsbtで指定できますか? – davl

+0

@davl答えを更新し、古いscalacheckを指定してインポートエラーを修正する方法を更新しました。そして、あなたが言うように、 'crossScalaVersions'はscalacheckの' build.sbt'で指定されているので '2.11.8'で実行するべきですが、' crossScalaVersions'は 'RootProject'や' ProjectRef' 、および展開用にのみ使用できます。私は真実を知らない。 – ymonad