Play 2.1.1 构建依赖

4

我是新手,正在使用Play框架开发Java Web应用程序。我了解到构建play 2.1.1应用程序需要使用SBT

问题:

  1. 这是Play的默认构建系统吗?我们没有任何Play框架命令可以构建、测试、解决依赖关系等吗?

  2. 我可以在Maven/Maven存储库中使用Play框架吗?如果我只想使用SBT,我可以将SBT与Maven存储库一起使用吗?这是一个好习惯吗?

  3. 我尝试安装SBT。解压下载的zip文件并将<SBT_HOME>\bin目录添加到Windows路径变量中。当我执行sbt命令时,出现以下错误:

    The system cannot find the file C:\installations\sbt\bin\sbtconfig.txt. java.io.FileNotFoundException: C:\Windows\system32\config\systemprofile\.sbt\boot\update.log (The system cannot find the path specified)

我的安装有问题吗?


尽管Play的构建系统使用sbt,但我从未下载过它来运行我的应用程序,您可以简单地使用play runplay compile等命令。我没有尝试过这个,但它说您可以使用Maven管理依赖项。至于您最后的错误,今天早上我遇到了类似的问题,因为我将Play放在一个我没有读/写访问权限的目录中,所以也许您可以检查一下这个问题。 - Aerus
1个回答

3
  1. Is this the default build system for Play?

    Yes, sbt is the default build system for Play application.

  2. Can I use Play framework with Maven / Maven repository?

    Yes, by default, Play uses Maven2 repository and Typesafe repository. Here's the default resolver:

    resolvers ++= Seq(
        "Maven Repository" at "http://repo1.maven.org/maven2/",
        "Typesafe Repository" at "http://repo.typesafe.com/typesafe/releases/"
    )
    

    If you need to find add a dependency, you can simply go to the Maven2 repository.

    For example, this is the repository for Google Guice

    http://mvnrepository.com/artifact/com.google.code.guice/guice/1.0

    You should be able to see a sbt tab, and find the code you need to write in Build.scala

    libraryDependencies += "com.google.code.guice" % "guice" % "1.0"

  3. There's no need to install sbt if you have installed play.

    Simply cd to your project directory and run play.


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接