简体   繁体   English

如何增加对Play项目在本地发布的库的依赖?

[英]How to add dependency on library that is published locally for Play Project?

I have a Play project that is intended to be a library that I would like to publish locally during development phase. 我有一个Play项目,该项目旨在成为我想在开发阶段在本地发布的库。

I can achieve this by running publish-local 我可以通过运行publish-local来实现

My question is how to add dependency in the main project so that in the main project we could access the utilities defined in the local library? 我的问题是如何在主项目中添加依赖项,以便在主项目中我们可以访问本地库中定义的实用程序?

It seems I need to add the dependency in Build.scala. 看来我需要在Build.scala中添加依赖项。 Here's what I would do for external libray: "com.google.inject" % "guice" % "3.0" 这是我对外部libray的处理方式: "com.google.inject" % "guice" % "3.0"

What would I do in this case? 在这种情况下我该怎么办?

You must add a Resolver precising your local ivy repository: 您必须添加一个Resolver本地常春藤存储库:

resolvers += Resolver.file("Local repo", file("/home/USER/.ivy2/local"))(Resolver.ivyStylePatterns)

You may want to manage resolvers ordering/priorities (meaning, start searching from local repo, then if not found, try external repositories). 您可能要管理解析器的排序/优先级(意思是,从本地存储库开始搜索,然后,如果找不到,请尝试外部存储库)。 In this case, you must deal with Proxy Repositories . 在这种情况下,您必须处理Proxy Repositories

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM