2013-04-22 29 views
0

因此,我正在開發一個應用程序與Play 2.0.4,我需要創建一個WAR文件。我嘗試使用Play2War插件,但我不知道如何設置它。使用Play! 2.0.4與Play2war插件

我試過下面的配置(https://github.com/dlecan/play2-war-plugin/wiki/Configuration) 但是這一切都對神祕的我,似乎沒有任何工作?

有沒有人有白癡證明指南?我應該在哪裏放置我下載的Play2war文件夾?

最好的問候,巴。

+0

我只需要在Glassfish或Apache服務器上部署應用程序,如果沒有WAR文件就可以。 – Debomboys 2013-04-22 19:01:56

回答

1

說實話,play2-war-plugin文檔非常全面。但是爲了將事情分解一點,下面是最低您需要做的就是將helloworld示例應用程序構建爲可以託管在Servlet 2.5容器中的WAR文件。你並不需要手動下載任何東西,正因爲如此,只有兩個項目文件需要被編輯:

項目/ plugins.sbt

// Comment to get more information during initialization 
logLevel := Level.Warn 

// The Typesafe repository 
resolvers += "Typesafe repository" at "http://repo.typesafe.com/typesafe/releases/" 

resolvers += "Play2war plugins release" at "http://repository-play-war.forge.cloudbees.com/release/" 

// Use the Play sbt plugin for Play projects 
addSbtPlugin("play" % "sbt-plugin" % Option(System.getProperty("play.version")).getOrElse("2.0")) 

addSbtPlugin("com.github.play2war" % "play2-war-plugin" % "0.8.1") 

項目/ Build.scala

import sbt._ 
import Keys._ 
import PlayProject._ 
import com.github.play2war.plugin._ 

object ApplicationBuild extends Build { 

    val appName   = "helloworld" 
    val appVersion  = "1.0" 

    val appDependencies = Seq(
     // Add your project dependencies here, 
    ) 

    val main = PlayProject(appName, appVersion, appDependencies, mainLang = JAVA).settings(
     // Add your own project settings here 
     Play2WarKeys.servletVersion := "2.5" 
    ).settings(Play2WarPlugin.play2WarSettings: _*) 

} 

一旦你做了這些編輯,你應該能夠產生從helloworld目錄中運行以下命令WAR文件:

play war 

Build.scala上代替這個插件可能會有更好的方法,但這應該會讓你繼續。

+0

這似乎奏效了。感謝您的好指示。 – Debomboys 2013-04-22 20:27:17

0

在控制檯上:play war [app] -o app.war。我認爲它應該可以工作

+0

該命令似乎不適用於2.0.4 – Debomboys 2013-04-22 19:01:06