alvinalexander.com | career | drupal | java | mac | mysql | perl | scala | uml | unix  

Play Framework/Scala example source code file (Project.scala)

This example Play Framework source code file (Project.scala) is included in my "Source Code Warehouse" project. The intent of this project is to help you more easily find Play Framework (and Scala) source code examples by using tags.

All credit for the original source code belongs to Play Framework; I'm just trying to make examples easier to find. (For my Scala work, see my Scala examples and tutorials.)

Play Framework tags/keywords

autoplugin, compile, play, play framework, playenhancer, playexceptions, playjava, plugin, routescompiler, sbt, sbtjstask, sbtwebdriver, seq

The Project.scala Play Framework example source code

/*
 * Copyright (C) 2009-2013 Typesafe Inc. <http://www.typesafe.com>
 */
package play

import sbt._
import sbt.Keys._

import com.typesafe.sbt.SbtNativePackager.packageArchetype
import com.typesafe.sbt.jse.SbtJsTask
import com.typesafe.sbt.webdriver.SbtWebDriver
import com.typesafe.play.sbt.enhancer.PlayEnhancer
import play.twirl.sbt.SbtTwirl
import play.sbtplugin.PlayPositionMapper
import play.sbtplugin.routes.RoutesCompiler

/**
 * Base plugin for Play projects. Declares common settings for both Java and Scala based Play projects.
 */
object Play
  extends AutoPlugin
  with PlayExceptions
  with PlayReloader
  with PlayCommands
  with PlayRun
  with play.PlaySettings
  with PlayPositionMapper {

  override def requires = SbtTwirl && SbtJsTask && SbtWebDriver && RoutesCompiler

  val autoImport = play.PlayImport

  override def projectSettings =
    packageArchetype.java_server ++
      defaultSettings ++
      intellijCommandSettings ++
      Seq(testListeners += testListener) ++
      Seq(
        scalacOptions ++= Seq("-deprecation", "-unchecked", "-encoding", "utf8"),
        javacOptions in Compile ++= Seq("-encoding", "utf8", "-g")
      )
}

/**
 * The main plugin for Play Java projects. To use this the plugin must be made available to your project
 * via sbt's enablePlugins mechanism e.g.:
 * {{{
 *   lazy val root = project.in(file(".")).enablePlugins(PlayJava)
 * }}}
 */
object PlayJava extends AutoPlugin {
  override def requires = Play && PlayEnhancer

  import Play._
  import Play.autoImport._
  override def projectSettings =
    eclipseCommandSettings(JAVA) ++
    defaultJavaSettings ++
    Seq(libraryDependencies += javaCore)
}

/**
 * The main plugin for Play Scala projects. To use this the plugin must be made available to your project
 * via sbt's enablePlugins mechanism e.g.:
 * {{{
 *   lazy val root = project.in(file(".")).enablePlugins(PlayScala)
 * }}}
 */
object PlayScala extends AutoPlugin {
  override def requires = Play

  import Play._
  override def projectSettings =
    eclipseCommandSettings(SCALA) ++
    defaultScalaSettings
}

Other Play Framework source code examples

Here is a short list of links related to this Play Framework Project.scala source code file:

... this post is sponsored by my books ...

#1 New Release!

FP Best Seller

 

new blog posts

 

Copyright 1998-2021 Alvin Alexander, alvinalexander.com
All Rights Reserved.

A percentage of advertising revenue from
pages under the /java/jwarehouse URI on this website is
paid back to open source projects.