Playframework(14)Publish the Dist Binary

本文介绍如何使用Playframework 2发布dist包,包括配置Build.scala文件,设置依赖项及发布到私有仓库的过程。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Playframework(14)Publish the Dist Binary

Here is the project/Build.scala
import sbt._
import sbt.Keys._
import PlayProject._

object ApplicationBuild extends Build {

    val appName         = “projectName"
    val appVersion      = "1.0-SNAPSHOT"

  lazy val distSettings = Seq[Setting[_]] (
    // Type of the Artifact : zip
    // Extension of the Artifact : zip
    artifact in dist <<= moduleName(n => Artifact(n, "zip", "zip"))
  ) ++ Seq(addArtifact(artifact in (Compile, dist), dist).settings: _*)

    val appDependencies = Seq(
      // Add your project dependencies here,
      "mysql" % "mysql-connector-java" % "5.1.13",
      "net.sf.jasperreports" % "jasperreports" % "5.1.0",
      "org.apache.poi" % "poi" % "3.9",
      "commons-logging" % "commons-logging" % "1.1.2",
      "commons-digester" % "commons-digester" % "2.1",
      "commons-collections" % "commons-collections" % "3.2.1",
      "org.springframework" % "spring-core" % "3.2.2.RELEASE",
      "org.springframework" % "spring-beans" % "3.2.2.RELEASE",
      "com.lowagie" % "itext" % "4.2.0",
      "org.codehaus.groovy" % "groovy-all" % "2.1.3",
      "org.scalaquery" % "scalaquery_2.9.0-1" % "0.9.5",
      "c3p0" % "c3p0" % "0.9.1.2",
      "mysql" % "mysql-connector-java" % "5.1.25",
      "org.scalatest" %% "scalatest" % "1.8" % "test"
    )

    val main = PlayProject(appName, appVersion, appDependencies, mainLang = SCALA
        ,settings = Defaults.defaultSettings ++ distSettings
      ).settings(
      // Add your own project settings here
      testOptions in Test := Nil,

        // Optional
        // Disable jar for this project (useless)
        //publishArtifact in (Compile, packageBin) := false,

        // Disable scaladoc generation for this project (useless)
        //publishArtifact in (Compile, packageDoc) := false,

        // Disable source jar for this project (useless)
        //publishArtifact in (Compile, packageSrc) := false,

      resolvers += “sillycat repo" at "http://repository.sillycat.com/artifactory/sillycat-dev",
      credentials += Credentials("Artifactory Realm", "repository.sillycat.com", “sillycat", “password"),
      publishTo := Some(“Sillycat Artifactory Dev" at "http://repository.sillycat.com/artifactory/sillycat-dev/")
    )

}

The command will publish the zip and the jar
>sbt clean update compile package dist publish




References:
http://blog.dlecan.com/how-to-publish-play-framework-v2-dist-package/



评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值