Matthew Madson
Matthew Madson

Reputation: 1733

How do I configure a Play! Framework project to be built as a war using only Ant or Maven?

I realize, from the documentation (http://www.playframework.org/documentation/1.2.1/deployment), that if the Play! Framework is already installed and configured properly then creating a deployable war is as simple as running the command:

play war myapp -o myapp.war

But what if the Play! Framework is not installed on the target machine and requirements call for a standard war to be created from either an Ant or Maven build script? How would one go about creating a build script or pom file that could leverage the Play! Framework API to generate the desired war artifact without permanently installing the framework to the target machine. Can this be done easily?

Upvotes: 1

Views: 1101

Answers (3)

Eric Rich
Eric Rich

Reputation: 116

Typically this would be done as follows:

  1. Build the Play application and generate a WAR on a machine where Play is installed.
  2. Deploy the WAR generated from Play to a Maven repository (preferably a Maven repo server shared amongst the group, or a local Maven repo dir that is synced via version control, or simply checking in the WAR into version control and teammates would install into their local Maven repo via mvn install).
  3. Add the WAR as a dependency in your Maven project so it will be included into the build.

I don't believe it makes since to attempt to build a Play application WAR without having Play installed. The WAR needs to be generated on a machine where Play is installed and then distributed to the other machines as a packaged WAR (preferably via a shared Maven repo server, such as Archiva or Nexus).

Upvotes: 1

i.am.michiel
i.am.michiel

Reputation: 10404

As far as I'm aware of, Play framework is packed together in the war file with your app. So trying to build without having play installed or available seems quite difficult.

Upvotes: 0

Codemwnci
Codemwnci

Reputation: 54944

Not straight forward. If you look at the python scripts for the play war command, you will see that quite a lot of processing goes on.

You could replicate this into an ANT or Maven script, but you then lose any backwards compatibility you have to future upgrades. I would suggest either ensuring the relevant Play framework files are included, so that the build can be done, or doing the WAR build on a central build server and distributing (or load from CVS/SVN/GIT) the WAR file to target machine(s).

Upvotes: 2

Related Questions