4

依存関係として別のローカルscalaプロジェクトを持つためにplayプロジェクトを取得しようとしています。構成ファイルにこの行を含めて、ローカルのscalaプロジェクトをローカルのM2リポジトリにデプロイしています。

publishTo := Some(Resolver.file("file",  new File(Path.userHome.absolutePath+"/.m2/repository")))

そして、私はこの行で私のプレイプロジェクトに依存関係をロードしようとしています

val appDependencies = Seq(
    "com.experimentalcork" %% "timeywimeyentities" % "0.0.2"
)

val main = PlayProject(appName, appVersion, appDependencies, mainLang = SCALA).settings(   
    resolvers += "Local Maven Repository" at "file://" + Path.userHome.absolutePath + "/.m2/repository",testOptions in Test := Nil 
)

'play compile'を実行すると、ログに依存関係が見つからないと表示されます。依存関係を指定した場所を探しています。

[warn] ==== Local Maven Repository: tried
[warn]   file://C:/Users/caelrin/.m2/repository/com/experimentalcork/timeywimeyentities_2.9.1/0.0.2/timeywimeyentities_2.9.1-0.0.2.pom

そして、そのディレクトリをチェックすると、pomファイルとjarファイルがそこにあることを確認できます。pomを含むディレクトリで、pomがどのように表示され、見つからないかについて、私は完全に困惑しています。誰かがこれを経験したことがありますか?

4

1 に答える 1

0

.dependsOn 呼び出しも必要だと思います。

val timeywimeyentities: Project = Project([Put all of your settings here for the project just like you would a play project])

val main = PlayProject(appName, appVersion, appDependencies, mainLang = SCALA).settings(   
    resolvers += "Local Maven Repository" at "file://" + Path.userHome.absolutePath + "/.m2/repository",testOptions in Test := Nil 
).dependsOn(timeywimeyentities % "compile->compile")

「compile->compile」を追加すると、play プロジェクトのメイン コードが依存関係のメイン コードに依存するようになります。Play プロジェクトのテスト コードもそれに依存させたい場合は、"compile->test" を使用できます。両方のテスト コードだけを相互に認識させたい場合は、"test->test" を使用できます。たとえば、「コンパイル->コンパイル;テスト->テスト」のように、それらを連鎖させることもできます。"compile->compile" だけが必要な場合は、明示的に指定する必要はありません。

詳細については、 https://github.com/harrah/xsbt/wiki/Getting-Started-Multi-Projectを参照してください。

于 2012-09-13T14:47:19.993 に答える